From 4b997ce4e429168bc91e9e287d7eb0420cf8201f Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Mon, 18 Jun 2012 07:46:39 +0000 Subject: [PATCH] 2012-06-18 00:42 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtcore/hbqt_bind.cpp * contrib/hbqt/qtcore/hbqt_hbqevents.cpp * contrib/hbqt/qtcore/hbqt_hbqslots.cpp * contrib/hbqt/qtcore/hbqt_init.cpp * contrib/hbqt/qtcore/hbqt_misc.prg * contrib/hbqt/qtcore/qth/filelist.hbm - contrib/hbqt/qtcore/qth/HBQEvents.qth + Implemented: __pEvents transferred from PRG to C++ level. --- harbour/ChangeLog | 12 ++- harbour/contrib/hbqt/qtcore/hbqt_bind.cpp | 79 +++++++++++++------ .../contrib/hbqt/qtcore/hbqt_hbqevents.cpp | 43 +++++++++- harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp | 62 +++++++++------ harbour/contrib/hbqt/qtcore/hbqt_init.cpp | 22 +++--- harbour/contrib/hbqt/qtcore/hbqt_misc.prg | 17 +--- harbour/contrib/hbqt/qtcore/qth/HBQEvents.qth | 57 ------------- harbour/contrib/hbqt/qtcore/qth/filelist.hbm | 1 - 8 files changed, 160 insertions(+), 133 deletions(-) delete mode 100644 harbour/contrib/hbqt/qtcore/qth/HBQEvents.qth diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 592a68a5dc..8c6eef99b4 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,16 @@ The license applies to all entries newer than 2009-04-28. */ +2012-06-18 00:42 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtcore/hbqt_bind.cpp + * contrib/hbqt/qtcore/hbqt_hbqevents.cpp + * contrib/hbqt/qtcore/hbqt_hbqslots.cpp + * contrib/hbqt/qtcore/hbqt_init.cpp + * contrib/hbqt/qtcore/hbqt_misc.prg + * contrib/hbqt/qtcore/qth/filelist.hbm + - contrib/hbqt/qtcore/qth/HBQEvents.qth + + Implemented: __pEvents transferred from PRG to C++ level. + 2012-06-18 02:53 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/hbtip/encqp.prg * contrib/hbtip/mail.prg @@ -52,7 +62,7 @@ * contrib/hbqt/qtcore/qth/filelist.hbm - Removed: HBQSlots.qth - ; TODO: bring __pEvents to C++. + ; DONE: bring __pEvents to C++. 2012-06-17 16:08 UTC+0200 Viktor Szakats (harbour syenar.net) * contrib/hbamf/amfenc.c diff --git a/harbour/contrib/hbqt/qtcore/hbqt_bind.cpp b/harbour/contrib/hbqt/qtcore/hbqt_bind.cpp index b21dbc810e..fa7640edb1 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_bind.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_bind.cpp @@ -61,6 +61,7 @@ #include "hbqt.h" #include "hbqt_destroyer.h" #include "hbqt_hbqslots.h" +#include "hbqt_hbqevents.h" typedef struct _HBQT_BIND @@ -72,7 +73,9 @@ typedef struct _HBQT_BIND bool fDeleting; char szClassName[ HB_SYMBOL_NAME_LEN + 1 ]; HBQDestroyer * pDestroyer; - HBQSlots * pReceiverSlot; + HBQSlots * pReceiverSlots; + HBQEvents * pReceiverEvents; + bool fEventFilterInstalled; struct _HBQT_BIND * next; } HBQT_BIND, * PHBQT_BIND; @@ -196,12 +199,14 @@ PHB_ITEM hbqt_bindGetHbObject( PHB_ITEM pItem, void * qtObject, const char * szC { bind = ( PHBQT_BIND ) hb_xgrab( sizeof( HBQT_BIND ) ); memset( bind, 0, sizeof( HBQT_BIND ) ); - bind->qtObject = qtObject; - bind->pDelFunc = pDelFunc; - bind->iFlags = iFlags; - bind->fDeleting = false; - bind->pDestroyer = new HBQDestroyer(); - bind->pReceiverSlot = new HBQSlots(); + bind->qtObject = qtObject; + bind->pDelFunc = pDelFunc; + bind->iFlags = iFlags; + bind->fDeleting = false; + bind->pDestroyer = new HBQDestroyer(); + bind->pReceiverSlots = new HBQSlots(); + bind->pReceiverEvents = new HBQEvents(); + bind->fEventFilterInstalled = false; hb_strncpy( bind->szClassName, szClassName, HB_SIZEOFARRAY( bind->szClassName ) - 1 ); bind->next = hbqt_bindGetData()->s_hbqt_binds; hbqt_bindGetData()->s_hbqt_binds = bind; @@ -275,12 +280,14 @@ PHB_ITEM hbqt_bindSetHbObject( PHB_ITEM pItem, void * qtObject, const char * szC bind = ( PHBQT_BIND ) hb_xgrab( sizeof( HBQT_BIND ) ); memset( bind, 0, sizeof( HBQT_BIND ) ); - bind->qtObject = qtObject; - bind->pDelFunc = pDelFunc; - bind->iFlags = iFlags; - bind->fDeleting = false; - bind->pDestroyer = new HBQDestroyer(); - bind->pReceiverSlot = new HBQSlots(); + bind->qtObject = qtObject; + bind->pDelFunc = pDelFunc; + bind->iFlags = iFlags; + bind->fDeleting = false; + bind->pDestroyer = new HBQDestroyer(); + bind->pReceiverSlots = new HBQSlots(); + bind->pReceiverEvents = new HBQEvents(); + bind->fEventFilterInstalled = false; hb_strncpy( bind->szClassName, szClassName, HB_SIZEOFARRAY( bind->szClassName ) - 1 ); bind->next = hbqt_bindGetData()->s_hbqt_binds; hbqt_bindGetData()->s_hbqt_binds = bind; @@ -291,12 +298,9 @@ PHB_ITEM hbqt_bindSetHbObject( PHB_ITEM pItem, void * qtObject, const char * szC { if( pDelFunc != NULL ) QObject::connect( ( QObject * ) qtObject, SIGNAL( destroyed(QObject*) ), bind->pDestroyer, SLOT( destroyer() ) ); + HB_TRACE( HB_TR_DEBUG, ( "hbqt_bindSetHbObject( QObject %p )...%s", qtObject, ( ( QObject * ) qtObject )->metaObject()->className() ) ); } - else - { - HB_TRACE( HB_TR_DEBUG, ( "hbqt_bindSetHbObject( %p )", qtObject ) ); - } } } HBQT_BIND_UNLOCK @@ -305,7 +309,7 @@ PHB_ITEM hbqt_bindSetHbObject( PHB_ITEM pItem, void * qtObject, const char * szC return pObject; } -HBQSlots * hbqt_bindGetReceiverSlotByHbObject( PHB_ITEM pObject ) +HBQSlots * hbqt_bindGetReceiverSlotsByHbObject( PHB_ITEM pObject ) { HBQSlots * pReceiverSlot = NULL; if( pObject != NULL ) @@ -319,7 +323,7 @@ HBQSlots * hbqt_bindGetReceiverSlotByHbObject( PHB_ITEM pObject ) { if( bind->hbObject == hbObject ) { - pReceiverSlot = bind->pReceiverSlot; + pReceiverSlot = bind->pReceiverSlots; HB_TRACE( HB_TR_DEBUG, ( "hbqt_bindGetReceiverSlotByHbObject( %p )", bind->qtObject ) ); break; } @@ -330,6 +334,36 @@ HBQSlots * hbqt_bindGetReceiverSlotByHbObject( PHB_ITEM pObject ) return pReceiverSlot; } +HBQEvents * hbqt_bindGetReceiverEventsByHbObject( PHB_ITEM pObject ) +{ + HBQEvents * pReceiverEvents = NULL; + if( pObject != NULL ) + { + void * hbObject = hb_arrayId( pObject ); + PHBQT_BIND bind; + + HBQT_BIND_LOCK + bind = hbqt_bindGetData()->s_hbqt_binds; + while( bind ) + { + if( bind->hbObject == hbObject ) + { + pReceiverEvents = bind->pReceiverEvents; + if( ! bind->fEventFilterInstalled ) + { + bind->fEventFilterInstalled = true; + bind->pReceiverEvents->hbInstallEventFilter( pObject ); + } + HB_TRACE( HB_TR_DEBUG, ( "hbqt_bindGetReceiverEventsByHbObject( %p )", bind->qtObject ) ); + break; + } + bind = bind->next; + } + HBQT_BIND_UNLOCK + } + return pReceiverEvents; +} + PHB_ITEM hbqt_bindGetHbObjectByQtObject( void * qtObject ) { PHB_ITEM pObject = NULL; @@ -435,9 +469,8 @@ void hbqt_bindDestroyHbObject( PHB_ITEM pObject ) HB_TRACE( HB_TR_DEBUG, ( "..............HARBOUR_DESTROY_BEGINS( %p, %i ).............. %s", bind->qtObject, bind->iFlags, bind->szClassName ) ); * bind_ptr = bind->next; - delete bind->pDestroyer; - delete bind->pReceiverSlot; - + delete bind->pReceiverSlots; + delete bind->pReceiverEvents; if( fDelQtObject ) { if( bind->pDelFunc != NULL ) @@ -463,6 +496,8 @@ void hbqt_bindDestroyHbObject( PHB_ITEM pObject ) } } } + delete bind->pDestroyer; + hb_xfree( bind ); break; } diff --git a/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp b/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp index 40e3f16cad..65ecfb5a38 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp @@ -56,14 +56,16 @@ #include "hbqt.h" #include "hbapiitm.h" +#include "hbapierr.h" #include "hbvm.h" #if QT_VERSION >= 0x040500 #include "hbqt_hbqevents.h" -HB_FUNC_EXTERN( HB_QCLOSEEVENT ); +HBQEvents * hbqt_bindGetReceiverEventsByHbObject( PHB_ITEM pObject ); +HB_FUNC_EXTERN( HB_QCLOSEEVENT ); void _hb_force_link_HBQevents( void ) { HB_FUNC_EXEC( HB_QCLOSEEVENT ); @@ -192,6 +194,45 @@ bool HBQEvents::eventFilter( QObject * object, QEvent * event ) return stopTheEventChain; } +HB_FUNC( HBQT_CONNECTEVENT ) +{ + int ret = -1; + + if( hb_pcount() == 3 && hbqt_par_isDerivedFrom( 1, "QOBJECT" ) && HB_ISNUM( 2 ) && HB_ISBLOCK( 3 ) ) + { + HBQEvents * receiverEvents = hbqt_bindGetReceiverEventsByHbObject( hb_param( 1, HB_IT_OBJECT ) ); + if( receiverEvents ) + { + ret = receiverEvents->hbConnect( hb_param( 1, HB_IT_OBJECT ), hb_parni( 2 ), hb_param( 3, HB_IT_BLOCK ) ); + } + } + else + { + hb_errRT_BASE( EG_ARG, 9999, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); + } + hb_retni( ret ); +} + +HB_FUNC( HBQT_DISCONNECTEVENT ) +{ + HB_TRACE( HB_TR_DEBUG, ( "enters HBQT_DISCONNECT" ) ); + int ret = -1; + if( hb_pcount() == 2 && hbqt_par_isDerivedFrom( 1, "QOBJECT" ) && HB_ISNUM( 2 ) ) + { + HBQEvents * receiverEvents = hbqt_bindGetReceiverEventsByHbObject( hb_param( 1, HB_IT_OBJECT ) ); + if( receiverEvents ) + { + ret = receiverEvents->hbDisconnect( hb_param( 1, HB_IT_OBJECT ), hb_parni( 2 ) ); + } + } + else + { + hb_errRT_BASE( EG_ARG, 9999, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); + } + HB_TRACE( HB_TR_DEBUG, ( "exits HBQT_DISCONNECT" ) ); + hb_retni( ret ); +} + static void hbqt_events_init( void * cargo ) { HB_SYMBOL_UNUSED( cargo ); diff --git a/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp b/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp index 12f694d8a8..91e23c02c9 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp @@ -63,7 +63,7 @@ #include "hbqt_hbqslots.h" -HB_EXPORT HBQSlots * hbqt_bindGetReceiverSlotByHbObject( PHB_ITEM pObject ); +HB_EXPORT HBQSlots * hbqt_bindGetReceiverSlotsByHbObject( PHB_ITEM pObject ); static QList s_argCombinations; static QList s_pCallback; @@ -142,7 +142,7 @@ int HBQSlots::hbConnect( PHB_ITEM pObj, char * pszSignal, PHB_ITEM bBlock ) { nResult = 0; - HB_TRACE( HB_TR_DEBUG, ( "HBQSlots::hbConnect( %s ) signalId=%i, %p", pszSignal, signalId, object ) ); + HB_TRACE( HB_TR_DEBUG, ( "HBQSlots::hbConnect( %p, %s, %i )", object, pszSignal, signalId ) ); hbqt_bindAddSlot( pObj, signalId, bBlock ); } else @@ -249,7 +249,7 @@ int HBQSlots::qt_metacall( QMetaObject::Call c, int id, void ** arguments ) else { parList += arrayOfTypes.at( i ).trimmed() ; - pList += arrayOfTypes.at( i ).trimmed().toUpper(); + pList += "HB_" + arrayOfTypes.at( i ).trimmed().toUpper(); } } paramString = parList.join( "$" ).toAscii(); @@ -264,24 +264,35 @@ int HBQSlots::qt_metacall( QMetaObject::Call c, int id, void ** arguments ) if( hb_vmRequestReenter() ) { PHB_ITEM hbObject = hbqt_bindGetHbObjectByQtObject( object ); - PHB_ITEM p = hbqt_bindGetSlots( hbObject, id ); - hb_itemRelease( hbObject ); - if( p ) + if( hbObject ) { - if( parameterCount == 0 ) + PHB_ITEM p = hbqt_bindGetSlots( hbObject, id ); + hb_itemRelease( hbObject ); + if( p ) { - hb_evalBlock0( hb_arrayGetItemPtr( p, 1 ) ); - } - else - { - int paramId = s_argCombinations.indexOf( paramString ); - PHBQT_SLOT_FUNC pCallback = s_pCallback.at( paramId ); - if( pCallback ) + PHB_ITEM codeBlock = hb_arrayGetItemPtr( p, 1 ); + if( HB_IS_BLOCK( codeBlock ) ) { - pCallback( ( PHB_ITEM * ) hb_arrayGetItemPtr( p, 1 ), arguments, pList ); + if( parameterCount == 0 ) + { + HB_TRACE( HB_TR_DEBUG, ( "Firing Signal( %p )", object ) ); + hb_evalBlock0( codeBlock ); + HB_TRACE( HB_TR_DEBUG, ( "Fired ( %p )", object ) ); + } + else + { + int paramId = s_argCombinations.indexOf( paramString ); + PHBQT_SLOT_FUNC pCallback = s_pCallback.at( paramId ); + if( pCallback ) + { + HB_TRACE( HB_TR_DEBUG, ( "Firing Signal( %p, %s )", object, paramString.data() ) ); + pCallback( ( PHB_ITEM * ) codeBlock, arguments, pList ); + HB_TRACE( HB_TR_DEBUG, ( "Fired ( %p )", object ) ); + } + } } + hb_itemRelease( p ); } - hb_itemRelease( p ); } hb_vmRequestRestore(); } @@ -336,7 +347,7 @@ int hbqt_QtConnect( QObject *sender, const char * pszSignal, QObject *receiver, return nResult; } -int hbqt_QtDisconnect( QObject *sender, const char * pszSignal, QObject *receiver, const char * pszSlot ) +int hbqt_QtDisconnect( QObject * sender, const char * pszSignal, QObject * receiver, const char * pszSlot ) { HB_TRACE( HB_TR_DEBUG, ( "hbqt_QtDisconnect %s with slot %s", pszSignal, pszSlot ) ); @@ -360,7 +371,7 @@ int hbqt_QtDisconnect( QObject *sender, const char * pszSignal, QObject *receive if( QMetaObject::disconnect( sender, signalId, receiver, slotId ) ) { nResult = 0; - HB_TRACE( HB_TR_DEBUG, ( "SIGNAL2SLOT ok" ) ); + HB_TRACE( HB_TR_DEBUG, ( "hbqt_QtDisconnect_OK( %p, %s, %s )", sender, pszSignal, pszSlot ) ); } else nResult = 8; @@ -377,7 +388,6 @@ int hbqt_QtDisconnect( QObject *sender, const char * pszSignal, QObject *receive else nResult = 9; // Qt objects not active - HB_TRACE( HB_TR_DEBUG, ( "hbqt_QtDisconnect returns: %d", nResult ) ); return nResult; } @@ -399,11 +409,11 @@ HB_FUNC( HBQT_CONNECT ) } else if( hb_pcount() == 3 && HB_ISCHAR( 2 ) && HB_ISBLOCK( 3 ) && hbqt_par_isDerivedFrom( 1, "QOBJECT" ) ) { - HBQSlots * receiverSlot = hbqt_bindGetReceiverSlotByHbObject( hb_param( 1, HB_IT_OBJECT ) ); - if( receiverSlot ) + HBQSlots * receiverSlots = hbqt_bindGetReceiverSlotsByHbObject( hb_param( 1, HB_IT_OBJECT ) ); + if( receiverSlots ) { void * pText01 = NULL; - ret = receiverSlot->hbConnect( hb_param( 1, HB_IT_OBJECT ), ( char * ) hb_parstr_utf8( 2, &pText01, NULL ), hb_param( 3, HB_IT_ANY ) ); + ret = receiverSlots->hbConnect( hb_param( 1, HB_IT_OBJECT ), ( char * ) hb_parstr_utf8( 2, &pText01, NULL ), hb_param( 3, HB_IT_BLOCK ) ); hb_strfree( pText01 ); } } @@ -420,11 +430,11 @@ HB_FUNC( HBQT_DISCONNECT ) HB_TRACE( HB_TR_DEBUG, ( "enters HBQT_DISCONNECT" ) ); if( hb_pcount() == 2 && HB_ISCHAR( 2 ) && hbqt_par_isDerivedFrom( 1, "QOBJECT" ) ) { - void * pText01 = NULL; - HBQSlots * receiverSlot = hbqt_bindGetReceiverSlotByHbObject( hb_param( 1, HB_IT_OBJECT ) ); - if( receiverSlot ) + HBQSlots * receiverSlots = hbqt_bindGetReceiverSlotsByHbObject( hb_param( 1, HB_IT_OBJECT ) ); + if( receiverSlots ) { - ret = receiverSlot->hbDisconnect( hb_param( 1, HB_IT_OBJECT ), ( char * ) hb_parstr_utf8( 2, &pText01, NULL ) ); + void * pText01 = NULL; + ret = receiverSlots->hbDisconnect( hb_param( 1, HB_IT_OBJECT ), ( char * ) hb_parstr_utf8( 2, &pText01, NULL ) ); hb_strfree( pText01 ); } } diff --git a/harbour/contrib/hbqt/qtcore/hbqt_init.cpp b/harbour/contrib/hbqt/qtcore/hbqt_init.cpp index 3663a8f21e..8e41fbb212 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_init.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_init.cpp @@ -225,7 +225,7 @@ static void hbqt_SlotsExecModel( PHB_ITEM * codeBlock, void ** arguments, QStrin hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), "HB_QMODELINDEX", hbqt_del_QModelIndex, HBQT_BIT_OWNER ); + PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), "HB_QMODELINDEX", hbqt_del_QModelIndex, HBQT_BIT_OWNER ); hb_vmPush( p0 ); hb_vmSend( 1 ); hb_itemRelease( p0 ); @@ -237,8 +237,8 @@ static void hbqt_SlotsExecModelModel( PHB_ITEM * codeBlock, void ** arguments, Q hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), "HB_QMODELINDEX", hbqt_del_QModelIndex, HBQT_BIT_OWNER ); - PHB_ITEM p1 = hbqt_bindGetHbObject( NULL, new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), "HB_QMODELINDEX", hbqt_del_QModelIndex, HBQT_BIT_OWNER ); + PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), "HB_QMODELINDEX", hbqt_del_QModelIndex, HBQT_BIT_OWNER ); + PHB_ITEM p1 = hbqt_bindGetHbObject( NULL, new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), "HB_QMODELINDEX", hbqt_del_QModelIndex, HBQT_BIT_OWNER ); hb_vmPush( p0 ); hb_vmPush( p1 ); hb_vmSend( 2 ); @@ -276,7 +276,7 @@ static void hbqt_SlotsExecQUrl( PHB_ITEM * codeBlock, void ** arguments, QString hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QUrl( ( *reinterpret_cast< QUrl( * ) >( arguments[ 1 ] ) ) ), "HB_QURL", hbqt_del_QUrl, HBQT_BIT_OWNER ); + PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QUrl( ( *reinterpret_cast< QUrl( * ) >( arguments[ 1 ] ) ) ), "HB_QURL", hbqt_del_QUrl, HBQT_BIT_OWNER ); hb_vmPush( p0 ); hb_vmSend( 1 ); hb_itemRelease( p0 ); @@ -288,7 +288,7 @@ static void hbqt_SlotsExecQDate( PHB_ITEM * codeBlock, void ** arguments, QStrin hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QDate( ( *reinterpret_cast< QDate( * ) >( arguments[ 1 ] ) ) ), "HB_QDATE", hbqt_del_QDate, HBQT_BIT_OWNER ); + PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QDate( ( *reinterpret_cast< QDate( * ) >( arguments[ 1 ] ) ) ), "HB_QDATE", hbqt_del_QDate, HBQT_BIT_OWNER ); hb_vmPush( p0 ); hb_vmSend( 1 ); hb_itemRelease( p0 ); @@ -312,7 +312,7 @@ static void hbqt_SlotsExecQTime( PHB_ITEM * codeBlock, void ** arguments, QStrin hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QTime( ( *reinterpret_cast< QTime( * ) >( arguments[ 1 ] ) ) ), "HB_QTIME", hbqt_del_QTime, HBQT_BIT_OWNER ); + PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QTime( ( *reinterpret_cast< QTime( * ) >( arguments[ 1 ] ) ) ), "HB_QTIME", hbqt_del_QTime, HBQT_BIT_OWNER ); hb_vmPush( p0 ); hb_vmSend( 1 ); hb_itemRelease( p0 ); @@ -349,7 +349,7 @@ static void hbqt_SlotsExecQRect( PHB_ITEM * codeBlock, void ** arguments, QStrin hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QRect( ( *reinterpret_cast< QRect( * ) >( arguments[ 1 ] ) ) ), "HB_QRECT", hbqt_del_QRect, HBQT_BIT_OWNER ); + PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QRect( ( *reinterpret_cast< QRect( * ) >( arguments[ 1 ] ) ) ), "HB_QRECT", hbqt_del_QRect, HBQT_BIT_OWNER ); hb_vmPush( p0 ); hb_vmSend( 1 ); hb_itemRelease( p0 ); @@ -361,7 +361,7 @@ static void hbqt_SlotsExecQSizeF( PHB_ITEM * codeBlock, void ** arguments, QStri hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QSizeF( ( *reinterpret_cast< QSizeF( * ) >( arguments[ 1 ] ) ) ), "HB_QSIZEF", hbqt_del_QSizeF, HBQT_BIT_OWNER ); + PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QSizeF( ( *reinterpret_cast< QSizeF( * ) >( arguments[ 1 ] ) ) ), "HB_QSIZEF", hbqt_del_QSizeF, HBQT_BIT_OWNER ); hb_vmPush( p0 ); hb_vmSend( 1 ); hb_itemRelease( p0 ); @@ -373,7 +373,7 @@ static void hbqt_SlotsExecModelIndexIntInt( PHB_ITEM * codeBlock, void ** argume hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), "HB_QMODELINDEX", hbqt_del_QModelIndex, HBQT_BIT_OWNER ); + PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), "HB_QMODELINDEX", hbqt_del_QModelIndex, HBQT_BIT_OWNER ); hb_vmPush( p0 ); hb_vmPushInteger( *reinterpret_cast< int( * ) >( arguments[ 2 ] ) ); hb_vmPushInteger( *reinterpret_cast< int( * ) >( arguments[ 3 ] ) ); @@ -387,7 +387,7 @@ static void hbqt_SlotsExecModelIndexList( PHB_ITEM * codeBlock, void ** argument hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QList< QModelIndex *>( ( *reinterpret_cast< QList< QModelIndex *> *>( arguments[ 1 ] ) ) ), "HB_QMODELINDEXLIST", hbqt_del_QList, HBQT_BIT_OWNER ); + PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, new QList< QModelIndex *>( ( *reinterpret_cast< QList< QModelIndex *> *>( arguments[ 1 ] ) ) ), "HB_QMODELINDEXLIST", hbqt_del_QList, HBQT_BIT_OWNER ); hb_vmPush( p0 ); hb_vmSend( 1 ); hb_itemRelease( p0 ); @@ -399,7 +399,7 @@ static void hbqt_SlotsExecQObject( PHB_ITEM * codeBlock, void ** arguments, QStr hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, *reinterpret_cast< void*( * ) >( arguments[ 1 ] ) , "HB_QOBJECT", NULL, HBQT_BIT_QOBJECT ); + PHB_ITEM p0 = hbqt_bindGetHbObject( NULL, *reinterpret_cast< void*( * ) >( arguments[ 1 ] ) , "HB_QOBJECT", NULL, HBQT_BIT_QOBJECT ); hb_vmPush( p0 ); hb_vmSend( 1 ); hb_itemRelease( p0 ); diff --git a/harbour/contrib/hbqt/qtcore/hbqt_misc.prg b/harbour/contrib/hbqt/qtcore/hbqt_misc.prg index 5310e3b7b1..b0601f036e 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_misc.prg +++ b/harbour/contrib/hbqt/qtcore/hbqt_misc.prg @@ -58,11 +58,6 @@ CREATE CLASS HbQtObjectHandler - /* QUESTION: _three_ different lists for events? two for slots? Is this needed? */ - /* ANSWER : these variables hold the objects which capture and fire the relative signal/event */ - - VAR __pEvents PROTECTED - VAR __hEvents PROTECTED INIT { => } VAR __Slots /* TOFIX: add PROTECTED or clean this mess ANS: It is like this by design, cannot be made PROTECTED */ @@ -142,7 +137,7 @@ METHOD HbQtObjectHandler:connect( cnEvent, bBlock ) IF hb_hHasKey( ::__hEvents, cnEvent ) IF HB_ISNUMERIC( ::__hEvents[ cnEvent ] ) - ::__pEvents:hbDisconnect( Self, cnEvent ) + hbqt_disconnectEvent( Self, cnEvent ) ELSE hbqt_disconnect( Self, cnEvent ) ENDIF @@ -163,11 +158,7 @@ METHOD HbQtObjectHandler:connect( cnEvent, bBlock ) EXIT CASE "N" - IF Empty( ::__pEvents ) - ::__pEvents := HBQEvents() - ::__pEvents:hbInstallEventFilter( Self ) - ENDIF - nResult := ::__pEvents:hbConnect( Self, cnEvent, bBlock ) + nResult := hbqt_connectEvent( Self, cnEvent, bBlock ) SWITCH nResult CASE 0 @@ -217,9 +208,7 @@ METHOD HbQtObjectHandler:disconnect( cnEvent ) EXIT CASE "N" - IF ! empty( ::__pEvents ) - nResult := ::__pEvents:hbdisconnect( Self, cnEvent ) - ENDIF + nResult := hbqt_disconnectEvent( Self, cnEvent ) SWITCH nResult CASE 0 diff --git a/harbour/contrib/hbqt/qtcore/qth/HBQEvents.qth b/harbour/contrib/hbqt/qtcore/qth/HBQEvents.qth deleted file mode 100644 index 6c42e8861e..0000000000 --- a/harbour/contrib/hbqt/qtcore/qth/HBQEvents.qth +++ /dev/null @@ -1,57 +0,0 @@ -/* - * $Id$ - */ - -/* - * Harbour Qt wrapper generator control file - * - * Copyright 2009-2012 Pritpal Bedi - * www - http://www.harbour-project.org - * - * See COPYING for licensing terms. - */ - - -QObject = -Inherit = QObject -Type = -New = - - - - - - - - - -#include -#include "hbqt_hbqevents.h" - - -/* - * HBQEvents () - * ~HBQEvents () - * - */ -HB_FUNC( QT_HBQEVENTS ) -{ - __HB_RETPTRGC__( new HBQEvents() ); -} - - - - - - - -int hbConnect( PHB_ITEM obj, int event, PHB_ITEM block ) -int hbDisconnect( PHB_ITEM obj, int event ) -void hbInstallEventFilter( PHB_ITEM obj ) - - - - - - - diff --git a/harbour/contrib/hbqt/qtcore/qth/filelist.hbm b/harbour/contrib/hbqt/qtcore/qth/filelist.hbm index d16b3e5820..62dd9e5259 100644 --- a/harbour/contrib/hbqt/qtcore/qth/filelist.hbm +++ b/harbour/contrib/hbqt/qtcore/qth/filelist.hbm @@ -6,7 +6,6 @@ -pflag=-qtmodule=qtcore -pflag=-qthdocdir=../doc/ -HBQEvents.qth HBQString.qth # QAbstractEventDispatcher.qth