diff --git a/harbour/ChangeLog b/harbour/ChangeLog index ae7976ad81..52f4813df4 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,21 @@ The license applies to all entries newer than 2009-04-28. */ +2011-02-27 11:06 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbqt/qtgui/hbqt_init.cpp + * contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp + * contrib/hbqt/qtcore/hbqt_pointer.cpp + * contrib/hbqt/qtcore/hbqt.h + * contrib/hbqt/qtcore/hbqtcore.hbx + * contrib/hbqt/qtcore/hbqt_hbqevents.cpp + * contrib/hbqt/qtcore/hbqt_misc.prg + * contrib/hbqt/qtcore/hbqt_init.cpp + * contrib/hbqt/qtnetwork/hbqt_init.cpp + * Changed few raw pointers missed in other commits. + Some of them commented because the class wrapper is not implemented yet. + % Deleted unused code. + * Changed object creation according to patch from Francesco. (with my changes) + 2011-02-27 09:25 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/qtgui/hbqt_init.cpp * contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp @@ -29,7 +44,7 @@ It contains modifications of mine. ; TOFIX: Add puller code for internally created objects. Or, even better use pure C++ object creation code, so this is not a problem. - ; TODO: Delete remains of old method. + ; TODO: Delete remains of old method. [DONE] 2011-02-27 08:46 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/qtcore/hbqt_hbqevents.cpp diff --git a/harbour/contrib/hbqt/qtcore/hbqt.h b/harbour/contrib/hbqt/qtcore/hbqt.h index ace55077e4..e0f304bc0e 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt.h +++ b/harbour/contrib/hbqt/qtcore/hbqt.h @@ -102,9 +102,7 @@ extern HB_EXPORT void hbqt_errRT_ARG( void ); extern HB_EXPORT PHB_ITEM hbqt_defineClassBegin( const char* szClsName, PHB_ITEM s_oClass, const char* szParentClsStr ); extern HB_EXPORT void hbqt_defineClassEnd( PHB_ITEM s_oClass, PHB_ITEM oClass ); extern HB_EXPORT void * hbqt_getqtptr( void ); -extern HB_EXPORT PHB_ITEM hbqt_create_object( void * p, const char * objectName ); -extern HB_EXPORT PHB_ITEM hbqt_create_objectFromEventType( void * pEvent, int type ); -extern HB_EXPORT PHB_ITEM hbqt_create_objectFromEventType2( void * pEvent, const char * pszName ); +extern HB_EXPORT PHB_ITEM hbqt_create_object( void * pObject, const char * pszObjectName ); HB_EXTERN_END #define hbqt_par_QString( n ) ( ( QString ) hb_parcx( n ) ) diff --git a/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp b/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp index 6994e25e4f..fa1f565a31 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp @@ -203,22 +203,20 @@ bool HBQEvents::eventFilter( QObject * object, QEvent * event ) bool ret = true; - if( found <= listBlock.size() && hb_vmRequestReenter() ) + if( found <= listBlock.size() ) { - PHB_ITEM pEvent; - int eventId = s_lstEvent.indexOf( eventtype ); - if( eventId > -1 ) - pEvent = hbqt_create_objectFromEventType2( event, s_lstCreateObj.at( eventId ) ); - else - pEvent = hbqt_create_objectFromEventType( event, ( int ) eventtype ); + if( eventId > -1 && hb_vmRequestReenter() ) + { + PHB_ITEM pEvent = hbqt_create_object( event, s_lstCreateObj.at( eventId ) ); - ret = hb_itemGetL( hb_vmEvalBlockV( ( PHB_ITEM ) listBlock.at( found - 1 ), 1, pEvent ) ); - hb_itemRelease( pEvent ); - hb_vmRequestRestore(); + ret = hb_itemGetL( hb_vmEvalBlockV( ( PHB_ITEM ) listBlock.at( found - 1 ), 1, pEvent ) ); + hb_itemRelease( pEvent ); + hb_vmRequestRestore(); - if( eventtype == QEvent::Close ) - event->ignore(); + if( eventtype == QEvent::Close ) + event->ignore(); + } } return ret; } diff --git a/harbour/contrib/hbqt/qtcore/hbqt_init.cpp b/harbour/contrib/hbqt/qtcore/hbqt_init.cpp index db2e29c693..f13fe0b25f 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_init.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_init.cpp @@ -209,7 +209,7 @@ static void hbqt_SlotsExecModel( PHB_ITEM * codeBlock, void ** arguments, QStrin hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QModelIndex" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), true ), "QModelIndex" ) ); hb_vmSend( 1 ); } @@ -219,8 +219,8 @@ static void hbqt_SlotsExecModelModel( PHB_ITEM * codeBlock, void ** arguments, Q hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QModelIndex" ) ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QModelIndex" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), true ), "QModelIndex" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), true ), "QModelIndex" ) ); hb_vmSend( 2 ); } @@ -230,7 +230,7 @@ static void hbqt_SlotsExecStringList( PHB_ITEM * codeBlock, void ** arguments, Q hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QStringList( new QStringList( ( *reinterpret_cast< QStringList( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QStringList" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QStringList( new QStringList( ( *reinterpret_cast< QStringList( * ) >( arguments[ 1 ] ) ) ), true ), "QStringList" ) ); hb_vmSend( 1 ); } @@ -240,7 +240,7 @@ static void hbqt_SlotsExecQPoint( PHB_ITEM * codeBlock, void ** arguments, QStri hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QPoint( new QPoint( ( *reinterpret_cast< QPoint( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QPoint" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QPoint( new QPoint( ( *reinterpret_cast< QPoint( * ) >( arguments[ 1 ] ) ) ), true ), "QPoint" ) ); hb_vmSend( 1 ); } @@ -250,7 +250,7 @@ static void hbqt_SlotsExecQUrl( PHB_ITEM * codeBlock, void ** arguments, QString hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QUrl( new QUrl( ( *reinterpret_cast< QUrl( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QUrl" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QUrl( new QUrl( ( *reinterpret_cast< QUrl( * ) >( arguments[ 1 ] ) ) ), true ), "QUrl" ) ); hb_vmSend( 1 ); } @@ -260,7 +260,7 @@ static void hbqt_SlotsExecQDate( PHB_ITEM * codeBlock, void ** arguments, QStrin hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QDate( new QDate( ( *reinterpret_cast< QDate( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QDate" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QDate( new QDate( ( *reinterpret_cast< QDate( * ) >( arguments[ 1 ] ) ) ), true ), "QDate" ) ); hb_vmSend( 1 ); } @@ -270,7 +270,7 @@ static void hbqt_SlotsExecQDateTime( PHB_ITEM * codeBlock, void ** arguments, QS hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QDateTime( new QDateTime( ( *reinterpret_cast< QDateTime( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QDateTime" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QDateTime( new QDateTime( ( *reinterpret_cast< QDateTime( * ) >( arguments[ 1 ] ) ) ), true ), "QDateTime" ) ); hb_vmSend( 1 ); } @@ -280,7 +280,7 @@ static void hbqt_SlotsExecQTime( PHB_ITEM * codeBlock, void ** arguments, QStrin hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QTime( new QTime( ( *reinterpret_cast< QTime( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QTime" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QTime( new QTime( ( *reinterpret_cast< QTime( * ) >( arguments[ 1 ] ) ) ), true ), "QTime" ) ); hb_vmSend( 1 ); } @@ -290,7 +290,7 @@ static void hbqt_SlotsExecQRectF( PHB_ITEM * codeBlock, void ** arguments, QStri hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QRectF( new QRectF( ( *reinterpret_cast< QRectF( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QRectF" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QRectF( new QRectF( ( *reinterpret_cast< QRectF( * ) >( arguments[ 1 ] ) ) ), true ), "QRectF" ) ); hb_vmSend( 1 ); } @@ -300,7 +300,7 @@ static void hbqt_SlotsExecQRectInt( PHB_ITEM * codeBlock, void ** arguments, QSt hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QRect( new QRect( ( *reinterpret_cast< QRect( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QRect" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QRect( new QRect( ( *reinterpret_cast< QRect( * ) >( arguments[ 1 ] ) ) ), true ), "QRect" ) ); hb_vmPushInteger( *reinterpret_cast< int( * ) >( arguments[ 2 ] ) ); hb_vmSend( 2 ); } @@ -311,7 +311,7 @@ static void hbqt_SlotsExecQRect( PHB_ITEM * codeBlock, void ** arguments, QStrin hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QRect( new QRect( ( *reinterpret_cast< QRect( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QRect" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QRect( new QRect( ( *reinterpret_cast< QRect( * ) >( arguments[ 1 ] ) ) ), true ), "QRect" ) ); hb_vmSend( 1 ); } @@ -321,7 +321,7 @@ static void hbqt_SlotsExecQSizeF( PHB_ITEM * codeBlock, void ** arguments, QStri hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QSizeF( new QSizeF( ( *reinterpret_cast< QSizeF( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QSizeF" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QSizeF( new QSizeF( ( *reinterpret_cast< QSizeF( * ) >( arguments[ 1 ] ) ) ), true ), "QSizeF" ) ); hb_vmSend( 1 ); } @@ -331,7 +331,7 @@ static void hbqt_SlotsExecModelIndexIntInt( PHB_ITEM * codeBlock, void ** argume hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QModelIndex" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), true ), "QModelIndex" ) ); hb_vmPushInteger( *reinterpret_cast< int( * ) >( arguments[ 2 ] ) ); hb_vmPushInteger( *reinterpret_cast< int( * ) >( arguments[ 3 ] ) ); hb_vmSend( 3 ); @@ -343,8 +343,11 @@ static void hbqt_SlotsExecModelIndexList( PHB_ITEM * codeBlock, void ** argument hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - /* TOBE: QModelIndexList.qth */ - hb_vmPushPointer( new QModelIndexList( ( *reinterpret_cast< QModelIndexList( * ) >( arguments[ 1 ] ) ) ) ); /* TOFIX: Pass .prg level object to callback */ +#if 0 + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndexList( new QModelIndexList( ( *reinterpret_cast< QModelIndexList( * ) >( arguments[ 1 ] ) ) ), true ), "QModelIndexList" ) ); +#else + hb_vmPushNil(); +#endif hb_vmSend( 1 ); } diff --git a/harbour/contrib/hbqt/qtcore/hbqt_misc.prg b/harbour/contrib/hbqt/qtcore/hbqt_misc.prg index 497358cb53..e7e8ac3329 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_misc.prg +++ b/harbour/contrib/hbqt/qtcore/hbqt_misc.prg @@ -206,297 +206,3 @@ METHOD HbQtObjectHandler:disconnect( cnEvent ) RETURN .F. /*----------------------------------------------------------------------*/ - -FUNCTION hbqt_createQtObject( cObjectList, nIndex, pPtr ) - LOCAL cObject, qObj, aObjs - - IF nIndex > 0 - aObjs := hb_ATokens( cObjectList, "$" ) - IF nIndex <= Len( aObjs ) - cObject := aObjs[ nIndex ] - ENDIF - ELSE - cObject := cObjectList - ENDIF - - IF ! Empty( cObject ) - /* TODO: Change macro expansion to more efficient solution */ - qObj := Eval( hb_MacroBlock( "HB_" + StrTran( cObject, "*" ) + "()" ) ) - qObj:pPtr := pPtr - ENDIF - - RETURN qObj - -/*----------------------------------------------------------------------*/ - -/* TOFIX: QTCORE should _NEVER_ refer to any names or parts of higher level - QT components (f.e. QTGUI). */ -#define QEvent_None 0 -#define QEvent_Timer 1 -#define QEvent_MouseButtonPress 2 -#define QEvent_MouseButtonRelease 3 -#define QEvent_MouseButtonDblClick 4 -#define QEvent_MouseMove 5 -#define QEvent_KeyPress 6 -#define QEvent_KeyRelease 7 -#define QEvent_FocusIn 8 -#define QEvent_FocusOut 9 -#define QEvent_Enter 10 -#define QEvent_Leave 11 -#define QEvent_Paint 12 -#define QEvent_Move 13 -#define QEvent_Resize 14 -#define QEvent_Show 17 -#define QEvent_Hide 18 -#define QEvent_Close 19 -#define QEvent_ParentChange 21 -#define QEvent_WindowActivate 24 -#define QEvent_WindowDeactivate 25 -#define QEvent_ShowToParent 26 -#define QEvent_HideToParent 27 -#define QEvent_Wheel 31 -#define QEvent_WindowTitleChange 33 -#define QEvent_WindowIconChange 34 -#define QEvent_ApplicationWindowIconChange 35 -#define QEvent_ApplicationFontChange 36 -#define QEvent_ApplicationLayoutDirectionChange 37 -#define QEvent_ApplicationPaletteChange 38 -#define QEvent_PaletteChange 39 -#define QEvent_Clipboard 40 -#define QEvent_MetaCall 43 -#define QEvent_SockAct 50 -#define QEvent_ShortcutOverride 51 -#define QEvent_DeferredDelete 52 -#define QEvent_DragEnter 60 -#define QEvent_DragLeave 62 -#define QEvent_DragMove 61 -#define QEvent_Drop 63 -#define QEvent_ChildAdded 68 -#define QEvent_ChildPolished 69 -#define QEvent_ChildInserted 70 -#define QEvent_ChildRemoved 71 -#define QEvent_PolishRequest 74 -#define QEvent_Polish 75 -#define QEvent_LayoutRequest 76 -#define QEvent_UpdateRequest 77 -#define QEvent_UpdateLater 78 -#define QEvent_ContextMenu 82 -#define QEvent_InputMethod 83 -#define QEvent_AccessibilityPrepare 86 -#define QEvent_TabletMove 87 -#define QEvent_LocaleChange 88 -#define QEvent_LanguageChange 89 -#define QEvent_LayoutDirectionChange 90 -#define QEvent_TabletPress 92 -#define QEvent_TabletRelease 93 -#define QEvent_OkRequest 94 -#define QEvent_IconDrag 96 -#define QEvent_FontChange 97 -#define QEvent_EnabledChange 98 -#define QEvent_ActivationChange 99 -#define QEvent_StyleChange 100 -#define QEvent_IconTextChange 101 -#define QEvent_ModifiedChange 102 -#define QEvent_WindowBlocked 103 -#define QEvent_WindowUnblocked 104 -#define QEvent_WindowStateChange 105 -#define QEvent_MouseTrackingChange 109 -#define QEvent_ToolTip 110 -#define QEvent_WhatsThis 111 -#define QEvent_StatusTip 112 -#define QEvent_ActionChanged 113 -#define QEvent_ActionAdded 114 -#define QEvent_ActionRemoved 115 -#define QEvent_FileOpen 116 -#define QEvent_Shortcut 117 -#define QEvent_WhatsThisClicked 118 -#define QEvent_AccessibilityHelp 119 -#define QEvent_ToolBarChange 120 -#define QEvent_ApplicationActivate 121 -#define QEvent_ApplicationActivated 121 -#define QEvent_ApplicationDeactivate 122 -#define QEvent_QueryWhatsThis 123 -#define QEvent_EnterWhatsThisMode 124 -#define QEvent_LeaveWhatsThisMode 125 -#define QEvent_ZOrderChange 126 -#define QEvent_HoverEnter 127 -#define QEvent_HoverLeave 128 -#define QEvent_HoverMove 129 -#define QEvent_AccessibilityDescription 130 -#define QEvent_ParentAboutToChange 131 -#define QEvent_WinEventAct 132 -#define QEvent_EnterEditFocus 150 -#define QEvent_LeaveEditFocus 151 -#define QEvent_MenubarUpdated 153 -#define QEvent_GraphicsSceneMouseMove 155 -#define QEvent_GraphicsSceneMousePress 156 -#define QEvent_GraphicsSceneMouseRelease 157 -#define QEvent_GraphicsSceneMouseDoubleClick 158 -#define QEvent_GraphicsSceneContextMenu 159 -#define QEvent_GraphicsSceneHoverEnter 160 -#define QEvent_GraphicsSceneHoverMove 161 -#define QEvent_GraphicsSceneHoverLeave 162 -#define QEvent_GraphicsSceneHelp 163 -#define QEvent_GraphicsSceneDragEnter 164 -#define QEvent_GraphicsSceneDragMove 165 -#define QEvent_GraphicsSceneDragLeave 166 -#define QEvent_GraphicsSceneDrop 167 -#define QEvent_GraphicsSceneWheel 168 -#define QEvent_KeyboardLayoutChange 169 -#define QEvent_DynamicPropertyChange 170 -#define QEvent_TabletEnterProximity 171 -#define QEvent_TabletLeaveProximity 172 -#define QEvent_NonClientAreaMouseMove 173 -#define QEvent_NonClientAreaMouseButtonPress 174 -#define QEvent_NonClientAreaMouseButtonRelease 175 -#define QEvent_NonClientAreaMouseButtonDblClick 176 -#define QEvent_MacSizeChange 177 -#define QEvent_ContentsRectChange 178 -#define QEvent_GraphicsSceneResize 181 -#define QEvent_GraphicsSceneMove 182 -#define QEvent_CursorChange 183 -#define QEvent_ToolTipChange 184 -#define QEvent_GrabMouse 186 -#define QEvent_UngrabMouse 187 -#define QEvent_GrabKeyboard 188 -#define QEvent_UngrabKeyboard 189 - -FUNCTION hbqtgui_createQtObjectByType( nType, pPtr ) - STATIC s_b_ := { ; - QEvent_Timer => "QEvent" ,; - QEvent_MouseButtonPress => "QMouseEvent" ,; - QEvent_MouseButtonRelease => "QMouseEvent" ,; - QEvent_MouseButtonDblClick => "QMouseEvent" ,; - QEvent_MouseMove => "QMouseEvent" ,; - QEvent_KeyPress => "QKeyEvent" ,; - QEvent_KeyRelease => "QKeyEvent" ,; - QEvent_FocusIn => "QFocusEvent" ,; - QEvent_FocusOut => "QFocusEvent" ,; - QEvent_Enter => "QMouseEvent" ,; - QEvent_Leave => "QMouseEvent" ,; - QEvent_Paint => "QPaintEvent" ,; - QEvent_Move => "QMoveEvent" ,; - QEvent_Resize => "QResizeEvent",; - QEvent_Show => "QShowEvent" ,; - QEvent_Hide => "QHideEvent" ,; - QEvent_Close => "QEvent" ,; - QEvent_ParentChange => "QEvent" ,; - QEvent_WindowActivate => "QEvent" ,; - QEvent_WindowDeactivate => "QEvent" ,; - QEvent_ShowToParent => "QEvent" ,; - QEvent_HideToParent => "QEvent" ,; - QEvent_Wheel => "QWheelEvent" ,; - QEvent_WindowTitleChange => "QEvent" ,; - QEvent_WindowIconChange => "QEvent" ,; - QEvent_ApplicationWindowIconChange => "QEvent" ,; - QEvent_ApplicationFontChange => "QEvent" ,; - QEvent_ApplicationLayoutDirectionChange => "QEvent" ,; - QEvent_ApplicationPaletteChange => "QEvent" ,; - QEvent_PaletteChange => "QEvent" ,; - QEvent_Clipboard => "QEvent" ,; - QEvent_MetaCall => "QEvent" ,; - QEvent_SockAct => "QEvent" ,; - QEvent_ShortcutOverride => "QKeyEvent" ,; - QEvent_DeferredDelete => "QEvent" ,; - QEvent_DragEnter => "QDragEnterEvent" ,; - QEvent_DragLeave => "QDragLeaveEvent" ,; - QEvent_DragMove => "QDragMoveEvent" ,; - QEvent_Drop => "QDropEvent" ,; - QEvent_ChildAdded => "QEvent" ,; - QEvent_ChildPolished => "QEvent" ,; - QEvent_ChildInserted => "QEvent" ,; - QEvent_ChildRemoved => "QEvent" ,; - QEvent_PolishRequest => "QEvent" ,; - QEvent_Polish => "QEvent" ,; - QEvent_LayoutRequest => "QEvent" ,; - QEvent_UpdateRequest => "QEvent" ,; - QEvent_UpdateLater => "QEvent" ,; - QEvent_ContextMenu => "QContextMenuEvent" ,; - QEvent_InputMethod => "QInputMethodEvent" ,; - QEvent_AccessibilityPrepare => "QEvent" ,; - QEvent_TabletMove => "QEvent" ,; - QEvent_LocaleChange => "QEvent" ,; - QEvent_LanguageChange => "QEvent" ,; - QEvent_LayoutDirectionChange => "QEvent" ,; - QEvent_TabletPress => "QEvent" ,; - QEvent_TabletRelease => "QEvent" ,; - QEvent_OkRequest => "QEvent" ,; - QEvent_IconDrag => "QEvent" ,; - QEvent_FontChange => "QEvent" ,; - QEvent_EnabledChange => "QEvent" ,; - QEvent_ActivationChange => "QEvent" ,; - QEvent_StyleChange => "QEvent" ,; - QEvent_IconTextChange => "QEvent" ,; - QEvent_ModifiedChange => "QEvent" ,; - QEvent_WindowBlocked => "QEvent" ,; - QEvent_WindowUnblocked => "QEvent" ,; - QEvent_WindowStateChange => "QWindowStateChangeEvent" ,; - QEvent_MouseTrackingChange => "QEvent" ,; - QEvent_ToolTip => "QHelpEvent" ,; - QEvent_WhatsThis => "QHelpEvent" ,; - QEvent_StatusTip => "QEvent" ,; - QEvent_ActionChanged => "QEvent" ,; - QEvent_ActionAdded => "QEvent" ,; - QEvent_ActionRemoved => "QEvent" ,; - QEvent_FileOpen => "QEvent" ,; - QEvent_Shortcut => "QEvent" ,; - QEvent_WhatsThisClicked => "QEvent" ,; - QEvent_AccessibilityHelp => "QEvent" ,; - QEvent_ToolBarChange => "QEvent" ,; - QEvent_ApplicationActivate => "QEvent" ,; - QEvent_ApplicationActivated => "QEvent" ,; - QEvent_ApplicationDeactivate => "QEvent" ,; - QEvent_QueryWhatsThis => "QEvent" ,; - QEvent_EnterWhatsThisMode => "QEvent" ,; - QEvent_LeaveWhatsThisMode => "QEvent" ,; - QEvent_ZOrderChange => "QEvent" ,; - QEvent_HoverEnter => "QEvent" ,; - QEvent_HoverLeave => "QEvent" ,; - QEvent_HoverMove => "QEvent" ,; - QEvent_AccessibilityDescription => "QEvent" ,; - QEvent_ParentAboutToChange => "QEvent" ,; - QEvent_WinEventAct => "QEvent" ,; - QEvent_EnterEditFocus => "QEvent" ,; - QEvent_LeaveEditFocus => "QEvent" ,; - QEvent_MenubarUpdated => "QEvent" ,; - QEvent_GraphicsSceneMouseMove => "QGraphicsSceneMouseEvent" ,; - QEvent_GraphicsSceneMousePress => "QGraphicsSceneMouseEvent" ,; - QEvent_GraphicsSceneMouseRelease => "QGraphicsSceneMouseEvent" ,; - QEvent_GraphicsSceneMouseDoubleClick => "QGraphicsSceneMouseEvent" ,; - QEvent_GraphicsSceneContextMenu => "QGraphicsSceneContextMenuEvent" ,; - QEvent_GraphicsSceneHoverEnter => "QGraphicsSceneHoverEvent" ,; - QEvent_GraphicsSceneHoverMove => "QGraphicsSceneHoverEvent" ,; - QEvent_GraphicsSceneHoverLeave => "QGraphicsSceneHoverEvent" ,; - QEvent_GraphicsSceneHelp => "QHelpEvent" ,; - QEvent_GraphicsSceneDragEnter => "QGraphicsSceneDragDropEvent" ,; - QEvent_GraphicsSceneDragMove => "QGraphicsSceneDragDropEvent" ,; - QEvent_GraphicsSceneDragLeave => "QGraphicsSceneDragDropEvent" ,; - QEvent_GraphicsSceneDrop => "QGraphicsSceneDragDropEvent" ,; - QEvent_GraphicsSceneWheel => "QGraphicsSceneWheelEvent" ,; - QEvent_KeyboardLayoutChange => "QEvent" ,; - QEvent_DynamicPropertyChange => "QEvent" ,; - QEvent_TabletEnterProximity => "QEvent" ,; - QEvent_TabletLeaveProximity => "QEvent" ,; - QEvent_NonClientAreaMouseMove => "QEvent" ,; - QEvent_NonClientAreaMouseButtonPress => "QEvent" ,; - QEvent_NonClientAreaMouseButtonRelease => "QEvent" ,; - QEvent_NonClientAreaMouseButtonDblClick => "QEvent" ,; - QEvent_MacSizeChange => "QEvent" ,; - QEvent_ContentsRectChange => "QEvent" ,; - QEvent_GraphicsSceneResize => "QGraphicsSceneResizeEvent" ,; - QEvent_GraphicsSceneMove => "QGraphicsSceneMoveEvent" ,; - QEvent_CursorChange => "QEvent" ,; - QEvent_ToolTipChange => "QEvent" ,; - QEvent_GrabMouse => "QEvent" ,; - QEvent_UngrabMouse => "QEvent" ,; - QEvent_GrabKeyboard => "QEvent" ,; - QEvent_UngrabKeyboard => "QEvent" } - - /* TODO: Change macro expansion to more efficient solution */ - LOCAL qObj := Eval( hb_MacroBlock( "HB_" + iif( hb_HHasKey( s_b_, nType ), s_b_[ nType ], "QEvent" ) + "()" ) ) - - qObj:pPtr := pPtr - - RETURN qObj - -/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp b/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp index dfbcb6643d..a57173d5a7 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp @@ -432,53 +432,24 @@ void * hbqt_getqtptr( void ) return NULL; } -PHB_ITEM hbqt_create_object( void * p, const char * objectName ) +PHB_ITEM hbqt_create_object( void * pObject, const char * pszObjectName ) { - PHB_ITEM pItem = hb_itemPutPtr( NULL, p ); + PHB_ITEM pRetVal; + PHB_ITEM pItem = hb_itemPutPtr( NULL, pObject ); - hb_vmPushDynSym( hb_dynsymGet( objectName ) ); + hb_vmPushDynSym( hb_dynsymGet( pszObjectName ) ); hb_vmPushNil(); hb_vmDo( 0 ); - hb_objSendMsg( hb_stackReturnItem(), "_PPTR", 1, pItem ); + pRetVal = hb_itemNew( hb_stackReturnItem() ) ; + hb_objSendMsg( pRetVal, "_PPTR", 1, pItem ); + hb_itemReturn( pRetVal ); hb_itemRelease( pItem ); return hb_stackReturnItem(); } -PHB_ITEM hbqt_create_objectFromEventType( void * pEvent, int type ) -{ - static PHB_DYNS s_createObject = NULL; - - if( s_createObject == NULL ) - s_createObject = hb_dynsymGetCase( "HBQTGUI_CREATEQTOBJECTBYTYPE" ); - - hb_vmPushDynSym( s_createObject ); - hb_vmPushNil(); - hb_vmPushInteger( type ); - //hb_vmPushPointerGC( hbqt_gcAllocate_QObject( pEvent, false ) ); - hb_vmPushPointer( pEvent ); - hb_vmDo( 2 ); - - return hb_stackReturnItem(); -} - -PHB_ITEM hbqt_create_objectFromEventType2( void * pEvent, const char * pszName ) -{ - PHB_ITEM pItemEvent = hb_itemPutPtr( NULL, pEvent ); - - hb_vmPushDynSym( hb_dynsymGet( pszName ) ); - hb_vmPushNil(); - hb_vmDo( 0 ); - - hb_objSendMsg( hb_stackReturnItem(), "_PPTR", 1, pItemEvent ); - - hb_itemRelease( pItemEvent ); - - return hb_stackReturnItem(); -} - /*----------------------------------------------------------------------*/ #endif // #if QT_VERSION >= 0x040500 diff --git a/harbour/contrib/hbqt/qtcore/hbqtcore.hbx b/harbour/contrib/hbqt/qtcore/hbqtcore.hbx index 2db9955ad7..7596ce6d89 100644 --- a/harbour/contrib/hbqt/qtcore/hbqtcore.hbx +++ b/harbour/contrib/hbqt/qtcore/hbqtcore.hbx @@ -33,9 +33,7 @@ DYNAMIC HBQSLOTS DYNAMIC HBQSLOTSFROMPOINTER DYNAMIC HBQSTRING DYNAMIC HBQSTRINGFROMPOINTER -DYNAMIC HBQTGUI_CREATEQTOBJECTBYTYPE DYNAMIC HBQTOBJECTHANDLER -DYNAMIC HBQT_CREATEQTOBJECT DYNAMIC HBQT_FINDCHILD DYNAMIC HBQT_ISEQUALGCQTPOINTER DYNAMIC HBQT_ISOBJECT diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp index b8c745add4..ada386ecc8 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp @@ -487,7 +487,7 @@ void HBQGraphicsItem::contextMenuEvent( QGraphicsSceneContextMenuEvent * event ) { if( block ){ PHB_ITEM p1 = hb_itemPutNI( NULL, QEvent::GraphicsSceneContextMenu ); - PHB_ITEM p2 = hbqt_create_objectFromEventType2( event, "hb_QGraphicsSceneContextMenuEvent" ); + PHB_ITEM p2 = hbqt_create_object( event, "hb_QGraphicsSceneContextMenuEvent" ); PHB_ITEM p3 = hb_itemPutC( NULL, objectName().toLatin1().data() ); hb_vmEvalBlockV( block, 3, p1, p2, p3 ); hb_itemRelease( p1 ); diff --git a/harbour/contrib/hbqt/qtgui/hbqt_init.cpp b/harbour/contrib/hbqt/qtgui/hbqt_init.cpp index ba263d4d68..86d76b41be 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_init.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_init.cpp @@ -90,7 +90,7 @@ static void hbqt_SlotsExecQColor( PHB_ITEM * codeBlock, void ** arguments, QStri hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QColor( new QColor( ( *reinterpret_cast< QColor( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QColor" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QColor( new QColor( ( *reinterpret_cast< QColor( * ) >( arguments[ 1 ] ) ) ), true ), "QColor" ) ); hb_vmSend( 1 ); } @@ -100,8 +100,8 @@ static void hbqt_SlotsExecItemSelItemSel( PHB_ITEM * codeBlock, void ** argument hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QItemSelection( new QItemSelection( ( *reinterpret_cast< QItemSelection( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QItemSelection" ) ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QItemSelection( new QItemSelection( ( *reinterpret_cast< QItemSelection( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QItemSelection" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QItemSelection( new QItemSelection( ( *reinterpret_cast< QItemSelection( * ) >( arguments[ 1 ] ) ) ), true ), "QItemSelection" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QItemSelection( new QItemSelection( ( *reinterpret_cast< QItemSelection( * ) >( arguments[ 1 ] ) ) ), true ), "QItemSelection" ) ); hb_vmSend( 2 ); } @@ -111,7 +111,7 @@ static void hbqt_SlotsExecQTextCharFormat( PHB_ITEM * codeBlock, void ** argumen hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( ( *reinterpret_cast< QTextCharFormat( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QTextCharFormat" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( ( *reinterpret_cast< QTextCharFormat( * ) >( arguments[ 1 ] ) ) ), true ), "QTextCharFormat" ) ); hb_vmSend( 1 ); } @@ -121,7 +121,7 @@ static void hbqt_SlotsExecQFont( PHB_ITEM * codeBlock, void ** arguments, QStrin hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QFont( new QFont( ( *reinterpret_cast< QFont( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QFont" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QFont( new QFont( ( *reinterpret_cast< QFont( * ) >( arguments[ 1 ] ) ) ), true ), "QFont" ) ); hb_vmSend( 1 ); } @@ -131,7 +131,7 @@ static void hbqt_SlotsExecQTextCursor( PHB_ITEM * codeBlock, void ** arguments, hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QTextCursor( new QTextCursor( ( *reinterpret_cast< QTextCursor( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QTextCursor" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QTextCursor( new QTextCursor( ( *reinterpret_cast< QTextCursor( * ) >( arguments[ 1 ] ) ) ), true ), "QTextCursor" ) ); hb_vmSend( 1 ); } @@ -141,7 +141,7 @@ static void hbqt_SlotsExecQTextBlock( PHB_ITEM * codeBlock, void ** arguments, Q hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QTextBlock( new QTextBlock( ( *reinterpret_cast< QTextBlock( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QTextBlock" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QTextBlock( new QTextBlock( ( *reinterpret_cast< QTextBlock( * ) >( arguments[ 1 ] ) ) ), true ), "QTextBlock" ) ); hb_vmSend( 1 ); } diff --git a/harbour/contrib/hbqt/qtnetwork/hbqt_init.cpp b/harbour/contrib/hbqt/qtnetwork/hbqt_init.cpp index ba88d78f7d..eb52b58042 100644 --- a/harbour/contrib/hbqt/qtnetwork/hbqt_init.cpp +++ b/harbour/contrib/hbqt/qtnetwork/hbqt_init.cpp @@ -78,44 +78,48 @@ HB_EXTERN_END /*----------------------------------------------------------------------*/ -static void hbqt_SlotsExecQHttpResponseHeader( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecQHttpResponseHeader( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QHttpResponseHeader( new QHttpResponseHeader( ( *reinterpret_cast< QHttpResponseHeader( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QHttpResponseHeader", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QHttpResponseHeader( new QHttpResponseHeader( ( *reinterpret_cast< QHttpResponseHeader( * ) >( arguments[ 1 ] ) ) ), true ), "QHttpResponseHeader" ) ); hb_vmSend( 1 ); } -static void hbqt_SlotsExecQNetworkProxyPointer( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecQNetworkProxyPointer( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPushPointer( new QNetworkProxy( ( *reinterpret_cast< QNetworkProxy( * )>( arguments[ 1 ] ) ) ) ); /* TOFIX: Pass .prg level object to callback */ - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QObject( ( *reinterpret_cast< void*( * ) >( arguments[ 1 ] ) ), false ), ( const char * ) pList.data(), 2 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QObject( ( *reinterpret_cast< void*( * ) >( arguments[ 1 ] ) ), false ), ( const char * ) pList.at( 0 ).data() ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QObject( ( *reinterpret_cast< void*( * ) >( arguments[ 2 ] ) ), false ), ( const char * ) pList.at( 1 ).data() ) ); hb_vmSend( 2 ); } -static void hbqt_SlotsExecQNetworkRequest( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecQNetworkRequest( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QNetworkRequest( new QNetworkRequest( ( *reinterpret_cast< QNetworkRequest( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QNetworkRequest", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QNetworkRequest( new QNetworkRequest( ( *reinterpret_cast< QNetworkRequest( * ) >( arguments[ 1 ] ) ) ), true ), "QNetworkRequest" ) ); hb_vmSend( 1 ); } -static void hbqt_SlotsExecQUrlInfo( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecQUrlInfo( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPushPointer( new QUrlInfo( ( *reinterpret_cast< QUrlInfo( * )>( arguments[ 1 ] ) ) ) ); /* TOFIX: Pass .prg level object to callback */ +#if 0 + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QUrlInfo( new QUrlInfo( ( *reinterpret_cast< QUrlInfo( * ) >( arguments[ 1 ] ) ) ), true ), "QUrlInfo" ) ); +#else + hb_vmPushNil(); +#endif hb_vmSend( 1 ); } @@ -158,4 +162,3 @@ HB_CALL_ON_STARTUP_END( _hbqtnetwork_init_ ) #endif #endif -