diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c6822b41bf..63384e7045 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,23 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-06-19 19:23 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * harbour/contrib/hbqt/generator/qt45.qtp + * harbour/contrib/hbqt/hbqt.ch + * harbour/contrib/hbqt/hbqt.h + + harbour/contrib/hbqt/hbqt_qfocusevent.cpp + * harbour/contrib/hbqt/hbqt_qlineedit.cpp + * harbour/contrib/hbqt/hbqt_slots.cpp + * harbour/contrib/hbqt/hbqt_slots.h + * harbour/contrib/hbqt/Makefile_gen + * harbour/contrib/hbqt/moc_slots.cpp + + harbour/contrib/hbqt/TQFocusEvent.prg + * harbour/contrib/hbqt/TQLineEdit.prg + + harbour/contrib/hbqt/qth/QFocusEvent.qth + + Added one more class and tweaked others. + + Added generic event handler ( Code provided by Marcos Gambeta - thanks ) + Event handler code has been optimized to free memory and be reusable. + 2009-06-20 04:22 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * source/rtl/mlcfunc.c % Minor optimization to EOL parameter handling. diff --git a/harbour/contrib/hbqt/Makefile_gen b/harbour/contrib/hbqt/Makefile_gen index 75a62268f2..ea2e3643c5 100644 --- a/harbour/contrib/hbqt/Makefile_gen +++ b/harbour/contrib/hbqt/Makefile_gen @@ -199,6 +199,7 @@ CPP_SOURCES=\ hbqt_base.cpp \ hbqt_utils.cpp \ hbqt_slots.cpp \ + hbqt_qfocusevent.cpp \ moc_slots.cpp \ @@ -401,5 +402,6 @@ PRG_SOURCES=\ TQWindowsStyle.prg \ TQWindowsXPStyle.prg \ TQWizard.prg \ + TQFocusEvent.prg \ diff --git a/harbour/contrib/hbqt/TQFocusEvent.prg b/harbour/contrib/hbqt/TQFocusEvent.prg new file mode 100644 index 0000000000..2958c845a8 --- /dev/null +++ b/harbour/contrib/hbqt/TQFocusEvent.prg @@ -0,0 +1,83 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009 Marcos Antonio Gambeta + * Copyright 2009 Pritpal Bedi + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ + + +#include "hbclass.ch" + + +CREATE CLASS QFocusEvent INHERIT QEvent + + VAR pParent + VAR pPtr + + METHOD New() + + METHOD gotFocus() INLINE Qt_QFocusEvent_gotFocus( ::pPtr ) + METHOD lostFocus() INLINE Qt_QFocusEvent_lostFocus( ::pPtr ) + METHOD reason() INLINE Qt_QFocusEvent_reason( ::pPtr ) + + ENDCLASS + +/*----------------------------------------------------------------------*/ + +METHOD New( pParent ) CLASS QFocusEvent + + ::pParent := pParent + + ::pPtr := Qt_QFocusEvent( pParent ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + diff --git a/harbour/contrib/hbqt/TQLineEdit.prg b/harbour/contrib/hbqt/TQLineEdit.prg index 9de55baf80..e503ddb215 100644 --- a/harbour/contrib/hbqt/TQLineEdit.prg +++ b/harbour/contrib/hbqt/TQLineEdit.prg @@ -118,6 +118,7 @@ CREATE CLASS QLineEdit INHERIT QWidget METHOD selectAll() INLINE Qt_QLineEdit_selectAll( ::pPtr ) METHOD setText( cQString ) INLINE Qt_QLineEdit_setText( ::pPtr, cQString ) METHOD undo() INLINE Qt_QLineEdit_undo( ::pPtr ) + METHOD event( pEvent ) INLINE Qt_QLineEdit_event( ::pPtr, pEvent ) ENDCLASS diff --git a/harbour/contrib/hbqt/generator/qt45.qtp b/harbour/contrib/hbqt/generator/qt45.qtp index 33b2e71106..b4df61778b 100644 --- a/harbour/contrib/hbqt/generator/qt45.qtp +++ b/harbour/contrib/hbqt/generator/qt45.qtp @@ -49,6 +49,7 @@ QEvent.qth QEventLoop.qth QFileDialog.qth QFileSystemModel.qth +QFocusEvent.qth QFocusFrame.qth QFont.qth QFontComboBox.qth diff --git a/harbour/contrib/hbqt/hbqt.ch b/harbour/contrib/hbqt/hbqt.ch index ae665b9554..6136ce5ce8 100644 --- a/harbour/contrib/hbqt/hbqt.ch +++ b/harbour/contrib/hbqt/hbqt.ch @@ -68,134 +68,134 @@ #define QEvent_None 0 // Not an event. -#define QEvent_AccessibilityDescription 130 // Used to query accessibility description texts (QAccessibleEvent). -#define QEvent_AccessibilityHelp 119 // Used to query accessibility help texts (QAccessibleEvent). -#define QEvent_AccessibilityPrepare 86 // Accessibility information is requested. -#define QEvent_ActionAdded 114 // A new action has been added (QActionEvent). -#define QEvent_ActionChanged 113 // An action has been changed (QActionEvent). -#define QEvent_ActionRemoved 115 // An action has been removed (QActionEvent). -#define QEvent_ActivationChange 99 // A widget's top-level window activation state has changed. -#define QEvent_ApplicationActivate 121 // The application has been made available to the user. -#define QEvent_ApplicationActivated 121 // This enum has been deprecated. Use ApplicationActivate instead. -#define QEvent_ApplicationDeactivate 122 // The application has been suspended, and is unavailable to the user. +#define QEvent_Timer 1 // Regular timer events (QTimerEvent). +#define QEvent_MouseButtonPress 2 // Mouse press (QMouseEvent). +#define QEvent_MouseButtonRelease 3 // Mouse release (QMouseEvent). +#define QEvent_MouseButtonDblClick 4 // Mouse press again (QMouseEvent). +#define QEvent_MouseMove 5 // Mouse move (QMouseEvent). +#define QEvent_KeyPress 6 // Key press (QKeyEvent). +#define QEvent_KeyRelease 7 // Key release (QKeyEvent). +#define QEvent_FocusIn 8 // Widget gains keyboard focus (QFocusEvent). +#define QEvent_FocusOut 9 // Widget loses keyboard focus (QFocusEvent). +#define QEvent_Enter 10 // Mouse enters widget's boundaries. +#define QEvent_Leave 11 // Mouse leaves widget's boundaries. +#define QEvent_Paint 12 // Screen update necessary (QPaintEvent). +#define QEvent_Move 13 // Widget's position changed (QMoveEvent). +#define QEvent_Resize 14 // Widget's size changed (QResizeEvent). +#define QEvent_Show 17 // Widget was shown on screen (QShowEvent). +#define QEvent_Hide 18 // Widget was hidden (QHideEvent). +#define QEvent_Close 19 // Widget was closed (QCloseEvent). +#define QEvent_ParentChange 21 // The widget parent has changed. +#define QEvent_WindowActivate 24 // Window was activated. +#define QEvent_WindowDeactivate 25 // Window was deactivated. +#define QEvent_ShowToParent 26 // A child widget has been shown. +#define QEvent_HideToParent 27 // A child widget has been hidden. +#define QEvent_Wheel 31 // Mouse wheel rolled (QWheelEvent). +#define QEvent_WindowTitleChange 33 // The window title has changed. +#define QEvent_WindowIconChange 34 // The window's icon has changed. +#define QEvent_ApplicationWindowIconChange 35 // The application's icon has changed. #define QEvent_ApplicationFontChange 36 // The default application font has changed. #define QEvent_ApplicationLayoutDirectionChange 37 // The default application layout direction has changed. #define QEvent_ApplicationPaletteChange 38 // The default application palette has changed. -#define QEvent_ApplicationWindowIconChange 35 // The application's icon has changed. -#define QEvent_ChildAdded 68 // An object gets a child (QChildEvent). -#define QEvent_ChildInserted 70 // An object gets a child (QChildEvent). Qt3Support only, use ChildAdded instead. -#define QEvent_ChildPolished 69 // A widget child gets polished (QChildEvent). -#define QEvent_ChildRemoved 71 // An object loses a child (QChildEvent). +#define QEvent_PaletteChange 39 // Palette of the widget changed. #define QEvent_Clipboard 40 // The clipboard contents have changed (QClipboardEvent). -#define QEvent_Close 19 // Widget was closed (QCloseEvent). -#define QEvent_ContentsRectChange 178 // The margins of the widget's content rect changed. -#define QEvent_ContextMenu 82 // Context popup menu (QContextMenuEvent). -#define QEvent_CursorChange 183 // The widget's cursor has changed. +#define QEvent_MetaCall 43 // An asynchronous method invocation via QMetaObject_invokeMethod(). +#define QEvent_SockAct 50 // Socket activated, used to implement QSocketNotifier. +#define QEvent_ShortcutOverride 51 // Key press in child, for overriding shortcut key handling (QKeyEvent). #define QEvent_DeferredDelete 52 // The object will be deleted after it has cleaned up. #define QEvent_DragEnter 60 // The cursor enters a widget during a drag and drop operation (QDragEnterEvent). #define QEvent_DragLeave 62 // The cursor leaves a widget during a drag and drop operation (QDragLeaveEvent). #define QEvent_DragMove 61 // A drag and drop operation is in progress (QDragMoveEvent). #define QEvent_Drop 63 // A drag and drop operation is completed (QDropEvent). -#define QEvent_EnabledChange 98 // Widget's enabled state has changed. -#define QEvent_Enter 10 // Mouse enters widget's boundaries. -#define QEvent_EnterEditFocus 150 // An editor widget gains focus for editing. -#define QEvent_EnterWhatsThisMode 124 // Send to toplevel widgets when the application enters "What's This?" mode. -#define QEvent_FileOpen 116 // File open request (QFileOpenEvent). -#define QEvent_FocusIn 8 // Widget gains keyboard focus (QFocusEvent). -#define QEvent_FocusOut 9 // Widget loses keyboard focus (QFocusEvent). -#define QEvent_FontChange 97 // Widget's font has changed. -#define QEvent_GrabKeyboard 188 // Item gains keyboard grab (QGraphicsItem only). -#define QEvent_GrabMouse 186 // Item gains mouse grab (QGraphicsItem only). -#define QEvent_GraphicsSceneContextMenu 159 // Context popup menu over a graphics scene (QGraphicsSceneContextMenuEvent). -#define QEvent_GraphicsSceneDragEnter 164 // The cursor enters a graphics scene during a drag and drop operation. -#define QEvent_GraphicsSceneDragLeave 166 // The cursor leaves a graphics scene during a drag and drop operation. -#define QEvent_GraphicsSceneDragMove 165 // A drag and drop operation is in progress over a scene. -#define QEvent_GraphicsSceneDrop 167 // A drag and drop operation is completed over a scene. -#define QEvent_GraphicsSceneHelp 163 // The user requests help for a graphics scene (QHelpEvent). -#define QEvent_GraphicsSceneHoverEnter 160 // The mouse cursor enters a hover item in a graphics scene (QGraphicsSceneHoverEvent). -#define QEvent_GraphicsSceneHoverLeave 162 // The mouse cursor leaves a hover item in a graphics scene (QGraphicsSceneHoverEvent). -#define QEvent_GraphicsSceneHoverMove 161 // The mouse cursor moves inside a hover item in a graphics scene (QGraphicsSceneHoverEvent). -#define QEvent_GraphicsSceneMouseDoubleClick 158 // Mouse press again (double click) in a graphics scene (QGraphicsSceneMouseEvent). -#define QEvent_GraphicsSceneMouseMove 155 // Move mouse in a graphics scene (QGraphicsSceneMouseEvent). -#define QEvent_GraphicsSceneMousePress 156 // Mouse press in a graphics scene (QGraphicsSceneMouseEvent). -#define QEvent_GraphicsSceneMouseRelease 157 // Mouse release in a graphics scene (QGraphicsSceneMouseEvent). -#define QEvent_GraphicsSceneMove 182 // Widget was moved (QGraphicsSceneMoveEvent). -#define QEvent_GraphicsSceneResize 181 // Widget was resized (QGraphicsSceneResizeEvent). -#define QEvent_GraphicsSceneWheel 168 // Mouse wheel rolled in a graphics scene (QGraphicsSceneWheelEvent). -#define QEvent_Hide 18 // Widget was hidden (QHideEvent). -#define QEvent_HideToParent 27 // A child widget has been hidden. -#define QEvent_HoverEnter 127 // The mouse cursor enters a hover widget (QHoverEvent). -#define QEvent_HoverLeave 128 // The mouse cursor leaves a hover widget (QHoverEvent). -#define QEvent_HoverMove 129 // The mouse cursor moves inside a hover widget (QHoverEvent). -#define QEvent_IconDrag 96 // The main icon of a window has been dragged away (QIconDragEvent). -#define QEvent_IconTextChange 101 // Widget's icon text has been changed. +#define QEvent_ChildAdded 68 // An object gets a child (QChildEvent). +#define QEvent_ChildPolished 69 // A widget child gets polished (QChildEvent). +#define QEvent_ChildInserted 70 // An object gets a child (QChildEvent). Qt3Support only, use ChildAdded instead. +#define QEvent_ChildRemoved 71 // An object loses a child (QChildEvent). +#define QEvent_PolishRequest 74 // The widget should be polished. +#define QEvent_Polish 75 // The widget is polished. +#define QEvent_LayoutRequest 76 // Widget layout needs to be redone. +#define QEvent_UpdateRequest 77 // The widget should be repainted. +#define QEvent_UpdateLater 78 // The widget should be queued to be repainted at a later time. +#define QEvent_ContextMenu 82 // Context popup menu (QContextMenuEvent). #define QEvent_InputMethod 83 // An input method is being used (QInputMethodEvent). -#define QEvent_KeyPress 6 // Key press (QKeyEvent). -#define QEvent_KeyRelease 7 // Key release (QKeyEvent). +#define QEvent_AccessibilityPrepare 86 // Accessibility information is requested. +#define QEvent_TabletMove 87 // Wacom tablet move (QTabletEvent). +#define QEvent_LocaleChange 88 // The system locale has changed. #define QEvent_LanguageChange 89 // The application translation changed. #define QEvent_LayoutDirectionChange 90 // The direction of layouts changed. -#define QEvent_LayoutRequest 76 // Widget layout needs to be redone. -#define QEvent_Leave 11 // Mouse leaves widget's boundaries. -#define QEvent_LeaveEditFocus 151 // An editor widget loses focus for editing. -#define QEvent_LeaveWhatsThisMode 125 // Send to toplevel widgets when the application leaves "What's This?" mode. -#define QEvent_LocaleChange 88 // The system locale has changed. -#define QEvent_NonClientAreaMouseButtonDblClick 176 // A mouse double click occurred outside the client area. -#define QEvent_NonClientAreaMouseButtonPress 174 // A mouse button press occurred outside the client area. -#define QEvent_NonClientAreaMouseButtonRelease 175 // A mouse button release occurred outside the client area. -#define QEvent_NonClientAreaMouseMove 173 // A mouse move occurred outside the client area. -#define QEvent_MacSizeChange 177 // The user changed his widget sizes (Mac OS X only). -#define QEvent_MenubarUpdated 153 // The window's menu bar has been updated. -#define QEvent_MetaCall 43 // An asynchronous method invocation via QMetaObject_invokeMethod(). -#define QEvent_ModifiedChange 102 // Widgets modification state has been changed. -#define QEvent_MouseButtonDblClick 4 // Mouse press again (QMouseEvent). -#define QEvent_MouseButtonPress 2 // Mouse press (QMouseEvent). -#define QEvent_MouseButtonRelease 3 // Mouse release (QMouseEvent). -#define QEvent_MouseMove 5 // Mouse move (QMouseEvent). -#define QEvent_MouseTrackingChange 109 // The mouse tracking state has changed. -#define QEvent_Move 13 // Widget's position changed (QMoveEvent). -#define QEvent_Paint 12 // Screen update necessary (QPaintEvent). -#define QEvent_PaletteChange 39 // Palette of the widget changed. -#define QEvent_ParentAboutToChange 131 // The widget parent is about to change. -#define QEvent_ParentChange 21 // The widget parent has changed. -#define QEvent_Polish 75 // The widget is polished. -#define QEvent_PolishRequest 74 // The widget should be polished. -#define QEvent_QueryWhatsThis 123 // The widget should accept the event if it has "What's This?" help. -#define QEvent_Resize 14 // Widget's size changed (QResizeEvent). -#define QEvent_Shortcut 117 // Key press in child for shortcut key handling (QShortcutEvent). -#define QEvent_ShortcutOverride 51 // Key press in child, for overriding shortcut key handling (QKeyEvent). -#define QEvent_Show 17 // Widget was shown on screen (QShowEvent). -#define QEvent_ShowToParent 26 // A child widget has been shown. -#define QEvent_SockAct 50 // Socket activated, used to implement QSocketNotifier. -#define QEvent_StatusTip 112 // A status tip is requested (QStatusTipEvent). -#define QEvent_StyleChange 100 // Widget's style has been changed. -#define QEvent_TabletMove 87 // Wacom tablet move (QTabletEvent). #define QEvent_TabletPress 92 // Wacom tablet press (QTabletEvent). #define QEvent_TabletRelease 93 // Wacom tablet release (QTabletEvent). #define QEvent_OkRequest 94 // Ok button in decoration pressed. Supported only for Windows CE. -#define QEvent_TabletEnterProximity 171 // Wacom tablet enter proximity event (QTabletEvent), sent to QApplication. -#define QEvent_TabletLeaveProximity 172 // Wacom tablet leave proximity event (QTabletEvent), sent to QApplication. -#define QEvent_Timer 1 // Regular timer events (QTimerEvent). -#define QEvent_ToolBarChange 120 // The toolbar button is toggled on Mac OS X. -#define QEvent_ToolTip 110 // A tooltip was requested (QHelpEvent). -#define QEvent_ToolTipChange 184 // The widget's tooltip has changed. -#define QEvent_UngrabKeyboard 189 // Item loses keyboard grab (QGraphicsItem only). -#define QEvent_UngrabMouse 187 // Item loses mouse grab (QGraphicsItem only). -#define QEvent_UpdateLater 78 // The widget should be queued to be repainted at a later time. -#define QEvent_UpdateRequest 77 // The widget should be repainted. -#define QEvent_WhatsThis 111 // The widget should reveal "What's This?" help (QHelpEvent). -#define QEvent_WhatsThisClicked 118 // A link in a widget's "What's This?" help was clicked. -#define QEvent_Wheel 31 // Mouse wheel rolled (QWheelEvent). -#define QEvent_WinEventAct 132 // A Windows-specific activation event has occurred. -#define QEvent_WindowActivate 24 // Window was activated. +#define QEvent_IconDrag 96 // The main icon of a window has been dragged away (QIconDragEvent). +#define QEvent_FontChange 97 // Widget's font has changed. +#define QEvent_EnabledChange 98 // Widget's enabled state has changed. +#define QEvent_ActivationChange 99 // A widget's top-level window activation state has changed. +#define QEvent_StyleChange 100 // Widget's style has been changed. +#define QEvent_IconTextChange 101 // Widget's icon text has been changed. +#define QEvent_ModifiedChange 102 // Widgets modification state has been changed. #define QEvent_WindowBlocked 103 // The window is blocked by a modal dialog. -#define QEvent_WindowDeactivate 25 // Window was deactivated. -#define QEvent_WindowIconChange 34 // The window's icon has changed. -#define QEvent_WindowStateChange 105 // The window's state (minimized, maximized or full-screen) has changed (QWindowStateChangeEvent). -#define QEvent_WindowTitleChange 33 // The window title has changed. #define QEvent_WindowUnblocked 104 // The window is unblocked after a modal dialog exited. +#define QEvent_WindowStateChange 105 // The window's state (minimized, maximized or full-screen) has changed (QWindowStateChangeEvent). +#define QEvent_MouseTrackingChange 109 // The mouse tracking state has changed. +#define QEvent_ToolTip 110 // A tooltip was requested (QHelpEvent). +#define QEvent_WhatsThis 111 // The widget should reveal "What's This?" help (QHelpEvent). +#define QEvent_StatusTip 112 // A status tip is requested (QStatusTipEvent). +#define QEvent_ActionChanged 113 // An action has been changed (QActionEvent). +#define QEvent_ActionAdded 114 // A new action has been added (QActionEvent). +#define QEvent_ActionRemoved 115 // An action has been removed (QActionEvent). +#define QEvent_FileOpen 116 // File open request (QFileOpenEvent). +#define QEvent_Shortcut 117 // Key press in child for shortcut key handling (QShortcutEvent). +#define QEvent_WhatsThisClicked 118 // A link in a widget's "What's This?" help was clicked. +#define QEvent_AccessibilityHelp 119 // Used to query accessibility help texts (QAccessibleEvent). +#define QEvent_ToolBarChange 120 // The toolbar button is toggled on Mac OS X. +#define QEvent_ApplicationActivate 121 // The application has been made available to the user. +#define QEvent_ApplicationActivated 121 // This enum has been deprecated. Use ApplicationActivate instead. +#define QEvent_ApplicationDeactivate 122 // The application has been suspended, and is unavailable to the user. +#define QEvent_QueryWhatsThis 123 // The widget should accept the event if it has "What's This?" help. +#define QEvent_EnterWhatsThisMode 124 // Send to toplevel widgets when the application enters "What's This?" mode. +#define QEvent_LeaveWhatsThisMode 125 // Send to toplevel widgets when the application leaves "What's This?" mode. #define QEvent_ZOrderChange 126 // The widget's z-order has changed. This event is never sent to top level windows. +#define QEvent_HoverEnter 127 // The mouse cursor enters a hover widget (QHoverEvent). +#define QEvent_HoverLeave 128 // The mouse cursor leaves a hover widget (QHoverEvent). +#define QEvent_HoverMove 129 // The mouse cursor moves inside a hover widget (QHoverEvent). +#define QEvent_AccessibilityDescription 130 // Used to query accessibility description texts (QAccessibleEvent). +#define QEvent_ParentAboutToChange 131 // The widget parent is about to change. +#define QEvent_WinEventAct 132 // A Windows-specific activation event has occurred. +#define QEvent_EnterEditFocus 150 // An editor widget gains focus for editing. +#define QEvent_LeaveEditFocus 151 // An editor widget loses focus for editing. +#define QEvent_MenubarUpdated 153 // The window's menu bar has been updated. +#define QEvent_GraphicsSceneMouseMove 155 // Move mouse in a graphics scene (QGraphicsSceneMouseEvent). +#define QEvent_GraphicsSceneMousePress 156 // Mouse press in a graphics scene (QGraphicsSceneMouseEvent). +#define QEvent_GraphicsSceneMouseRelease 157 // Mouse release in a graphics scene (QGraphicsSceneMouseEvent). +#define QEvent_GraphicsSceneMouseDoubleClick 158 // Mouse press again (double click) in a graphics scene (QGraphicsSceneMouseEvent). +#define QEvent_GraphicsSceneContextMenu 159 // Context popup menu over a graphics scene (QGraphicsSceneContextMenuEvent). +#define QEvent_GraphicsSceneHoverEnter 160 // The mouse cursor enters a hover item in a graphics scene (QGraphicsSceneHoverEvent). +#define QEvent_GraphicsSceneHoverMove 161 // The mouse cursor moves inside a hover item in a graphics scene (QGraphicsSceneHoverEvent). +#define QEvent_GraphicsSceneHoverLeave 162 // The mouse cursor leaves a hover item in a graphics scene (QGraphicsSceneHoverEvent). +#define QEvent_GraphicsSceneHelp 163 // The user requests help for a graphics scene (QHelpEvent). +#define QEvent_GraphicsSceneDragEnter 164 // The cursor enters a graphics scene during a drag and drop operation. +#define QEvent_GraphicsSceneDragMove 165 // A drag and drop operation is in progress over a scene. +#define QEvent_GraphicsSceneDragLeave 166 // The cursor leaves a graphics scene during a drag and drop operation. +#define QEvent_GraphicsSceneDrop 167 // A drag and drop operation is completed over a scene. +#define QEvent_GraphicsSceneWheel 168 // Mouse wheel rolled in a graphics scene (QGraphicsSceneWheelEvent). #define QEvent_KeyboardLayoutChange 169 // The keyboard layout has changed. #define QEvent_DynamicPropertyChange 170 // A dynamic property was added, changed or removed from the object. User events should have values b +#define QEvent_TabletEnterProximity 171 // Wacom tablet enter proximity event (QTabletEvent), sent to QApplication. +#define QEvent_TabletLeaveProximity 172 // Wacom tablet leave proximity event (QTabletEvent), sent to QApplication. +#define QEvent_NonClientAreaMouseMove 173 // A mouse move occurred outside the client area. +#define QEvent_NonClientAreaMouseButtonPress 174 // A mouse button press occurred outside the client area. +#define QEvent_NonClientAreaMouseButtonRelease 175 // A mouse button release occurred outside the client area. +#define QEvent_NonClientAreaMouseButtonDblClick 176 // A mouse double click occurred outside the client area. +#define QEvent_MacSizeChange 177 // The user changed his widget sizes (Mac OS X only). +#define QEvent_ContentsRectChange 178 // The margins of the widget's content rect changed. +#define QEvent_GraphicsSceneResize 181 // Widget was resized (QGraphicsSceneResizeEvent). +#define QEvent_GraphicsSceneMove 182 // Widget was moved (QGraphicsSceneMoveEvent). +#define QEvent_CursorChange 183 // The widget's cursor has changed. +#define QEvent_ToolTipChange 184 // The widget's tooltip has changed. +#define QEvent_GrabMouse 186 // Item gains mouse grab (QGraphicsItem only). +#define QEvent_UngrabMouse 187 // Item loses mouse grab (QGraphicsItem only). +#define QEvent_GrabKeyboard 188 // Item gains keyboard grab (QGraphicsItem only). +#define QEvent_UngrabKeyboard 189 // Item loses keyboard grab (QGraphicsItem only). #define QPalette_Window 10 // A general background color. #define QPalette_Background 10 // This value is obsolete. Use Window instead. @@ -241,6 +241,37 @@ #define QAbstractSlider_SliderStepsChange 2 #define QAbstractSlider_SliderValueChange 3 + +#define Qt_AlignLeft 1 // 0x0001 // Aligns with the left edge. +#define Qt_AlignRight 2 // 0x0002 // Aligns with the right edge. +#define Qt_AlignHCenter 4 // 0x0004 // Centers horizontally in the available space. +#define Qt_AlignJustify 8 // 0x0008 // Justifies the text in the available space. + +#define Qt_AlignTop 32 // 0x0020 // Aligns with the top. +#define Qt_AlignBottom 64 // 0x0040 // Aligns with the bottom. +#define Qt_AlignVCenter 128 // 0x0080 // Centers vertically in the available space. + +#define Qt_AlignCenter AlignVCenter+AlignHCenter // Centers in both dimensions. + +#define Qt_AlignAbsolute 16 // 0x0010 + // If the widget's layout + // direction is Qt_RightToLeft (instead of Qt_LeftToRight, the default), + // Qt_AlignLeft refers to the right edge and Qt_AlignRight to the left edge. + // This is normally the desired behavior. If you want Qt_AlignLeft to always mean + // "left" and Qt_AlignRight to always mean "right", combine the flag with Qt_AlignAbsolute. +#define Qt_AlignLeading AlignLeft // Synonym for Qt_AlignLeft. +#define Qt_AlignTrailing AlignRight// Synonym for Qt_AlignRight. + +#define Qt_AlignHorizontal_Mask AlignLeft + AlignRight + AlignHCenter + AlignJustify + AlignAbsolute +#define Qt_AlignVertical_Mask AlignTop + AlignBottom + AlignVCenter + + + +#define QLineEdit_Normal 0 // Display characters as they are entered. This is the default. +#define QLineEdit_NoEcho 1 // Do not display anything. This may be appropriate for passwords where even the length of the password should be kept secret. +#define QLineEdit_Password 2 // Display asterisks instead of the characters actually entered. +#define QLineEdit_PasswordEchoOnEdit 3 + /*----------------------------------------------------------------------*/ #define _HBQT_CH diff --git a/harbour/contrib/hbqt/hbqt.h b/harbour/contrib/hbqt/hbqt.h index d08d0c430b..eb99adffce 100644 --- a/harbour/contrib/hbqt/hbqt.h +++ b/harbour/contrib/hbqt/hbqt.h @@ -66,6 +66,8 @@ #if QT_VERSION >= 0x040500 +#define hbqt_par_QFocusEvent( n ) ( ( QFocusEvent* ) hb_parptr( n ) ) + #define hbqt_par_QAbstractButton( n ) ( ( QAbstractButton* ) hb_parptr( n ) ) #define hbqt_par_QAbstractItemView( n ) ( ( QAbstractItemView* ) hb_parptr( n ) ) #define hbqt_par_QAbstractItemModel( n ) ( ( QAbstractItemModel* ) hb_parptr( n ) ) diff --git a/harbour/contrib/hbqt/hbqt_qfocusevent.cpp b/harbour/contrib/hbqt/hbqt_qfocusevent.cpp new file mode 100644 index 0000000000..9a868289a8 --- /dev/null +++ b/harbour/contrib/hbqt/hbqt_qfocusevent.cpp @@ -0,0 +1,102 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009 Marcos Antonio Gambeta + * Copyright 2009 Pritpal Bedi + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ + +#include "hbapi.h" +#include "hbqt.h" + +/*----------------------------------------------------------------------*/ +#if QT_VERSION >= 0x040500 +/*----------------------------------------------------------------------*/ + + +#include + + +/* + * QFocusEvent ( Type type, Qt::FocusReason reason = Qt::OtherFocusReason ) + */ +HB_FUNC( QT_QFOCUSEVENT ) +{ + // hb_retptr( ( QFocusEvent* ) new QFocusEvent() ); +} + +/* + * bool gotFocus () const + */ +HB_FUNC( QT_QFOCUSEVENT_GOTFOCUS ) +{ + hb_retl( hbqt_par_QFocusEvent( 1 )->gotFocus() ); +} + +/* + * bool lostFocus () const + */ +HB_FUNC( QT_QFOCUSEVENT_LOSTFOCUS ) +{ + hb_retl( hbqt_par_QFocusEvent( 1 )->lostFocus() ); +} + +/* + * Qt::FocusReason reason () const + */ +HB_FUNC( QT_QFOCUSEVENT_REASON ) +{ + hb_retni( ( Qt::FocusReason ) hbqt_par_QFocusEvent( 1 )->reason() ); +} + + +/*----------------------------------------------------------------------*/ +#endif /* #if QT_VERSION >= 0x040500 */ +/*----------------------------------------------------------------------*/ + diff --git a/harbour/contrib/hbqt/hbqt_qlineedit.cpp b/harbour/contrib/hbqt/hbqt_qlineedit.cpp index 0691aaa8e4..b00ee219aa 100644 --- a/harbour/contrib/hbqt/hbqt_qlineedit.cpp +++ b/harbour/contrib/hbqt/hbqt_qlineedit.cpp @@ -523,6 +523,13 @@ HB_FUNC( QT_QLINEEDIT_UNDO ) hbqt_par_QLineEdit( 1 )->undo(); } +/* + * void undo () + */ +HB_FUNC( QT_QLINEEDIT_EVENT ) +{ + hbqt_par_QLineEdit( 1 )->event( hbqt_par_QEvent( 2 ) ); +} /*----------------------------------------------------------------------*/ #endif /* #if QT_VERSION >= 0x040500 */ diff --git a/harbour/contrib/hbqt/hbqt_slots.cpp b/harbour/contrib/hbqt/hbqt_slots.cpp index 5c80978170..f534d353e4 100644 --- a/harbour/contrib/hbqt/hbqt_slots.cpp +++ b/harbour/contrib/hbqt/hbqt_slots.cpp @@ -60,21 +60,22 @@ #if QT_VERSION >= 0x040500 -#if 0 -#include -#endif - #include "hbqt_slots.h" +#include + #include #include #include #include #include +#include +#include /*----------------------------------------------------------------------*/ -static Slots *s = NULL; +static Slots *s = NULL; +static Events *e = NULL; /*----------------------------------------------------------------------*/ @@ -147,6 +148,22 @@ static void SlotsExecIntInt( QWidget* widget, char* event, int iValue1, int iVal } } +static void SlotsExecString( QWidget* widget, char* event, const QString & string ) +{ + if( widget ) + { + int i = widget->property( event ).toInt(); + if( i > 0 && ( s->listActv.at( i-1 ) == true ) ) + { + PHB_ITEM pWidget = hb_itemPutPtr( NULL, ( QWidget* ) widget ); + PHB_ITEM pString = hb_itemPutPtr( NULL, string.toLatin1().data() ); + hb_vmEvalBlockV( ( PHB_ITEM ) s->listBlock.at( i-1 ), 3, pWidget, pString ); + hb_itemRelease( pWidget ); + hb_itemRelease( pString ); + } + } +} + static void SlotsExecModel( QWidget* widget, char* event, const QModelIndex & index ) { if( widget ) @@ -179,23 +196,20 @@ static void SlotsExecMouseEvent( QWidget* widget, char* event, QMouseEvent* meve } } -bool Slots::event( QEvent * event ) +static void SlotsExecFocusEvent( QWidget* widget, char* event, QFocusEvent* mevent ) { - bool bAccepted = true; - QObject *widget = qobject_cast( sender() ); if( widget ) { - int i = widget->property( "event()" ).toInt(); + int i = widget->property( event ).toInt(); if( ( i > 0 ) && ( s->listActv.at( i-1 ) == true ) ) { PHB_ITEM pWidget = hb_itemPutPtr( NULL, ( QWidget * ) widget ); - PHB_ITEM pEvent = hb_itemPutPtr( NULL, event ); - bAccepted = hb_vmEvalBlockV( ( PHB_ITEM ) listBlock.at( i-1 ), 2, pWidget, pEvent ); + PHB_ITEM pEvent = hb_itemPutPtr( NULL, mevent ); + hb_vmEvalBlockV( ( PHB_ITEM ) s->listBlock.at( i-1 ), 2, pWidget, pEvent ); hb_itemRelease( pWidget ); hb_itemRelease( pEvent ); } } - return bAccepted; } void Slots::keyPressEvent( QKeyEvent * event ) @@ -363,6 +377,32 @@ void Slots::valueChanged( int value ) QWidget *widget = qobject_cast( sender() ); SlotsExecInt( widget, ( char* ) "valueChanged(int)", value ); } +void Slots::cursorPositionChanged( int iOld, int iNew ) +{ + QWidget *widget = qobject_cast( sender() ); + SlotsExecIntInt( widget, ( char* ) "cursorPositionChanged(int,int)", iOld, iNew ); +} +void Slots::editingFinished() +{ + QWidget *widget = qobject_cast( sender() ); + SlotsExec( widget, ( char* ) "editingFinished()" ); +} +void Slots::selectionChanged() +{ + QWidget *widget = qobject_cast( sender() ); + SlotsExec( widget, ( char* ) "selectionChanged()" ); +} +void Slots::textChanged( const QString & text ) +{ + QWidget *widget = qobject_cast( sender() ); + SlotsExecString( widget, ( char* ) "textChanged(QString)", text ); +} +void Slots::textEdited( const QString & text ) +{ + QWidget *widget = qobject_cast( sender() ); + SlotsExecString( widget, ( char* ) "textEdited(QString)", text ); +} + /* * harbour function to connect signals with slots @@ -448,11 +488,6 @@ HB_FUNC( QT_CONNECT_SIGNAL ) ret = widget->connect( widget, SIGNAL( entered( const QModelIndex & ) ), s, SLOT( entered( const QModelIndex & ) ), Qt::AutoConnection ); } - if( signal == ( QString ) "event()" ) - { - ret = widget->connect( widget, SIGNAL( event( QEvent * ) ), - s, SLOT( event( QEvent * ) ) , Qt::AutoConnection ); - } if( signal == ( QString ) "keyPressEvent()" ) { ret = widget->connect( widget, SIGNAL( sg_keyPressEvent( QKeyEvent * ) ), @@ -503,6 +538,36 @@ HB_FUNC( QT_CONNECT_SIGNAL ) ret = widget->connect( widget, SIGNAL( valueChanged(int) ), s, SLOT( valueChanged(int) ), Qt::AutoConnection ); } + if( signal == ( QString ) "cursorPositionChanged(int,int)" ) + { + ret = widget->connect( widget, SIGNAL( cursorPositionChanged(int,int) ), + s, SLOT( cursorPositionChanged(int,int) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "editingFinished()" ) + { + ret = widget->connect( widget, SIGNAL( editingFinished() ), + s, SLOT( editingFinished() ), Qt::AutoConnection ); + } + if( signal == ( QString ) "returnPressed()" ) + { + ret = widget->connect( widget, SIGNAL( returnPressed() ), + s, SLOT( returnPressed() ), Qt::AutoConnection ); + } + if( signal == ( QString ) "selectionChanged()" ) + { + ret = widget->connect( widget, SIGNAL( selectionChanged() ), + s, SLOT( selectionChanged() ), Qt::AutoConnection ); + } + if( signal == ( QString ) "textChanged(QString)" ) + { + ret = widget->connect( widget, SIGNAL( textChanged( const QString &) ), + s, SLOT( textChanged( const QString & ) ), Qt::AutoConnection ); + } + if( signal == ( QString ) "textEdited(QString)" ) + { + ret = widget->connect( widget, SIGNAL( textEdited( const QString &) ), + s, SLOT( textEdited( const QString & ) ), Qt::AutoConnection ); + } hb_retl( ret ); @@ -527,8 +592,8 @@ HB_FUNC( QT_CONNECT_SIGNAL ) } else { - s->listBlock << codeblock; - s->listActv << true; + s->listBlock << codeblock; + s->listActv << true; widget->setProperty( hb_parc( 2 ), ( int ) s->listBlock.size() ); } } @@ -549,11 +614,6 @@ HB_FUNC( QT_DISCONNECT_SIGNAL ) { if( s->listBlock.at( i-1 ) != NULL ) { -#if 0 -char buf[40]; -sprintf( buf, "signal %i : %s", i, event ); -OutputDebugString( buf ); -#endif hb_itemRelease( s->listBlock.at( i-1 ) ); s->listBlock[ i-1 ] = NULL; s->listActv[ i-1 ] = false; @@ -622,6 +682,12 @@ void MyMainWindow::closeEvent( QCloseEvent *event ) { event->accept(); } +HB_FUNC( QT_MYMAINWINDOW ) +{ + hb_retptr( ( MyMainWindow * ) new MyMainWindow() ); +} + +/*----------------------------------------------------------------------*/ MyDrawingArea::MyDrawingArea(QWidget *parent) : QWidget(parent) @@ -636,7 +702,6 @@ MyDrawingArea::MyDrawingArea(QWidget *parent) setAttribute( Qt::WA_InputMethodEnabled, true ); } - MyDrawingArea::~MyDrawingArea( void ) { } @@ -648,17 +713,186 @@ void MyDrawingArea::keyPressEvent( QKeyEvent * event ) { emit sg_keyPressEvent( event ); } - -HB_FUNC( QT_MYMAINWINDOW ) -{ - hb_retptr( ( MyMainWindow * ) new MyMainWindow() ); -} - HB_FUNC( QT_MYDRAWINGAREA ) { hb_retptr( ( MyDrawingArea * ) new MyDrawingArea() ); } /*----------------------------------------------------------------------*/ + +Events::Events( QObject * parent ) : QObject( parent ) +{ +} +Events::~Events() +{ +} +bool Events::eventFilter( QObject * obj, QEvent * event ) +{ + QEvent::Type eventtype = event->type(); + int found;; + bool ret; + + if( ( int ) eventtype == 0 ) + return true; + + char str[ 10 ]; + sprintf( str, "%s%i%s", "P", eventtype, "P" ); + found = obj->property( str ).toInt(); + if( found == 0 ) + return false; + + PHB_ITEM pObject = hb_itemPutPtr( NULL, ( QObject * ) obj ); + PHB_ITEM pEvent = hb_itemPutPtr( NULL, ( QEvent * ) event ); + + ret = hb_itemGetL( hb_vmEvalBlockV( ( PHB_ITEM ) listBlock.at( found - 1 ), 2, pObject, pEvent ) ); + + hb_itemRelease( pObject ); + hb_itemRelease( pEvent ); + + switch( eventtype ) + { + case QEvent::Close: + { + if( ret ) { event->accept(); } else { event->ignore(); } + return true; + break; + } + case QEvent::Enter: + { + return true; + break; + } + case QEvent::FocusIn: + { + return false; + break; + } + case QEvent::FocusOut: + { + return false; + break; + } + case QEvent::Hide: + { + return true; + break; + } + case QEvent::KeyPress: + { + return true; + break; + } + case QEvent::KeyRelease: + { + return true; + break; + } + case QEvent::Leave: + { + return true; + break; + } + case QEvent::Paint: + { + return false; + break; + } + case QEvent::Show: + { + return true; + break; + } + default: + break; + } + return true; +} + +HB_FUNC( QT_QEVENTFILTER ) +{ + if( e == NULL ) + { + e = new Events(); + } + hb_retptr( ( Events * ) e ); +} + +HB_FUNC( QT_CONNECT_EVENT ) +{ + QObject * object = ( QObject * ) hb_parptr( 1 ); + int type = hb_parni( 2 ); + PHB_ITEM codeblock = hb_itemNew( hb_param( 3, HB_IT_BLOCK | HB_IT_BYREF ) ); + + if( e == NULL ) + { + e = new Events(); + } + + bool bFound = false; + int i; + char str[ 10 ]; + sprintf( str, "%s%i%s", "P", type, "P" ); /* Make it a unique identifier */ + + for( i = 0; i < e->listBlock.size(); i++ ) + { + if( e->listBlock.at( i ) == NULL ) + { + bFound = true; + break; + } + } + if( bFound ) + { + e->listBlock[ i ] = codeblock; + e->listActv[ i ] = true; + object->setProperty( str, ( int ) i + 1 ); + } + else + { + e->listBlock << codeblock; + e->listActv << true; + object->setProperty( str, ( int ) e->listBlock.size() ); + } + + hb_retl( true ); +} + +HB_FUNC( QT_DISCONNECT_EVENT ) +{ + QObject * object = ( QObject * ) hb_parptr( 1 ); + int type = hb_parni( 2 ); + + char str[ 10 ]; + sprintf( str, "%s%i%s", "P", type, "P" ); /* Make it a unique identifier */ + + int i = object->property( str ).toInt(); + if( i > 0 && i <= e->listBlock.size() ) + { + if( e->listBlock.at( i-1 ) != NULL ) + { + hb_itemRelease( e->listBlock.at( i-1 ) ); + e->listBlock[ i-1 ] = NULL; + e->listActv[ i-1 ] = false; + } + } +} + +/*----------------------------------------------------------------------*/ + +HB_FUNC( QT_QDEBUG ) +{ + #if defined( _WIN_32 ) + OutputDebugString( hb_parc( 1 ) ); + #else + qDebug( hb_parc( 1 ) ); + #endif +} + +/*----------------------------------------------------------------------*/ + #endif + + + + diff --git a/harbour/contrib/hbqt/hbqt_slots.h b/harbour/contrib/hbqt/hbqt_slots.h index 9aa3a47a90..bb791d92c7 100644 --- a/harbour/contrib/hbqt/hbqt_slots.h +++ b/harbour/contrib/hbqt/hbqt_slots.h @@ -64,12 +64,28 @@ #include #include #include +#include #include "hbapi.h" #include "hbapiitm.h" /*----------------------------------------------------------------------*/ +class MyMainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MyMainWindow(); + virtual ~MyMainWindow(); + +public: + void closeEvent( QCloseEvent *event ); + +}; + +/*----------------------------------------------------------------------*/ + class MyDrawingArea : public QWidget { Q_OBJECT @@ -84,22 +100,6 @@ public: signals: void sg_mouseMoveEvent( QMouseEvent * event ); void sg_keyPressEvent( QKeyEvent * event ); - -}; - -/*----------------------------------------------------------------------*/ - -class MyMainWindow : public QMainWindow -{ - Q_OBJECT - -public: - MyMainWindow(); - virtual ~MyMainWindow(); - -public: - void closeEvent( QCloseEvent *event ); - }; /*----------------------------------------------------------------------*/ @@ -111,8 +111,8 @@ class Slots: public QObject public: Slots( QObject *parent = 0 ); ~Slots(); - QList listBlock; - QList listActv; + QList listBlock; + QList listActv; public slots: void clicked(); @@ -125,23 +125,46 @@ public slots: void activated( int index ); void currentIndexChanged( int index ); void highlighted( int index ); - void returnPressed(); void clicked( const QModelIndex & index ); void doubleClicked( const QModelIndex & index ); void entered( const QModelIndex & index ); void viewportEntered(); - bool event( QEvent * event ); + //bool event( QEvent * event, QWidget * w ); void keyPressEvent( QKeyEvent * event ); void mouseMoveEvent( QMouseEvent * event ); void hovered( QAction * action ); void currentChanged( int index ); - /* Slots to handle sliders */ + /* QAbstractSlider() */ void actionTriggered( int action ); void rangeChanged( int min, int max ); void sliderMoved( int value ); void sliderPressed(); void sliderReleased(); void valueChanged( int value ); + /* QLineEdit() */ + void cursorPositionChanged( int iOld, int iNew ); + void editingFinished(); + void returnPressed(); + void selectionChanged(); + void textChanged( const QString & text ); + void textEdited( const QString & text ); +}; + +class Events: public QObject +{ + Q_OBJECT + +public: + Events( QObject *parent = 0 ); + ~Events(); + //QList list1; + //QList list2; + QList listBlock; + QList listActv; + +protected: + bool eventFilter( QObject * obj, QEvent * event ); + }; /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/moc_slots.cpp b/harbour/contrib/hbqt/moc_slots.cpp index 13ef626d49..ebe4101503 100644 --- a/harbour/contrib/hbqt/moc_slots.cpp +++ b/harbour/contrib/hbqt/moc_slots.cpp @@ -1,7 +1,7 @@ /**************************************************************************** ** Meta object code from reading C++ file 'hbqt_slots.h' ** -** Created: Tue Jun 16 15:09:19 2009 +** Created: Fri Jun 19 19:01:13 2009 ** by: The Qt Meta Object Compiler version 61 (Qt 4.5.0) ** ** WARNING! All changes made in this file will be lost! @@ -17,6 +17,49 @@ #endif QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_MyMainWindow[] = { + + // content: + 2, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + + 0 // eod +}; + +static const char qt_meta_stringdata_MyMainWindow[] = { + "MyMainWindow\0" +}; + +const QMetaObject MyMainWindow::staticMetaObject = { + { &QMainWindow::staticMetaObject, qt_meta_stringdata_MyMainWindow, + qt_meta_data_MyMainWindow, 0 } +}; + +const QMetaObject *MyMainWindow::metaObject() const +{ + return &staticMetaObject; +} + +void *MyMainWindow::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_MyMainWindow)) + return static_cast(const_cast< MyMainWindow*>(this)); + return QMainWindow::qt_metacast(_clname); +} + +int MyMainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QMainWindow::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + return _id; +} static const uint qt_meta_data_MyDrawingArea[] = { // content: @@ -88,56 +131,13 @@ void MyDrawingArea::sg_keyPressEvent(QKeyEvent * _t1) void *_a[] = { 0, const_cast(reinterpret_cast(&_t1)) }; QMetaObject::activate(this, &staticMetaObject, 1, _a); } -static const uint qt_meta_data_MyMainWindow[] = { - - // content: - 2, // revision - 0, // classname - 0, 0, // classinfo - 0, 0, // methods - 0, 0, // properties - 0, 0, // enums/sets - 0, 0, // constructors - - 0 // eod -}; - -static const char qt_meta_stringdata_MyMainWindow[] = { - "MyMainWindow\0" -}; - -const QMetaObject MyMainWindow::staticMetaObject = { - { &QMainWindow::staticMetaObject, qt_meta_stringdata_MyMainWindow, - qt_meta_data_MyMainWindow, 0 } -}; - -const QMetaObject *MyMainWindow::metaObject() const -{ - return &staticMetaObject; -} - -void *MyMainWindow::qt_metacast(const char *_clname) -{ - if (!_clname) return 0; - if (!strcmp(_clname, qt_meta_stringdata_MyMainWindow)) - return static_cast(const_cast< MyMainWindow*>(this)); - return QMainWindow::qt_metacast(_clname); -} - -int MyMainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) -{ - _id = QMainWindow::qt_metacall(_c, _id, _a); - if (_id < 0) - return _id; - return _id; -} static const uint qt_meta_data_Slots[] = { // content: 2, // revision 0, // classname 0, 0, // classinfo - 26, 12, // methods + 30, 12, // methods 0, 0, // properties 0, 0, // enums/sets 0, 0, // constructors @@ -153,22 +153,26 @@ static const uint qt_meta_data_Slots[] = { 114, 108, 6, 6, 0x0a, 129, 108, 6, 6, 0x0a, 154, 108, 6, 6, 0x0a, - 171, 6, 6, 6, 0x0a, - 187, 108, 6, 6, 0x0a, - 208, 108, 6, 6, 0x0a, - 235, 108, 6, 6, 0x0a, - 256, 6, 6, 6, 0x0a, - 285, 279, 274, 6, 0x0a, - 300, 279, 6, 6, 0x0a, - 326, 279, 6, 6, 0x0a, - 362, 355, 6, 6, 0x0a, - 380, 108, 6, 6, 0x0a, - 400, 355, 6, 6, 0x0a, - 429, 421, 6, 6, 0x0a, - 457, 451, 6, 6, 0x0a, - 474, 6, 6, 6, 0x0a, - 490, 6, 6, 6, 0x0a, - 507, 451, 6, 6, 0x0a, + 171, 108, 6, 6, 0x0a, + 192, 108, 6, 6, 0x0a, + 219, 108, 6, 6, 0x0a, + 240, 6, 6, 6, 0x0a, + 264, 258, 6, 6, 0x0a, + 290, 258, 6, 6, 0x0a, + 326, 319, 6, 6, 0x0a, + 344, 108, 6, 6, 0x0a, + 364, 319, 6, 6, 0x0a, + 393, 385, 6, 6, 0x0a, + 421, 415, 6, 6, 0x0a, + 438, 6, 6, 6, 0x0a, + 454, 6, 6, 6, 0x0a, + 471, 415, 6, 6, 0x0a, + 499, 489, 6, 6, 0x0a, + 530, 6, 6, 6, 0x0a, + 548, 6, 6, 6, 0x0a, + 564, 6, 6, 6, 0x0a, + 588, 583, 6, 6, 0x0a, + 609, 583, 6, 6, 0x0a, 0 // eod }; @@ -178,17 +182,20 @@ static const char qt_meta_stringdata_Slots[] = { "triggered(bool)\0hovered()\0state\0" "stateChanged(int)\0pressed()\0released()\0" "index\0activated(int)\0currentIndexChanged(int)\0" - "highlighted(int)\0returnPressed()\0" - "clicked(QModelIndex)\0doubleClicked(QModelIndex)\0" + "highlighted(int)\0clicked(QModelIndex)\0" + "doubleClicked(QModelIndex)\0" "entered(QModelIndex)\0viewportEntered()\0" - "bool\0event\0event(QEvent*)\0" - "keyPressEvent(QKeyEvent*)\0" + "event\0keyPressEvent(QKeyEvent*)\0" "mouseMoveEvent(QMouseEvent*)\0action\0" "hovered(QAction*)\0currentChanged(int)\0" "actionTriggered(int)\0min,max\0" "rangeChanged(int,int)\0value\0" "sliderMoved(int)\0sliderPressed()\0" "sliderReleased()\0valueChanged(int)\0" + "iOld,iNew\0cursorPositionChanged(int,int)\0" + "editingFinished()\0returnPressed()\0" + "selectionChanged()\0text\0textChanged(QString)\0" + "textEdited(QString)\0" }; const QMetaObject Slots::staticMetaObject = { @@ -226,27 +233,73 @@ int Slots::qt_metacall(QMetaObject::Call _c, int _id, void **_a) case 7: activated((*reinterpret_cast< int(*)>(_a[1]))); break; case 8: currentIndexChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 9: highlighted((*reinterpret_cast< int(*)>(_a[1]))); break; - case 10: returnPressed(); break; - case 11: clicked((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; - case 12: doubleClicked((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; - case 13: entered((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; - case 14: viewportEntered(); break; - case 15: { bool _r = event((*reinterpret_cast< QEvent*(*)>(_a[1]))); - if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; } break; - case 16: keyPressEvent((*reinterpret_cast< QKeyEvent*(*)>(_a[1]))); break; - case 17: mouseMoveEvent((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break; - case 18: hovered((*reinterpret_cast< QAction*(*)>(_a[1]))); break; - case 19: currentChanged((*reinterpret_cast< int(*)>(_a[1]))); break; - case 20: actionTriggered((*reinterpret_cast< int(*)>(_a[1]))); break; - case 21: rangeChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; - case 22: sliderMoved((*reinterpret_cast< int(*)>(_a[1]))); break; - case 23: sliderPressed(); break; - case 24: sliderReleased(); break; - case 25: valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; + case 10: clicked((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; + case 11: doubleClicked((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; + case 12: entered((*reinterpret_cast< const QModelIndex(*)>(_a[1]))); break; + case 13: viewportEntered(); break; + case 14: keyPressEvent((*reinterpret_cast< QKeyEvent*(*)>(_a[1]))); break; + case 15: mouseMoveEvent((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break; + case 16: hovered((*reinterpret_cast< QAction*(*)>(_a[1]))); break; + case 17: currentChanged((*reinterpret_cast< int(*)>(_a[1]))); break; + case 18: actionTriggered((*reinterpret_cast< int(*)>(_a[1]))); break; + case 19: rangeChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; + case 20: sliderMoved((*reinterpret_cast< int(*)>(_a[1]))); break; + case 21: sliderPressed(); break; + case 22: sliderReleased(); break; + case 23: valueChanged((*reinterpret_cast< int(*)>(_a[1]))); break; + case 24: cursorPositionChanged((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; + case 25: editingFinished(); break; + case 26: returnPressed(); break; + case 27: selectionChanged(); break; + case 28: textChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break; + case 29: textEdited((*reinterpret_cast< const QString(*)>(_a[1]))); break; default: ; } - _id -= 26; + _id -= 30; } return _id; } +static const uint qt_meta_data_Events[] = { + + // content: + 2, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + + 0 // eod +}; + +static const char qt_meta_stringdata_Events[] = { + "Events\0" +}; + +const QMetaObject Events::staticMetaObject = { + { &QObject::staticMetaObject, qt_meta_stringdata_Events, + qt_meta_data_Events, 0 } +}; + +const QMetaObject *Events::metaObject() const +{ + return &staticMetaObject; +} + +void *Events::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_Events)) + return static_cast(const_cast< Events*>(this)); + return QObject::qt_metacast(_clname); +} + +int Events::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QObject::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + return _id; +} QT_END_MOC_NAMESPACE diff --git a/harbour/contrib/hbqt/qth/QFocusEvent.qth b/harbour/contrib/hbqt/qth/QFocusEvent.qth new file mode 100644 index 0000000000..20555b91a5 --- /dev/null +++ b/harbour/contrib/hbqt/qth/QFocusEvent.qth @@ -0,0 +1,95 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT Source Generator for Harbour + * + * Copyright 2009 Pritpal Bedi + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ +; +; Header File to Generate QT Wrapper Sources +; + + +Inherits = QEvent +Type = Core +New = + + + +#include + + +/* + * QFocusEvent ( Type type, Qt::FocusReason reason = Qt::OtherFocusReason ) + */ +HB_FUNC( QT_QFOCUSEVENT ) +{ + // hb_retptr( ( QFocusEvent* ) new QFocusEvent() ); +} + + + + + + +bool gotFocus () const +bool lostFocus () const +Qt::FocusReason reason () const + + + + + + + + + + + + +