diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 780b0cf8c0..8149c7b8ea 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,45 @@ The license applies to all entries newer than 2009-04-28. */ +2012-07-02 02:14 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtgui/qth/QBoxLayout.qth + * contrib/hbqt/qtgui/qth/QComboBox.qth + * contrib/hbqt/qtgui/qth/QDirModel.qth + * contrib/hbqt/qtgui/qth/QDockWidget.qth + * contrib/hbqt/qtgui/qth/QDrag.qth + * contrib/hbqt/qtgui/qth/QGraphicsScene.qth + * contrib/hbqt/qtgui/qth/QGridLayout.qth + * contrib/hbqt/qtgui/qth/QLayout.qth + * contrib/hbqt/qtgui/qth/QMainWindow.qth + * contrib/hbqt/qtgui/qth/QMenu.qth + * contrib/hbqt/qtgui/qth/QMenuBar.qth + * contrib/hbqt/qtgui/qth/QScrollArea.qth + * contrib/hbqt/qtgui/qth/QStandardItemModel.qth + * contrib/hbqt/qtgui/qth/QStatusBar.qth + * contrib/hbqt/qtgui/qth/QTabWidget.qth + * contrib/hbqt/qtgui/qth/QToolBar.qth + * contrib/hbqt/qtgui/qth/QTreeWidgetItem.qth + * contrib/hbqt/qtgui/qth/QWidget.qth + % Replaced: [*D=n*] => [*X=n*] except for + QTreeWidget/QListWidget/QTableWidget as per the change + in core engine where deletion of a Qt object is entirely + thought of on new grounds. + + * contrib/hbqt/tests/demoqt.prg + ! Optimizations and removal of redundant code. + + * contrib/hbqt/qtcore/hbqt.h + * contrib/hbqt/qtcore/hbqt_bind.cpp + * contrib/hbqt/qtcore/hbqt_destroyer.cpp + * contrib/hbqt/qtcore/hbqt_destroyer.h + + Overhauled: the Qt object destruction protocol. + This commit is the result of two weeks intensive debugging + spree. This commits now handles MT applications better + then before. This commit also covers the mem leaks evident + for certain widgets. + + WARNING: regression is possible, please report. + 2012-07-01 00:42 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/hbmk2_qt.hb + Implemented: some missing functionality which seemed not diff --git a/harbour/contrib/hbqt/qtcore/hbqt.h b/harbour/contrib/hbqt/qtcore/hbqt.h index ffa44e7d48..2b68fdb4a3 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt.h +++ b/harbour/contrib/hbqt/qtcore/hbqt.h @@ -108,7 +108,7 @@ HB_EXPORT PHB_ITEM hbqt_bindGetHbObjectByQtObject( void * qtObject ); HB_EXPORT void * hbqt_bindGetQtObject( PHB_ITEM pObject ); HB_EXPORT void hbqt_bindSetOwner( void * qtObject, HB_BOOL fOwner ); HB_EXPORT void hbqt_bindDestroyHbObject( PHB_ITEM pObject ); -HB_EXPORT void hbqt_bindDestroyQtObject( void * qtObject ); +HB_EXPORT void hbqt_bindDestroyQtObject( void * qtObject, QObject * obj ); HB_EXPORT void hbqt_bindAddChild( PHB_ITEM pObject, PHB_ITEM pChild ); HB_EXPORT void hbqt_bindDelChild( PHB_ITEM pObject, PHB_ITEM pChild ); diff --git a/harbour/contrib/hbqt/qtcore/hbqt_bind.cpp b/harbour/contrib/hbqt/qtcore/hbqt_bind.cpp index 57a424589f..75c2fc53ea 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_bind.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_bind.cpp @@ -64,28 +64,6 @@ #include "hbqt_hbqslots.h" #include "hbqt_hbqevents.h" -/* locks for MT mode, now just dummy definitions which checks - * if all locks are correctly released. - * - * #define HBQT_BIND_LOCK do { - * #define HBQT_BIND_UNLOCK } while( 0 ); - */ -static HB_CRITICAL_NEW( s_qtMtx ); -#define HBQT_BIND_LOCK do { hb_threadEnterCriticalSection( &s_qtMtx ); -#define HBQT_BIND_UNLOCK hb_threadLeaveCriticalSection( &s_qtMtx ); } while( 0 ); - -void hbqt_bindDelSlots( PHB_ITEM pSenderObject ); -void hbqt_bindDelEvents( PHB_ITEM pSenderObject ); -int __hbqt_bindItemsInGlobalList(); -int hbqt_bindIsHbObject( PHB_ITEM pObject ); - -static PHB_DYNS s_dynsym_NEW = NULL; -static PHB_DYNS s_dynsym___CHILDS = NULL; -static PHB_DYNS s_dynsym___SLOTS = NULL; -static PHB_DYNS s_dynsym_SETSLOTS = NULL; -static PHB_DYNS s_dynsym___EVENTS = NULL; -static PHB_DYNS s_dynsym_SETEVENTS = NULL; - typedef struct _HBQT_BIND { void * qtObject; @@ -101,18 +79,49 @@ HBQT_BIND, * PHBQT_BIND; typedef struct { - PHBQT_BIND s_hbqt_binds; + PHBQT_BIND s_hbqt_binds; } HB_BIND_DATA, * PHB_BIND_DATA; typedef struct { int iThreadId; + int iObjCreated; + int iObjDestroyed; HBQDestroyer * pDestroyer; HBQSlots * pReceiverSlots; HBQEvents * pReceiverEvents; } HB_BIND_THREADDATA, * PHB_BIND_THREADDATA; -HB_FUNC_EXTERN( HB_THREADID ); +/* locks for MT mode, now just dummy definitions which checks + * if all locks are correctly released. + * + * #define HBQT_BIND_LOCK do { + * #define HBQT_BIND_UNLOCK } while( 0 ); + */ +static HB_CRITICAL_NEW( s_qtMtx ); +#define HBQT_BIND_LOCK do { hb_threadEnterCriticalSection( &s_qtMtx ); +#define HBQT_BIND_UNLOCK hb_threadLeaveCriticalSection( &s_qtMtx ); } while( 0 ); + +static PHB_DYNS s_dynsym_NEW = NULL; +static PHB_DYNS s_dynsym___CHILDS = NULL; +static PHB_DYNS s_dynsym___SLOTS = NULL; +static PHB_DYNS s_dynsym_SETSLOTS = NULL; +static PHB_DYNS s_dynsym___EVENTS = NULL; +static PHB_DYNS s_dynsym_SETEVENTS = NULL; + +static PHB_BIND_DATA s_bindData = NULL; +#define hbqt_bindGetData() ( ( ( PHB_BIND_DATA ) &s_bindData )->s_hbqt_binds ) + +void hbqt_bindDelSlots( PHB_ITEM pSenderObject ); +void hbqt_bindDelEvents( PHB_ITEM pSenderObject ); +int __hbqt_bindItemsInGlobalList(); + +static QList hbqt_bindGetObjectListByThread( int iThreadId ); +static void hbqt_bindRemoveBind( PHBQT_BIND bnd ); +static void hbqt_bindDestroyChildren( void * hbObject, bool fDeleteSelf ); +static QList hbqt_bindGetObjectListByThread( int iThreadId ); +static PHBQT_BIND hbqt_bindGetBindByQtObject( void * qtObject ); +static PHBQT_BIND hbqt_bindGetBindByHbObject( void * hbObject ); static int s_bind_threadId = 0; @@ -124,93 +133,146 @@ static int hbqt_bindGetThreadId() return s_bind_threadId; } -#define __HBQT_WITH_MT_SUPPORT__NO -#ifdef __HBQT_WITH_MT_SUPPORT__ -static void hbqt_bindInit( void * cargo ) -{ - HB_TRACE( HB_TR_DEBUG, ( "...hbqt_bindInit............0........." ) ); - ( ( PHB_BIND_DATA ) cargo )->s_hbqt_binds = NULL; - HB_TRACE( HB_TR_DEBUG, ( "...hbqt_bindInit............1........." ) ); -} -static void hbqt_bindRelease( void * cargo ) -{ - HB_TRACE( HB_TR_DEBUG, ( "...hbqt_bindRelease.........0........." ) ); - PHBQT_BIND hbqt_bind; - - while( ( ( PHB_BIND_DATA ) cargo )->s_hbqt_binds ) - { - hbqt_bind = ( ( PHB_BIND_DATA ) cargo )->s_hbqt_binds; - HB_TRACE( HB_TR_DEBUG, ( "...hbqt_bindRelease( %p, %s )", hbqt_bind->qtObject, hbqt_bind->szClassName ) ); - hbqt_bindDestroyHbObject( hb_arrayFromId( NULL, hbqt_bind->hbObject ) ); - } - ( ( PHB_BIND_DATA ) cargo )->s_hbqt_binds = NULL; - HB_TRACE( HB_TR_DEBUG, ( "...hbqt_bindRelease.........1........." ) ); -} -static HB_TSD_NEW( s_bindData, sizeof( HB_BIND_DATA ), hbqt_bindInit, hbqt_bindRelease ); -#define hbqt_bindGetData() ( ( ( PHB_BIND_DATA ) hb_stackGetTSD( &s_bindData ) )->s_hbqt_binds ) -#else -static PHB_BIND_DATA s_bindData = NULL; -#define hbqt_bindGetData() ( ( ( PHB_BIND_DATA ) &s_bindData )->s_hbqt_binds ) -#endif - - static void hbqt_bindThreadInit( void * cargo ) { PHB_BIND_THREADDATA pBindThreadData = ( ( PHB_BIND_THREADDATA ) cargo ); pBindThreadData->iThreadId = hbqt_bindGetThreadId(); + pBindThreadData->iObjCreated = 0; + pBindThreadData->iObjDestroyed = 0; HB_TRACE( HB_TR_DEBUG, ( "...hbqt_bindThreadInit( %i )...STARTS",pBindThreadData->iThreadId ) ); pBindThreadData->pDestroyer = new HBQDestroyer(); pBindThreadData->pReceiverSlots = new HBQSlots(); pBindThreadData->pReceiverEvents = new HBQEvents(); HB_TRACE( HB_TR_DEBUG, ( "...hbqt_bindThreadInit( %i )...ENDS",pBindThreadData->iThreadId ) ); } + static void hbqt_bindThreadRelease( void * cargo ) { PHB_BIND_THREADDATA pBindThreadData = ( ( PHB_BIND_THREADDATA ) cargo ); - int id = pBindThreadData->iThreadId; + int iThreadId = pBindThreadData->iThreadId; - HB_TRACE( HB_TR_DEBUG, ( "...hbqt_bindThreadRelease( %i )...STARTS", id ) ); + HB_TRACE( HB_TR_DEBUG, ( " " ) ); + HB_TRACE( HB_TR_DEBUG, ( "...hbqt_bindThreadRelease( %i, Created: %i, Destroyed: %i )...STARTS", iThreadId, pBindThreadData->iObjCreated, pBindThreadData->iObjDestroyed ) ); + HB_TRACE( HB_TR_DEBUG, ( " " ) ); - QList deleteIt; + QList deleteIt = hbqt_bindGetObjectListByThread( iThreadId ); - PHBQT_BIND bind; - HBQT_BIND_LOCK - bind = hbqt_bindGetData(); - while( bind ) - { - if( bind->iThreadId == id ) - { - deleteIt << bind->hbObject; - } - bind = bind->next; - } - HBQT_BIND_UNLOCK + HB_TRACE( HB_TR_DEBUG, ( "..." ) ); + HB_TRACE( HB_TR_DEBUG, ( ".....hbqt_bindThreadRelease( %i, ToBeReleased: %i )", iThreadId, deleteIt.size() ) ); + HB_TRACE( HB_TR_DEBUG, ( "..." ) ); - HB_TRACE( HB_TR_DEBUG, ( "...hbqt_bindThreadRelease( %i, ToBeReleased=%i )", id, deleteIt.size() ) ); + int iPass = 0; while( ! deleteIt.isEmpty() ) { - if( hbqt_bindIsHbObject( ( PHB_ITEM ) deleteIt.at( 0 ) ) ) + iPass++; + + HB_TRACE( HB_TR_DEBUG, ( "........................................................" ) ); + HB_TRACE( HB_TR_DEBUG, ( ".......hbqt_bindThreadRelease( THREAD = %i, PASS = %i ).......", iThreadId, iPass ) ); + HB_TRACE( HB_TR_DEBUG, ( "........................................................" ) ); + + int i; +// for( i = deleteIt.size()-1; i >= 0 ; i-- ) /* FIFO - Many problems */ + for( i = 0; i < deleteIt.size(); i++ ) /* LIFO - Some problems */ { - HB_TRACE( HB_TR_DEBUG, ( "...hbqt_bindThreadRelease( %i )", id ) ); - hbqt_bindDestroyHbObject( hb_arrayFromId( NULL, deleteIt.at( 0 ) ) ); - hb_itemRelease( ( PHB_ITEM ) deleteIt.at( 0 ) ); + if( deleteIt.at( i ) != NULL ) + { + PHBQT_BIND bind; + + bind = hbqt_bindGetBindByHbObject( deleteIt.at( i ) ); + if( bind != NULL ) + { + HB_TRACE( HB_TR_DEBUG, ( "..." ) ); + HB_TRACE( HB_TR_DEBUG, ( ".......hbqt_bindThreadRelease( %i, #.%i, %p, %s, PASS = %i, FLAGS = %i ).......", iThreadId, i+1, bind->qtObject, bind->szClassName, iPass, bind->iFlags ) ); + HB_TRACE( HB_TR_DEBUG, ( "..." ) ); + + if( bind->iFlags & HBQT_BIT_OWNER ) + { + if( bind->iFlags & HBQT_BIT_QOBJECT ) + { + QObject * qObject = ( QObject * ) bind->qtObject; + if( qObject != NULL ) + { + if( qObject->parent() != NULL && qObject->children().size() > 0 ) + { + HB_TRACE( HB_TR_DEBUG, ( "..." ) ); + HB_TRACE( HB_TR_DEBUG, ( ".......hbqt_bindThreadRelease( %i, #.%i )... parent() != NULL && children() > 0", iThreadId, i+1 ) ); + hbqt_bindDestroyChildren( bind->hbObject, false ); + hbqt_bindDestroyQtObject( bind->qtObject, ( QObject * ) bind->qtObject ); + HB_TRACE( HB_TR_DEBUG, ( "..." ) ); + } + else if( qObject->parent() != NULL && qObject->children().size() == 0 ) + { + HB_TRACE( HB_TR_DEBUG, ( "..." ) ); + HB_TRACE( HB_TR_DEBUG, ( ".......hbqt_bindThreadRelease( %i, #.%i )... parent() != NULL && children() == 0", iThreadId, i+1 ) ); + hbqt_bindDestroyQtObject( bind->qtObject, ( QObject * ) bind->qtObject ); + HB_TRACE( HB_TR_DEBUG, ( "..." ) ); + } + else if( qObject->parent() == NULL && qObject->children().size() > 0 ) + { + HB_TRACE( HB_TR_DEBUG, ( "..." ) ); + HB_TRACE( HB_TR_DEBUG, ( ".......hbqt_bindThreadRelease( %i, #.%i )... parent() == NULL && children() > 0", iThreadId, i+1 ) ); + hbqt_bindDestroyChildren( bind->hbObject, false ); + hbqt_bindDestroyQtObject( bind->qtObject, ( QObject * ) bind->qtObject ); + HB_TRACE( HB_TR_DEBUG, ( "..." ) ); + } + else if( qObject->parent() == NULL && qObject->children().size() == 0 ) + { + HB_TRACE( HB_TR_DEBUG, ( "..." ) ); + HB_TRACE( HB_TR_DEBUG, ( ".......hbqt_bindThreadRelease( %i, #.%i )... parent() == NULL && children() == 0", iThreadId, i+1 ) ); + hbqt_bindDestroyQtObject( bind->qtObject, qObject ); + HB_TRACE( HB_TR_DEBUG, ( "..." ) ); + } + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "........Qt Object Seems Destroyed..." ) ); + hbqt_bindRemoveBind( bind ); + } + } + else /* not an QObject object */ + { + HB_TRACE( HB_TR_DEBUG, ( "..." ) ); + HB_TRACE( HB_TR_DEBUG, ( ".......hbqt_bindThreadRelease( %i, #.%i )... else no_qOBJECT", iThreadId, i+1 ) ); + PHB_ITEM pObject = hb_arrayFromId( NULL, bind->hbObject ); + if( pObject != NULL ) + { + hbqt_bindDestroyHbObject( pObject ); + hb_itemRelease( pObject ); + } + HB_TRACE( HB_TR_DEBUG, ( "..." ) ); + } + } + else /* Harbour is not the owner */ + { + HB_TRACE( HB_TR_DEBUG, ( "..." ) ); + HB_TRACE( HB_TR_DEBUG, ( ".......hbqt_bindThreadRelease( %i, #.%i, %p, %s ).......REMOVING BIND", iThreadId, i+1, bind->qtObject, bind->szClassName ) ); + hbqt_bindRemoveBind( bind ); + HB_TRACE( HB_TR_DEBUG, ( "..." ) ); + } + } + HB_TRACE( HB_TR_DEBUG, ( "..." ) ); + HB_TRACE( HB_TR_DEBUG, ( ".......hbqt_bindThreadRelease( %i, #.%i ).............e", iThreadId, i+1 ) ); + HB_TRACE( HB_TR_DEBUG, ( "..." ) ); + } } - deleteIt.removeAt( 0 ); + deleteIt.clear(); + deleteIt = hbqt_bindGetObjectListByThread( iThreadId ); } delete pBindThreadData->pDestroyer; delete pBindThreadData->pReceiverSlots; delete pBindThreadData->pReceiverEvents; - HB_TRACE( HB_TR_DEBUG, ( "...hbqt_bindThreadRelease( %i )...ENDS",id ) ); + HB_TRACE( HB_TR_DEBUG, ( " " ) ); + HB_TRACE( HB_TR_DEBUG, ( "...hbqt_bindThreadRelease( %i )...ENDS", iThreadId ) ); + HB_TRACE( HB_TR_DEBUG, ( " " ) ); } static HB_TSD_NEW( s_bindThreadData, sizeof( HB_BIND_THREADDATA ), hbqt_bindThreadInit, hbqt_bindThreadRelease ); #define hbqt_bindGetThreadData() ( ( PHB_BIND_THREADDATA ) hb_stackGetTSD( &s_bindThreadData ) ) - static void hbqt_bind_init( void * cargo ) { HB_SYMBOL_UNUSED( cargo ); @@ -230,38 +292,167 @@ static void hbqt_bind_exit( void * cargo ) HB_SYMBOL_UNUSED( cargo ); } +static QList hbqt_bindGetObjectListByThread( int iThreadId ) +{ + QList deleteIt; + + HBQT_BIND_LOCK + PHBQT_BIND bind; + bind = hbqt_bindGetData(); + while( bind != NULL ) + { + if( bind->iThreadId == iThreadId ) + { + deleteIt << bind->hbObject; + HB_TRACE( HB_TR_DEBUG, ( "...hbqt_bindThreadRelease( %i, %p, %i, %s )", iThreadId, bind->qtObject, deleteIt.size(), bind->szClassName ) ); + } + bind = bind->next; + } + HBQT_BIND_UNLOCK + + return deleteIt; +} + +static PHBQT_BIND hbqt_bindGetBindByQtObject( void * qtObject ) +{ + PHBQT_BIND bind, r_bind; + + r_bind = NULL; + + HBQT_BIND_LOCK + bind = hbqt_bindGetData(); + while( bind != NULL ) + { + if( bind->qtObject == qtObject ) + { + r_bind = bind; + break; + } + bind = bind->next; + } + HBQT_BIND_UNLOCK + return r_bind; +} + +static PHBQT_BIND hbqt_bindGetBindByHbObject( void * hbObject ) +{ + PHBQT_BIND bind, r_bind; + + r_bind = NULL; + + HBQT_BIND_LOCK + bind = hbqt_bindGetData(); + while( bind != NULL ) + { + if( bind->hbObject == hbObject ) + { + r_bind = bind; + break; + } + bind = bind->next; + } + HBQT_BIND_UNLOCK + return r_bind; +} + +static void hbqt_bindRemoveBind( PHBQT_BIND bnd ) +{ + if( bnd != NULL ) + { + PHBQT_BIND * bind_ptr, bind; + + HBQT_BIND_LOCK + bind_ptr = &( hbqt_bindGetData() ); + while( ( bind = * bind_ptr ) != NULL ) + { + if( bind == bnd ) + { + * bind_ptr = bind->next; + hb_xfree( bind ); + hbqt_bindGetThreadData()->iObjDestroyed++; + break; + } + bind_ptr = &bind->next; + } + HBQT_BIND_UNLOCK + } +} + +static void hbqt_bindAddBind( PHBQT_BIND bind ) +{ + if( bind != NULL ) + { + HBQT_BIND_LOCK + bind->next = hbqt_bindGetData(); + hbqt_bindGetData() = bind; + hbqt_bindGetThreadData()->iObjCreated++; + HBQT_BIND_UNLOCK + } +} + +static void hbqt_bindDestroyChildren( void * hbObject, bool fDeleteSelf ) +{ + if( hbObject ) + { + PHBQT_BIND bind = hbqt_bindGetBindByHbObject( hbObject ); + if( bind != NULL ) + { + QObject * qObject = ( QObject * ) bind->qtObject; + if( qObject ) + { + QList< QObject *> children = qObject->children(); + if( children.size() > 0 ) + { + int i; + for( i = 0; i < children.size(); i++ ) + { + PHBQT_BIND bnd = hbqt_bindGetBindByQtObject( ( void * ) children.at( i ) ); + if( bnd != NULL ) + { + hbqt_bindDestroyChildren( bnd->hbObject, true ); + } + } + } + else if( fDeleteSelf ) + { + hbqt_bindDestroyQtObject( ( void * ) qObject, qObject ); + } + } + } + } +} + PHB_ITEM hbqt_bindGetHbObject( PHB_ITEM pItem, void * qtObject, const char * szClassName, PHBQT_DEL_FUNC pDelFunc, int iFlags ) { int id = hbqt_bindGetThreadData()->iThreadId; + bool isQObject = iFlags & HBQT_BIT_QOBJECT; - char * pname = ( char * ) hb_xgrab( 200 ); - char * pname1 = ( char * ) hb_xgrab( 200 ); - HB_TRACE( HB_TR_DEBUG, ( "......HARBOUR_REQUEST_BIND_OBJECT( %p, %s, %i, %i, %s, %s )", qtObject, szClassName, iFlags, id, hb_procname( 0, pname, HB_TRUE ), hb_procname( 1, pname1, HB_TRUE ) ) ); - hb_xfree( pname ); - hb_xfree( pname1 ); + if( iFlags & HBQT_BIT_QOBJECT ) + { + char * pname = ( char * ) hb_xgrab( 200 ); + char * pname1 = ( char * ) hb_xgrab( 200 ); + HB_TRACE( HB_TR_DEBUG, ( "......HARBOUR_REQUEST_BIND_OBJECT( %i, %i, %p, %s, %s, %s )", id, iFlags, qtObject, szClassName, hb_procname( 0, pname, HB_TRUE ), hb_procname( 1, pname1, HB_TRUE ) ) ); + hb_xfree( pname ); + hb_xfree( pname1 ); + } PHB_ITEM pObject = NULL; if( qtObject == NULL ) + { return pObject; + } PHB_SYMB pClassFunc = hb_dynsymGetSymbol( szClassName ); if( pClassFunc == NULL ) - return pObject; - - PHBQT_BIND bind; - - HBQT_BIND_LOCK - bind = hbqt_bindGetData(); - while( bind ) { - if( bind->qtObject == qtObject ) - { - HB_TRACE( HB_TR_DEBUG, ( "......hbqt_bindGetHbObject( %p ):if( bind->qtObject == qtObject )", qtObject ) ); - pObject = hb_arrayFromId( pItem, bind->hbObject ); - break; - } - bind = bind->next; + return pObject; + } + + PHBQT_BIND bind = hbqt_bindGetBindByQtObject( qtObject ); + if( bind != NULL ) + { + return hb_arrayFromId( pItem, bind->hbObject ); } if( pObject == NULL && pClassFunc && hb_vmRequestReenter() ) @@ -292,20 +483,20 @@ PHB_ITEM hbqt_bindGetHbObject( PHB_ITEM pItem, void * qtObject, const char * szC bind->fEventFilterInstalled = false; bind->iThreadId = id; hb_strncpy( bind->szClassName, szClassName, HB_SIZEOFARRAY( bind->szClassName ) - 1 ); - bind->next = hbqt_bindGetData(); - hbqt_bindGetData() = bind; + + hbqt_bindAddBind( bind ); } bind->hbObject = hb_arrayId( pObject ); - if( iFlags & HBQT_BIT_QOBJECT ) + if( isQObject ) { QObject * obj = ( QObject * ) qtObject; QString className = ( QString ) obj->metaObject()->className(); - if( pDelFunc != NULL ) + if( bind->iFlags & HBQT_BIT_OWNER ) { - QObject::connect( obj, SIGNAL( destroyed(QObject*) ), hbqt_bindGetThreadData()->pDestroyer, SLOT( destroyer() ) ); + QObject::connect( obj, SIGNAL( destroyed(QObject*) ), hbqt_bindGetThreadData()->pDestroyer, SLOT( destroyer(QObject*) ) ); } HB_TRACE( HB_TR_DEBUG, ( "......hbqt_bindGetHbObject_connected_to_destroy()( %p, %s )", qtObject, szClassName ) ); @@ -324,11 +515,130 @@ PHB_ITEM hbqt_bindGetHbObject( PHB_ITEM pItem, void * qtObject, const char * szC } hb_vmRequestRestore(); } - HBQT_BIND_UNLOCK return pObject; } +void hbqt_bindDestroyHbObject( PHB_ITEM pObject ) +{ + void * hbObject = hb_arrayId( pObject ); + + if( hbObject ) + { + PHBQT_BIND bind = hbqt_bindGetBindByHbObject( hbObject ); + if( bind != NULL ) + { + void * qtObject = bind->qtObject; + int iFlags = bind->iFlags; + PHBQT_DEL_FUNC pDelFunc = bind->pDelFunc; + + bool fDelQtObject = false; + bool isQObject = iFlags & HBQT_BIT_QOBJECT; + QObject * qObject = NULL; + + if( isQObject ) + { + qObject = ( QObject * ) qtObject; + } + if( pDelFunc != NULL ) + { + if( iFlags & HBQT_BIT_OWNER ) + { + if( isQObject ) + { + if( qObject->parent() == NULL ) + { + fDelQtObject = true; + } + } + else + { + fDelQtObject = true; + } + } + } + + if( isQObject ) + { + HB_TRACE( HB_TR_DEBUG, ( ".........HARBOUR_DESTROY_BEGINS( %i, %i, %p, %s ) )", bind->iThreadId, iFlags, qtObject, bind->szClassName ) ); + } + if( iFlags & HBQT_BIT_OWNER ) + { + if( fDelQtObject ) + { + if( isQObject ) + { + HB_TRACE( HB_TR_DEBUG, ( "......... HARBOUR_DESTROYING_QT_OBJECT( %i, %i, %p, %s ) )", bind->iThreadId, iFlags, qtObject, bind->szClassName ) ); + qObject->disconnect(); + if( bind->fEventFilterInstalled ) + { + qObject->removeEventFilter( hbqt_bindGetThreadData()->pReceiverEvents ); + } + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "......... HARBOUR_DESTROYING_QT_OBJECT( %i, %i, %p, %s ) )", bind->iThreadId, iFlags, qtObject, bind->szClassName ) ); + } + hbqt_bindRemoveBind( bind ); + pDelFunc( qtObject, iFlags ); + } + else + { + if( isQObject ) + { + HB_TRACE( HB_TR_DEBUG, ( "......... HARBOUR_NOT-DESTROYING_HB_OBJECT( %i, %i, %p, %s ) )", bind->iThreadId, iFlags, qtObject, bind->szClassName ) ); + } + } + } + else + { + if( isQObject ) + { + HB_TRACE( HB_TR_DEBUG, ( "......... HARBOUR_DESTROYING_HB_OBJECT( %i, %i, %p, %s ) )", bind->iThreadId, iFlags, qtObject, bind->szClassName ) ); + } + hbqt_bindRemoveBind( bind ); + } + HB_TRACE( HB_TR_DEBUG, ( ".........HARBOUR_DESTROY_ENDS( %p )", qtObject ) ); + } + } +} + +void hbqt_bindDestroyQtObject( void * qtObject, QObject * qObject ) +{ + if( qtObject ) + { + PHBQT_BIND bind = hbqt_bindGetBindByQtObject( qtObject ); + if( bind != NULL ) + { + if( bind->pDelFunc != NULL ) + { + HB_TRACE( HB_TR_DEBUG, ( "............QT_DESTROYS( %i, %i, %p, %s )..............", bind->iThreadId, bind->iFlags, bind->qtObject, bind->szClassName ) ); + + int iFlags = bind->iFlags; + PHBQT_DEL_FUNC pDelFunc = bind->pDelFunc; + qObject->disconnect(); + if( bind->fEventFilterInstalled ) + { + qObject->removeEventFilter( hbqt_bindGetThreadData()->pReceiverEvents ); + } + hbqt_bindRemoveBind( bind ); + pDelFunc( qtObject, iFlags ); /* Though this is not needed as Qt will delete the object, + * but may be because Harbour uses is own memory manager, + * it seems necessary to reclaim the memory. + */ + } + else + { + hbqt_bindRemoveBind( bind ); /* Conceptually it must not reach here, but... It is Qt */ + } + } + else + { + qObject->disconnect(); + } + } +} + PHB_ITEM hbqt_bindSetHbObject( PHB_ITEM pItem, void * qtObject, const char * szClassName, PHBQT_DEL_FUNC pDelFunc, int iFlags ) { int id = hbqt_bindGetThreadData()->iThreadId; @@ -364,12 +674,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->fEventFilterInstalled = false; bind->iThreadId = id; hb_strncpy( bind->szClassName, szClassName, HB_SIZEOFARRAY( bind->szClassName ) - 1 ); + bind->next = hbqt_bindGetData(); hbqt_bindGetData() = bind; @@ -377,11 +689,22 @@ PHB_ITEM hbqt_bindSetHbObject( PHB_ITEM pItem, void * qtObject, const char * szC if( iFlags & HBQT_BIT_QOBJECT ) { - if( pDelFunc != NULL ) + QObject * obj = ( QObject * ) qtObject; + QString className = ( QString ) obj->metaObject()->className(); + + if( bind->iFlags & HBQT_BIT_OWNER ) { - QObject::connect( ( QObject * ) qtObject, SIGNAL( destroyed(QObject*) ), hbqt_bindGetThreadData()->pDestroyer, SLOT( destroyer() ) ); + QObject::connect( obj, SIGNAL( destroyed(QObject*) ), hbqt_bindGetThreadData()->pDestroyer, SLOT( destroyer(QObject*) ) ); } - HB_TRACE( HB_TR_DEBUG, ( "......hbqt_bindSetHbObject( QObject %p )...%s", qtObject, ( ( QObject * ) qtObject )->metaObject()->className() ) ); + HB_TRACE( HB_TR_DEBUG, ( "......hbqt_bindSetHbObject_connected_to_destroy()( %p, %s )", qtObject, szClassName ) ); + + hb_vmPushDynSym( s_dynsym_SETSLOTS ); /* initializes __Slots hash */ + hb_vmPush( pObject ); + hb_vmSend( 0 ); + + hb_vmPushDynSym( s_dynsym_SETEVENTS ); /* initializes __Events hash */ + hb_vmPush( pObject ); + hb_vmSend( 0 ); } } HBQT_BIND_UNLOCK @@ -390,113 +713,17 @@ PHB_ITEM hbqt_bindSetHbObject( PHB_ITEM pItem, void * qtObject, const char * szC return pObject; } -void hbqt_bindDestroyHbObject( PHB_ITEM pObject ) -{ - void * hbObject = hb_arrayId( pObject ); - - if( hbObject ) - { - PHBQT_BIND * bind_ptr, bind; - - HBQT_BIND_LOCK - bind_ptr = &( hbqt_bindGetData() ); - while( ( bind = * bind_ptr ) != NULL ) - { - if( bind->hbObject == hbObject ) - { - void * qtObject = bind->qtObject; - int iFlags = bind->iFlags; - PHBQT_DEL_FUNC pDelFunc = bind->pDelFunc; - - bool fDelQtObject = false; - bool isQObject = iFlags & HBQT_BIT_QOBJECT; - QObject * qObject = NULL; - - if( isQObject ) - qObject = ( QObject * ) qtObject; - - if( pDelFunc != NULL ) - { - if( iFlags & HBQT_BIT_OWNER ) - { - if( isQObject ) - { - if( qObject->metaObject()->className() != ( const char * ) "QAction" ) - { - if( qObject->parent() == NULL ) - { - fDelQtObject = true; - } - } - } - else - { - fDelQtObject = true; - } - } - } - HB_TRACE( HB_TR_DEBUG, ( ".........HARBOUR_DESTROY_BEGINS( %p, %s, Thread( %i ) )", qtObject, bind->szClassName, bind->iThreadId ) ); - * bind_ptr = bind->next; - hb_xfree( bind ); - - if( fDelQtObject ) - { - pDelFunc( qtObject, iFlags ); - } - HB_TRACE( HB_TR_DEBUG, ( ".........HARBOUR_DESTROY_ENDS( %p )", qtObject ) ); - break; - } - bind_ptr = &bind->next; - } - HBQT_BIND_UNLOCK - } -} - -void hbqt_bindDestroyQtObject( void * qtObject ) -{ - if( qtObject ) - { - PHBQT_BIND * bind_ptr, bind; - - HBQT_BIND_LOCK - bind_ptr = &( hbqt_bindGetData() ); - while( ( bind = * bind_ptr ) != NULL ) - { - if( bind->qtObject == qtObject ) - { - HB_TRACE( HB_TR_DEBUG, ( "............QT_DESTROY_BEGINS( %p, %s )..............", qtObject, bind->szClassName ) ); - * bind_ptr = bind->next; - hb_xfree( bind ); - HB_TRACE( HB_TR_DEBUG, ( "............QT_DESTROY_ENDS( %p )..............", qtObject ) ); - break; - } - bind_ptr = &bind->next; - } - HBQT_BIND_UNLOCK - } -} - HBQSlots * hbqt_bindGetReceiverSlotsByHbObject( PHB_ITEM pObject ) { HBQSlots * pReceiverSlot = NULL; if( pObject != NULL ) { void * hbObject = hb_arrayId( pObject ); - PHBQT_BIND bind; - - HBQT_BIND_LOCK - bind = hbqt_bindGetData(); - while( bind ) + PHBQT_BIND bind = hbqt_bindGetBindByHbObject( hbObject ); + if( bind != NULL ) { - if( bind->hbObject == hbObject ) - { - pReceiverSlot = hbqt_bindGetThreadData()->pReceiverSlots; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_bindGetReceiverSlotByHbObject( %p )", bind->qtObject ) ); - break; - } - bind = bind->next; + pReceiverSlot = hbqt_bindGetThreadData()->pReceiverSlots; } - HBQT_BIND_UNLOCK } return pReceiverSlot; } @@ -507,26 +734,17 @@ HBQEvents * hbqt_bindGetReceiverEventsByHbObject( PHB_ITEM pObject ) if( pObject != NULL ) { void * hbObject = hb_arrayId( pObject ); - PHBQT_BIND bind; - - HBQT_BIND_LOCK - bind = hbqt_bindGetData(); - while( bind ) + PHBQT_BIND bind = hbqt_bindGetBindByHbObject( hbObject ); + if( bind != NULL ) { - if( bind->hbObject == hbObject ) + pReceiverEvents = hbqt_bindGetThreadData()->pReceiverEvents; + if( ! bind->fEventFilterInstalled ) { - pReceiverEvents = hbqt_bindGetThreadData()->pReceiverEvents; - if( ! bind->fEventFilterInstalled ) - { - bind->fEventFilterInstalled = true; - hbqt_bindGetThreadData()->pReceiverEvents->hbInstallEventFilter( pObject ); - } - HB_TRACE( HB_TR_DEBUG, ( "hbqt_bindGetReceiverEventsByHbObject( %p )", bind->qtObject ) ); - break; + bind->fEventFilterInstalled = true; + hbqt_bindGetThreadData()->pReceiverEvents->hbInstallEventFilter( pObject ); } - bind = bind->next; + HB_TRACE( HB_TR_DEBUG, ( "hbqt_bindGetReceiverEventsByHbObject( %p )", bind->qtObject ) ); } - HBQT_BIND_UNLOCK } return pReceiverEvents; } @@ -555,27 +773,6 @@ PHB_ITEM hbqt_bindGetHbObjectByQtObject( void * qtObject ) return pObject; } -int hbqt_bindIsHbObject( PHB_ITEM pObject ) -{ - PHBQT_BIND bind; - - HBQT_BIND_LOCK - bind = hbqt_bindGetData(); - while( bind ) - { - HB_TRACE( HB_TR_DEBUG, ( "hbqt_bindIsHbObject( %p )", bind->qtObject ) ); - - if( bind->hbObject == pObject ) - { - return 1; - } - bind = bind->next; - } - HBQT_BIND_UNLOCK - - return 0; -} - void * hbqt_bindGetQtObject( PHB_ITEM pObject ) { HB_TRACE( HB_TR_DEBUG, ( "hbqt_bindGetQtObject()" ) ); @@ -585,45 +782,29 @@ void * hbqt_bindGetQtObject( PHB_ITEM pObject ) if( hbObject ) { - PHBQT_BIND bind; - - HBQT_BIND_LOCK - bind = hbqt_bindGetData(); - while( bind ) + PHBQT_BIND bind = hbqt_bindGetBindByHbObject( hbObject ); + if( bind != NULL ) { - HB_TRACE( HB_TR_DEBUG, ( "hbqt_bindGetQtObject( %p )", bind->qtObject ) ); - - if( bind->hbObject == hbObject ) - { - qtObject = bind->qtObject; - break; - } - bind = bind->next; + qtObject = bind->qtObject; } - HBQT_BIND_UNLOCK } return qtObject; } void hbqt_bindSetOwner( void * qtObject, HB_BOOL fOwner ) { - PHBQT_BIND bind; - - HBQT_BIND_LOCK - bind = hbqt_bindGetData(); - while( bind ) + PHBQT_BIND bind = hbqt_bindGetBindByQtObject( qtObject ); + if( bind != NULL ) { - if( bind->qtObject == qtObject ) + if( fOwner == HB_TRUE ) { - if( fOwner == HB_TRUE ) - bind->iFlags = bind->iFlags | HBQT_BIT_OWNER; - else - bind->iFlags = bind->iFlags & ~( HBQT_BIT_OWNER ); - break; + bind->iFlags = bind->iFlags | HBQT_BIT_OWNER; + } + else + { + bind->iFlags = bind->iFlags & ~( HBQT_BIT_OWNER ); } - bind = bind->next; } - HBQT_BIND_UNLOCK } void hbqt_bindAddSlot( PHB_ITEM pSenderObject, int iSignalid, PHB_ITEM pCode ) @@ -959,3 +1140,4 @@ HB_CALL_ON_STARTUP_END( _hbqt_bind_init_ ) #define HB_DATASEG_BODY HB_DATASEG_FUNC( _hbqt_bind_init_ ) #include "hbiniseg.h" #endif + diff --git a/harbour/contrib/hbqt/qtcore/hbqt_destroyer.cpp b/harbour/contrib/hbqt/qtcore/hbqt_destroyer.cpp index e8763118cf..21f3c8e56a 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_destroyer.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_destroyer.cpp @@ -70,11 +70,12 @@ HBQDestroyer::~HBQDestroyer() { } -void HBQDestroyer::destroyer() +void HBQDestroyer::destroyer( QObject * obj ) { - HB_TRACE( HB_TR_DEBUG, ( "HBQDestroyer::destroyer( %p )", this->sender() ) ); - - hbqt_bindDestroyQtObject( this->sender() ); + Q_UNUSED( obj ); + HB_TRACE( HB_TR_DEBUG, ( "............HBQDestroyer::destroyer( %p )", this->sender() ) ); + + hbqt_bindDestroyQtObject( this->sender(), obj ); } diff --git a/harbour/contrib/hbqt/qtcore/hbqt_destroyer.h b/harbour/contrib/hbqt/qtcore/hbqt_destroyer.h index 2777e6281d..054ed45d02 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_destroyer.h +++ b/harbour/contrib/hbqt/qtcore/hbqt_destroyer.h @@ -70,7 +70,7 @@ public: ~HBQDestroyer(); public slots: - void destroyer(); + void destroyer( QObject * obj = 0 ); }; /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/qth/QBoxLayout.qth b/harbour/contrib/hbqt/qtgui/qth/QBoxLayout.qth index 11b3b11a96..16fc553601 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QBoxLayout.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QBoxLayout.qth @@ -46,12 +46,12 @@ enum Direction { LeftToRight, RightToLeft, TopToBottom, BottomToTop } -void addLayout ( QLayout * layout, int stretch = 0 ) [*D=1*] -void addSpacerItem ( QSpacerItem * spacerItem ) [*D=1*] +void addLayout ( QLayout * layout, int stretch = 0 ) [*X=1*] +void addSpacerItem ( QSpacerItem * spacerItem ) [*X=1*] void addSpacing ( int size ) void addStretch ( int stretch = 0 ) void addStrut ( int size ) -void addWidget ( QWidget * widget, int stretch = 0, Qt::Alignment alignment = 0 ) [*D=1*] +void addWidget ( QWidget * widget, int stretch = 0, Qt::Alignment alignment = 0 ) [*X=1*] Direction direction () const void insertLayout ( int index, QLayout * layout, int stretch = 0 ) void insertSpacerItem ( int index, QSpacerItem * spacerItem ) diff --git a/harbour/contrib/hbqt/qtgui/qth/QComboBox.qth b/harbour/contrib/hbqt/qtgui/qth/QComboBox.qth index 5252e5135d..b22a64c3b0 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QComboBox.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QComboBox.qth @@ -97,7 +97,7 @@ void setModelColumn ( int visibleColumn ) void setRootModelIndex ( const QModelIndex & index ) void setSizeAdjustPolicy ( SizeAdjustPolicy policy ) void setValidator ( const QValidator * validator ) -void setView ( QAbstractItemView * itemView ) [*D=1*] +void setView ( QAbstractItemView * itemView ) [*X=1*] virtual void showPopup () SizeAdjustPolicy sizeAdjustPolicy () const virtual const QValidator * validator () const diff --git a/harbour/contrib/hbqt/qtgui/qth/QDirModel.qth b/harbour/contrib/hbqt/qtgui/qth/QDirModel.qth index ab9e9ab309..85613be1c4 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QDirModel.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QDirModel.qth @@ -32,6 +32,14 @@ HB_FUNC( QT_QDIRMODEL ) { __HB_RETPTRGC__( new QDirModel( hbqt_par_QObject( 1 ) ) ); } + else if( hb_pcount() == 4 && hbqt_par_isDerivedFrom( 1, "QSTRINGLIST" ) && HB_ISNUM( 2 ) && HB_ISNUM( 3 ) && hbqt_par_isDerivedFrom( 4, "QOBJECT" ) ) + { + __HB_RETPTRGC__( new QDirModel( *hbqt_par_QStringList( 1 ), ( QDir::Filters ) hb_parni( 2 ), ( QDir::SortFlags ) hb_parni( 3 ), hbqt_par_QObject( 4 ) ) ); + } + else if( hb_pcount() == 3 && hbqt_par_isDerivedFrom( 1, "QSTRINGLIST" ) && HB_ISNUM( 2 ) && HB_ISNUM( 3 ) ) + { + __HB_RETPTRGC__( new QDirModel( *hbqt_par_QStringList( 1 ), ( QDir::Filters ) hb_parni( 2 ), ( QDir::SortFlags ) hb_parni( 3 ) ) ); + } else { __HB_RETPTRGC__( new QDirModel() ); diff --git a/harbour/contrib/hbqt/qtgui/qth/QDockWidget.qth b/harbour/contrib/hbqt/qtgui/qth/QDockWidget.qth index 380e2558b6..fdb9cdfacc 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QDockWidget.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QDockWidget.qth @@ -73,8 +73,8 @@ bool isFloating () const void setAllowedAreas ( Qt::DockWidgetAreas areas ) void setFeatures ( DockWidgetFeatures features ) void setFloating ( bool floating ) -void setTitleBarWidget ( QWidget * widget ) [*D=1*] -void setWidget ( QWidget * widget ) [*D=1*] +void setTitleBarWidget ( QWidget * widget ) [*X=1*] +void setWidget ( QWidget * widget ) [*X=1*] QWidget * titleBarWidget () const QAction * toggleViewAction () const QWidget * widget () const diff --git a/harbour/contrib/hbqt/qtgui/qth/QDrag.qth b/harbour/contrib/hbqt/qtgui/qth/QDrag.qth index 10b0aea71c..edca044797 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QDrag.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QDrag.qth @@ -52,7 +52,7 @@ QMimeData * mimeData () const QPixmap pixmap () const void setDragCursor ( const QPixmap & cursor, Qt::DropAction action ) void setHotSpot ( const QPoint & hotspot ) -void setMimeData ( QMimeData * data ) [*D=1*] +void setMimeData ( QMimeData * data ) [*X=1*] void setPixmap ( const QPixmap & pixmap ) QWidget * source () const QWidget * target () const diff --git a/harbour/contrib/hbqt/qtgui/qth/QGraphicsScene.qth b/harbour/contrib/hbqt/qtgui/qth/QGraphicsScene.qth index e1579d07ff..ae66ac102a 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QGraphicsScene.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QGraphicsScene.qth @@ -67,7 +67,7 @@ flags SceneLayers QGraphicsWidget * activeWindow () const QGraphicsEllipseItem * addEllipse ( const QRectF & rect, const QPen & pen = QPen(), const QBrush & brush = QBrush() ) QGraphicsEllipseItem * addEllipse ( qreal x, qreal y, qreal w, qreal h, const QPen & pen = QPen(), const QBrush & brush = QBrush() ) -void addItem ( QGraphicsItem * item ) [*D=1*] +void addItem ( QGraphicsItem * item ) [*X=1*] QGraphicsLineItem * addLine ( const QLineF & line, const QPen & pen = QPen() ) QGraphicsLineItem * addLine ( qreal x1, qreal y1, qreal x2, qreal y2, const QPen & pen = QPen() ) QGraphicsPathItem * addPath ( const QPainterPath & path, const QPen & pen = QPen(), const QBrush & brush = QBrush() ) diff --git a/harbour/contrib/hbqt/qtgui/qth/QGridLayout.qth b/harbour/contrib/hbqt/qtgui/qth/QGridLayout.qth index 170301fb72..89e594e4f1 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QGridLayout.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QGridLayout.qth @@ -39,11 +39,11 @@ HB_FUNC( QT_QGRIDLAYOUT ) -void addItem ( QLayoutItem * item, int row, int column, int rowSpan = 1, int columnSpan = 1, Qt::Alignment alignment = 0 ) [*D=1*] -void addLayout ( QLayout * layout, int row, int column, Qt::Alignment alignment = 0 ) [*D=1*] -void addLayout ( QLayout * layout, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment = 0 ) [*D=1*] -void addWidget ( QWidget * widget, int row, int column, Qt::Alignment alignment = 0 ) [*D=1*] -void addWidget ( QWidget * widget, int fromRow, int fromColumn, int rowSpan, int columnSpan, Qt::Alignment alignment = 0 ) [*D=1*] +void addItem ( QLayoutItem * item, int row, int column, int rowSpan = 1, int columnSpan = 1, Qt::Alignment alignment = 0 ) [*X=1*] +void addLayout ( QLayout * layout, int row, int column, Qt::Alignment alignment = 0 ) [*X=1*] +void addLayout ( QLayout * layout, int row, int column, int rowSpan, int columnSpan, Qt::Alignment alignment = 0 ) [*X=1*] +void addWidget ( QWidget * widget, int row, int column, Qt::Alignment alignment = 0 ) [*X=1*] +void addWidget ( QWidget * widget, int fromRow, int fromColumn, int rowSpan, int columnSpan, Qt::Alignment alignment = 0 ) [*X=1*] QRect cellRect ( int row, int column ) const int columnCount () const int columnMinimumWidth ( int column ) const diff --git a/harbour/contrib/hbqt/qtgui/qth/QLayout.qth b/harbour/contrib/hbqt/qtgui/qth/QLayout.qth index c27338a31f..d4dad99161 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QLayout.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QLayout.qth @@ -37,8 +37,8 @@ enum SizeConstraint { SetDefaultConstraint, SetFixedSize, SetMinimumSize, SetMax bool activate () -virtual void addItem ( QLayoutItem * item ) [*D=1*] -void addWidget ( QWidget * w ) [*D=1*] +virtual void addItem ( QLayoutItem * item ) [*X=1*] +void addWidget ( QWidget * w ) [*X=1*] QRect contentsRect () const virtual int count () const = 0 virtual Qt::Orientations expandingDirections () const @@ -57,7 +57,7 @@ void setAlignment ( Qt::Alignment alignment ) bool setAlignment ( QLayout * l, Qt::Alignment alignment ) void setContentsMargins ( int left, int top, int right, int bottom ) void setEnabled ( bool enable ) -void setMenuBar ( QWidget * widget ) [*D=1*] +void setMenuBar ( QWidget * widget ) [*X=1*] void setSizeConstraint ( SizeConstraint ) void setSpacing ( int ) SizeConstraint sizeConstraint () const diff --git a/harbour/contrib/hbqt/qtgui/qth/QMainWindow.qth b/harbour/contrib/hbqt/qtgui/qth/QMainWindow.qth index d2770db991..42c1c11d29 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QMainWindow.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QMainWindow.qth @@ -70,10 +70,10 @@ flags DockOptions -void addDockWidget ( Qt::DockWidgetArea area, QDockWidget * dockwidget ) [*D=2*] -void addDockWidget ( Qt::DockWidgetArea area, QDockWidget * dockwidget, Qt::Orientation orientation ) [*D=2*] -void addToolBar ( Qt::ToolBarArea area, QToolBar * toolbar ) [*D=2*] -void addToolBar ( QToolBar * toolbar ) [*D=1*] +void addDockWidget ( Qt::DockWidgetArea area, QDockWidget * dockwidget ) [*X=2*] +void addDockWidget ( Qt::DockWidgetArea area, QDockWidget * dockwidget, Qt::Orientation orientation ) [*X=2*] +void addToolBar ( Qt::ToolBarArea area, QToolBar * toolbar ) [*X=2*] +void addToolBar ( QToolBar * toolbar ) [*X=1*] QToolBar * addToolBar ( const QString & title ) // NOT implemented void addToolBarBreak ( Qt::ToolBarArea area = Qt::TopToolBarArea ) QWidget * centralWidget () const @@ -83,7 +83,7 @@ DockOptions dockOptions () const Qt::DockWidgetArea dockWidgetArea ( QDockWidget * dockwidget ) const bool documentMode () const QSize iconSize () const -void insertToolBar ( QToolBar * before, QToolBar * toolbar ) [*D=2*] +void insertToolBar ( QToolBar * before, QToolBar * toolbar ) [*X=2*] void insertToolBarBreak ( QToolBar * before ) bool isAnimated () const bool isDockNestingEnabled () const @@ -95,14 +95,14 @@ void removeToolBarBreak ( QToolBar * before ) bool restoreDockWidget ( QDockWidget * dockwidget ) bool restoreState ( const QByteArray & state, int Version = 0 ) QByteArray saveState ( int Version = 0 ) const -void setCentralWidget ( QWidget * widget ) [*D=1*] +void setCentralWidget ( QWidget * widget ) [*X=1*] void setCorner ( Qt::Corner corner, Qt::DockWidgetArea area ) void setDockOptions ( DockOptions options ) void setDocumentMode ( bool enabled ) void setIconSize ( const QSize & iconSize ) -void setMenuBar ( QMenuBar * menuBar ) [*D=1*] -void setMenuWidget ( QWidget * menuBar ) [*D=1*] -void setStatusBar ( QStatusBar * statusbar ) [*D=1*] +void setMenuBar ( QMenuBar * menuBar ) [*X=1*] +void setMenuWidget ( QWidget * menuBar ) [*X=1*] +void setStatusBar ( QStatusBar * statusbar ) [*X=1*] void setTabPosition ( Qt::DockWidgetAreas areas, QTabWidget::TabPosition tabPosition ) void setTabShape ( QTabWidget::TabShape tabShape ) void setToolButtonStyle ( Qt::ToolButtonStyle toolButtonStyle ) diff --git a/harbour/contrib/hbqt/qtgui/qth/QMenu.qth b/harbour/contrib/hbqt/qtgui/qth/QMenu.qth index 38db4726ac..6861209d32 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QMenu.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QMenu.qth @@ -62,7 +62,7 @@ QAction * addAction ( const QString & text, const QObject * receiver, const char QAction * addAction ( const QIcon & icon, const QString & text, const QObject * receiver, const char * member, const QKeySequence & shortcut = 0 ) [*R=1*] void addAction ( QAction * action ) -QAction * addMenu ( QMenu * menu ) [*D=1;R=1*] +QAction * addMenu ( QMenu * menu ) [*X=1;R=1*] QMenu * addMenu ( const QString & title ) [*R=1*] QMenu * addMenu ( const QIcon & icon, const QString & title ) [*R=1*] @@ -75,7 +75,7 @@ QAction * exec ( const QPoint & p, QAction * action = 0 ) void hideTearOffMenu () QIcon icon () const -QAction * insertMenu ( QAction * before, QMenu * menu ) [*D=2;R=1*] +QAction * insertMenu ( QAction * before, QMenu * menu ) [*X=2;R=1*] QAction * insertSeparator ( QAction * before ) [*R=1*] bool isEmpty () const bool isTearOffEnabled () const diff --git a/harbour/contrib/hbqt/qtgui/qth/QMenuBar.qth b/harbour/contrib/hbqt/qtgui/qth/QMenuBar.qth index edd48f260b..2968c173fa 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QMenuBar.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QMenuBar.qth @@ -42,13 +42,13 @@ QAction * activeAction () const QAction * addAction ( const QString & text ) [*R=1*] QAction * addAction ( const QString & text, const QObject * receiver, const char * member ) [*R=1*] void addAction ( QAction * action ) -QAction * addMenu ( QMenu * menu ) [*D=1;R=1*] +QAction * addMenu ( QMenu * menu ) [*X=1;R=1*] QMenu * addMenu ( const QString & title ) QMenu * addMenu ( const QIcon & icon, const QString & title ) QAction * addSeparator () void clear () // QAction * defaultAction () const -QAction * insertMenu ( QAction * before, QMenu * menu ) [*D=2;R=1*] +QAction * insertMenu ( QAction * before, QMenu * menu ) [*X=2;R=1*] QAction * insertSeparator ( QAction * before ) [*R=1*] bool isDefaultUp () const // OSMenuRef macMenu () diff --git a/harbour/contrib/hbqt/qtgui/qth/QScrollArea.qth b/harbour/contrib/hbqt/qtgui/qth/QScrollArea.qth index f45b150e77..50dd3a086a 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QScrollArea.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QScrollArea.qth @@ -42,7 +42,7 @@ Qt::Alignment alignment () const void ensureVisible ( int x, int y, int xmargin = 50, int ymargin = 50 ) void ensureWidgetVisible ( QWidget * childWidget, int xmargin = 50, int ymargin = 50 ) void setAlignment ( Qt::Alignment ) -void setWidget ( QWidget * widget ) [*D=1*] +void setWidget ( QWidget * widget ) [*X=1*] void setWidgetResizable ( bool resizable ) QWidget * takeWidget () [*A=1*] QWidget * widget () const diff --git a/harbour/contrib/hbqt/qtgui/qth/QStandardItemModel.qth b/harbour/contrib/hbqt/qtgui/qth/QStandardItemModel.qth index 846bb517ca..97e687fec4 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QStandardItemModel.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QStandardItemModel.qth @@ -51,31 +51,31 @@ HB_FUNC( QT_QSTANDARDITEMMODEL ) -void appendColumn ( const QList & items ) [*D=1*] -void appendRow ( const QList & items ) [*D=1*] -void appendRow ( QStandardItem * item ) [*D=1*] +void appendColumn ( const QList & items ) [*X=1*] +void appendRow ( const QList & items ) [*X=1*] +void appendRow ( QStandardItem * item ) [*X=1*] void clear () QList findItems ( const QString & text, Qt::MatchFlags flags = Qt::MatchExactly, int column = 0 ) const QStandardItem * horizontalHeaderItem ( int column ) const QModelIndex indexFromItem ( const QStandardItem * item ) const -void insertColumn ( int column, const QList & items ) [*D=2*] -bool insertColumn ( int column, const QModelIndex & parent = QModelIndex() ) [*D=2*] -void insertRow ( int row, const QList & items ) [*D=2*] -bool insertRow ( int row, const QModelIndex & parent = QModelIndex() ) [*D=2*] -void insertRow ( int row, QStandardItem * item ) [*D=2*] +void insertColumn ( int column, const QList & items ) [*X=2*] +bool insertColumn ( int column, const QModelIndex & parent = QModelIndex() ) [*X=2*] +void insertRow ( int row, const QList & items ) [*X=2*] +bool insertRow ( int row, const QModelIndex & parent = QModelIndex() ) [*X=2*] +void insertRow ( int row, QStandardItem * item ) [*X=2*] QStandardItem * invisibleRootItem () const QStandardItem * item ( int row, int column = 0 ) const QStandardItem * itemFromIndex ( const QModelIndex & index ) const // const QStandardItem * itemPrototype () const void setColumnCount ( int columns ) -void setHorizontalHeaderItem ( int column, QStandardItem * item ) [*D=2*] +void setHorizontalHeaderItem ( int column, QStandardItem * item ) [*X=2*] void setHorizontalHeaderLabels ( const QStringList & labels ) -void setItem ( int row, int column, QStandardItem * item ) [*D=3*] -void setItem ( int row, QStandardItem * item ) [*D=2*] -void setItemPrototype ( const QStandardItem * item ) [*D=1*] +void setItem ( int row, int column, QStandardItem * item ) [*X=3*] +void setItem ( int row, QStandardItem * item ) [*X=2*] +void setItemPrototype ( const QStandardItem * item ) [*X=1*] void setRowCount ( int rows ) void setSortRole ( int role ) -void setVerticalHeaderItem ( int row, QStandardItem * item ) [*D=2*] +void setVerticalHeaderItem ( int row, QStandardItem * item ) [*X=2*] void setVerticalHeaderLabels ( const QStringList & labels ) int sortRole () const QList takeColumn ( int column ) [*A=1*] diff --git a/harbour/contrib/hbqt/qtgui/qth/QStatusBar.qth b/harbour/contrib/hbqt/qtgui/qth/QStatusBar.qth index c256b53616..6fc661698d 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QStatusBar.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QStatusBar.qth @@ -42,8 +42,8 @@ HB_FUNC( QT_QSTATUSBAR ) -void addPermanentWidget ( QWidget * widget, int stretch = 0 ) [*D=1*] -void addWidget ( QWidget * widget, int stretch = 0 ) [*D=1*] +void addPermanentWidget ( QWidget * widget, int stretch = 0 ) [*X=1*] +void addWidget ( QWidget * widget, int stretch = 0 ) [*X=1*] QString currentMessage () const int insertPermanentWidget ( int index, QWidget * widget, int stretch = 0 ) int insertWidget ( int index, QWidget * widget, int stretch = 0 ) diff --git a/harbour/contrib/hbqt/qtgui/qth/QTabWidget.qth b/harbour/contrib/hbqt/qtgui/qth/QTabWidget.qth index c1fd6678e3..fd13a5bf37 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QTabWidget.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QTabWidget.qth @@ -43,8 +43,8 @@ enum TabShape { Rounded, Triangular } -int addTab ( QWidget * page, const QString & label ) [*D=1*] -int addTab ( QWidget * page, const QIcon & icon, const QString & label ) [*D=1*] +int addTab ( QWidget * page, const QString & label ) [*X=1*] +int addTab ( QWidget * page, const QIcon & icon, const QString & label ) [*X=1*] void clear () QWidget * cornerWidget ( Qt::Corner corner = Qt::TopRightCorner ) const int count () const diff --git a/harbour/contrib/hbqt/qtgui/qth/QToolBar.qth b/harbour/contrib/hbqt/qtgui/qth/QToolBar.qth index ad2ccc6115..42f7480fd3 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QToolBar.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QToolBar.qth @@ -57,9 +57,9 @@ void addAction ( QAction * action ) QAction * addAction ( const QString & text ) [*R=1*] QAction * addAction ( const QIcon & icon, const QString & text ) [*R=1*] QAction * addAction ( const QString & text, const QObject * receiver, const char * member ) [*R=1*] -QAction * addAction ( const QIcon & icon, const QString & text, const QObject * receiver, const char * member ) [*D=3;R=1*] +QAction * addAction ( const QIcon & icon, const QString & text, const QObject * receiver, const char * member ) [*X=3;R=1*] QAction * addSeparator () [*R=1*] -QAction * addWidget ( QWidget * widget ) [*D=1;R=1*] +QAction * addWidget ( QWidget * widget ) [*X=1;R=1*] Qt::ToolBarAreas allowedAreas () const void clear () QSize iconSize () const diff --git a/harbour/contrib/hbqt/qtgui/qth/QTreeWidgetItem.qth b/harbour/contrib/hbqt/qtgui/qth/QTreeWidgetItem.qth index 31d66870fa..f27c798351 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QTreeWidgetItem.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QTreeWidgetItem.qth @@ -67,8 +67,8 @@ enum ItemType { Type, UserType } -void addChild ( QTreeWidgetItem * child ) [*D=1*] -void addChildren ( const QList & children ) [*D=1*] +void addChild ( QTreeWidgetItem * child ) [*X=1*] +void addChildren ( const QList & children ) [*X=1*] QBrush background ( int column ) const Qt::CheckState checkState ( int column ) const QTreeWidgetItem * child ( int index ) const diff --git a/harbour/contrib/hbqt/qtgui/qth/QWidget.qth b/harbour/contrib/hbqt/qtgui/qth/QWidget.qth index b4f614071b..5a0221f08a 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QWidget.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QWidget.qth @@ -201,7 +201,7 @@ void setGeometry ( const QRect & ) void setGeometry ( int x, int y, int w, int h ) // void setInputContext ( QInputContext * context ) -void setLayout ( QLayout * layout ) [*D=1*] +void setLayout ( QLayout * layout ) [*X=1*] void setLayoutDirection ( Qt::LayoutDirection direction ) void setLocale ( const QLocale & locale ) diff --git a/harbour/contrib/hbqt/tests/demoqt.prg b/harbour/contrib/hbqt/tests/demoqt.prg index cf07ecd356..6c39fd5e86 100644 --- a/harbour/contrib/hbqt/tests/demoqt.prg +++ b/harbour/contrib/hbqt/tests/demoqt.prg @@ -70,27 +70,31 @@ */ /*----------------------------------------------------------------------*/ -STATIC oSys, oMenuSys, oActShow, oActHide - -/*----------------------------------------------------------------------*/ - -FUNCTION My_Events( oWnd, e ) - MsgInfo( oWnd, "Pressed: " + hb_ntos( e:key() ) ) - RETURN nil +STATIC oSys, oMenuSys, oActShow, oActHide /* To keep variables in scope for entire duration of appn */ /*----------------------------------------------------------------------*/ PROCEDURE Main() - Local oBtn, oDA, oWnd, oSBar, aMenu, aTool, aTabs, oELoop, lExit := .f. + + hbqt_errorsys() + + ExecTheDialog() + + RETURN + +/*----------------------------------------------------------------------*/ + +PROCEDURE ExecTheDialog() + LOCAL oBtn, oDA, oWnd, aMenu, aTool, aTabs, oELoop, lExit := .f. hbqt_errorsys() oWnd := QMainWindow() - oWnd:setAttribute( Qt_WA_DeleteOnClose, .f. ) + oWnd:setAttribute( Qt_WA_DeleteOnClose, .F. ) oWnd:show() oWnd:setMouseTracking( .t. ) - oWnd:setWindowTitle( "Harbour-Qt Implementation Test Dialog" ) + oWnd:setWindowTitle( "[" + hb_ntos( hb_threadID() ) + "] Harbour-Qt" ) oWnd:setWindowIcon( QIcon( "test" ) ) oWnd:resize( 900, 500 ) @@ -100,18 +104,16 @@ PROCEDURE Main() aMenu := Build_MenuBar( oWnd ) aTool := Build_ToolBar( oWnd ) - oSBar := QStatusBar( oWnd ) - oWnd:setStatusBar( oSBar ) - oSBar:showMessage( "Harbour-QT Statusbar Ready!" ) + oWnd:statusBar():showMessage( "Harbour-QT Statusbar Ready!" ) Build_Grid( oDA, { 30, 30 }, { 450,150 } ) Build_ProgressBar( oDA, { 30,300 }, { 200,30 } ) Build_ListBox( oDA, { 310,240 }, { 150, 100 } ) Build_Label( oDA, { 30,190 }, { 300, 30 } ) - aTabs := Build_Tabs( oDA, { 510, 5 }, { 360, 400 } ) + aTabs := Build_Tabs( oDA, { 510, 5 }, { 360, 400 } ) - oBtn := Build_PushButton( oDA, { 30,240 }, { 100,50 } ) + oBtn := Build_PushButton( oDA, { 30,240 }, { 100,50 } ) oBtn:setStyleSheet( "background: #a00fff;" ) oWnd:connect( QEvent_KeyPress, {|e| My_Events( oWnd, e ) } ) @@ -127,12 +129,22 @@ PROCEDURE Main() ENDDO oELoop:exit( 0 ) - HB_TRACE( HB_TR_DEBUG, ".............. E X I T I N G ..................." ) xReleaseMemory( { oBtn, aMenu, aTool, aTabs, oDA, oWnd } ) + + HB_TRACE( HB_TR_DEBUG, " " ) + HB_TRACE( HB_TR_DEBUG, ".............. E X I T I N G ...................", hb_threadID() ) + HB_TRACE( HB_TR_DEBUG, " " ) + RETURN /*----------------------------------------------------------------------*/ +FUNCTION My_Events( oWnd, e ) + MsgInfo( oWnd, "Pressed: " + hb_ntos( e:key() ) ) + RETURN nil + +/*----------------------------------------------------------------------*/ + FUNCTION xReleaseMemory( aObj ) #if 0 LOCAL i @@ -150,61 +162,14 @@ FUNCTION xReleaseMemory( aObj ) /*----------------------------------------------------------------------*/ -PROCEDURE ExecOneMore() - Local oLabel, oBtn, oDA, oWnd, oProg, oSBar - LOCAL aMenu, aTool, aGrid, aTabs, aList, oEventLoop - LOCAL lExit := .f. - - oWnd := QMainWindow() - - oWnd:setMouseTracking( .t. ) - oWnd:setWindowTitle( "Harbour-Qt Implementation Test Dialog" ) - oWnd:setWindowIcon( QIcon( "test" ) ) - oWnd:resize( 900, 500 ) - - oDA := QWidget( oWnd ) - oWnd:setCentralWidget( oDA ) - - oWnd:show() - - aMenu := Build_MenuBar( oWnd ) - aTool := Build_ToolBar( oWnd ) - oLabel := Build_Label( oDA, { 30,190 }, { 300, 30 } ) - aGrid := Build_Grid( oDA, { 30, 30 }, { 450,150 } ) - aTabs := Build_Tabs( oDA, { 510, 5 }, { 360, 400 } ) - oProg := Build_ProgressBar( oDA, { 30,300 }, { 200,30 } ) - aList := Build_ListBox( oDA, { 310,240 }, { 150, 100 } ) - oBtn := Build_PushButton( oDA, { 30,240 }, { 100,50 }, "CLOSE", "This dialog will be closed now!", @lExit ) - - oSBar := QStatusBar( oWnd ) - oWnd:setStatusBar( oSBar ) - oSBar:showMessage( "Harbour-QT Statusbar Ready!" ) - - oEventLoop := QEventLoop( oWnd ) - DO WHILE .t. - oEventLoop:processEvents() - IF lExit - EXIT - ENDIF - ENDDO - oEventLoop:exit( 0 ) - - xReleaseMemory( { oBtn, oLabel, oProg, oSBar, aGrid, aList, aMenu, aTool, aTabs, oDA, oWnd, oEventLoop } ) - HB_TRACE( HB_TR_DEBUG, " " ) - HB_TRACE( HB_TR_DEBUG, ".............. E X I T I N G one more dialog ..................." ) - HB_TRACE( HB_TR_DEBUG, " " ) - - RETURN - -/*----------------------------------------------------------------------*/ - STATIC FUNCTION Build_MenuBar( oWnd ) LOCAL oMenuBar, oMenu1, oMenu2 LOCAL oActNew, oActOpen, oActSave, oActExit LOCAL oActColors, oActFonts, oActPgSetup, oActPreview, oActWiz, oActWeb, oActOther - oMenuBar := QMenuBar( oWnd ) + oMenuBar := oWnd:menuBar() + // F I L E oMenu1 := QMenu( oMenuBar ) oMenu1:setTitle( "&File" ) @@ -229,40 +194,39 @@ STATIC FUNCTION Build_MenuBar( oWnd ) oMenuBar:addMenu( oMenu1 ) + // D I A L O G S oMenu2 := QMenu( oMenuBar ) oMenu2:setTitle( "&Dialogs" ) oActColors := oMenu2:addAction( "&Colors" ) - oActColors:connect( "triggered(bool)", {|w,l| Dialogs( "Colors", w, l ) } ) + oActColors:connect( "triggered(bool)", {|| Dialogs( "Colors", oWnd ) } ) oActFonts := oMenu2:addAction( "&Fonts" ) - oActFonts:connect( "triggered(bool)", {|w,l| Dialogs( "Fonts", w, l ) } ) + oActFonts:connect( "triggered(bool)", {|| Dialogs( "Fonts", oWnd ) } ) oMenu2:addSeparator() oActPgSetup := oMenu2:addAction( "&PageSetup" ) - oActPgSetup:connect( "triggered(bool)", {|w,l| Dialogs( "PageSetup", w, l ) } ) + oActPgSetup:connect( "triggered(bool)", {|| Dialogs( "PageSetup", oWnd ) } ) oActPreview := oMenu2:addAction( "P&review" ) - oActPreview:connect( "triggered(bool)", {|w,l| Dialogs( "Preview", w, l ) } ) + oActPreview:connect( "triggered(bool)", {|| Dialogs( "Preview", oWnd ) } ) oMenu2:addSeparator() oActWiz := oMenu2:addAction( "&Wizard" ) - oActWiz:connect( "triggered(bool)", {|w,l| Dialogs( "Wizard", w, l ) } ) + oActWiz:connect( "triggered(bool)", {|| Dialogs( "Wizard", oWnd ) } ) oActWeb := oMenu2:addAction( "W&ebPage" ) - oActWeb:connect( "triggered(bool)", {|w,l| Dialogs( "WebPage", w, l ) } ) + oActWeb:connect( "triggered(bool)", {|| Dialogs( "WebPage", oWnd ) } ) oMenu2:addSeparator() oActOther := oMenu2:addAction( "&Another Dialog" ) - oActOther:connect( "triggered(bool)", {|| hb_threadStart( {|| ExecOneMore( oWnd ) } ) } ) + oActOther:connect( "triggered(bool)", {|| hb_threadStart( {|| ExecTheDialog( oWnd ) } ) } ) oMenuBar:addMenu( oMenu2 ) - oWnd:setMenuBar( oMenuBar ) - RETURN { oActNew, oActOpen, oActSave, oActExit, oActColors, oActFonts, ; oActPgSetup, oActPreview, oActWiz, oActWeb, oActOther } @@ -366,9 +330,9 @@ STATIC FUNCTION Build_Tabs( oWnd, aPos, aSize ) oTabWidget := QTabWidget( oWnd ) - oTab1 := QWidget() - oTab2 := QWidget() - oTab3 := QWidget() + oTab1 := QWidget( oTabWidget ) + oTab2 := QWidget( oTabWidget ) + oTab3 := QWidget( oTabWidget ) oTabWidget:addTab( oTab1, "Folders" ) oTabWidget:addTab( oTab2, "Controls" ) @@ -385,21 +349,27 @@ STATIC FUNCTION Build_Tabs( oWnd, aPos, aSize ) RETURN { aCtrls } /*----------------------------------------------------------------------*/ - +#if 1 STATIC FUNCTION Build_TreeView( oWnd ) - LOCAL oTV, oDirModel + HB_SYMBOL_UNUSED( oWnd ) + RETURN NIL +#else +STATIC FUNCTION Build_TreeView( oWnd ) + LOCAL oDirModel + LOCAL oTV + + oDirModel := QDirModel( oWnd ) oTV := QTreeView( oWnd ) oTV:setMouseTracking( .t. ) -* oTV:connect( "hovered()", {|i| HB_TRACE( HB_TR_DEBUG, ( "oTV:hovered" ) } ) - oDirModel := QDirModel( oTV ) +// oTV:connect( "hovered()", {|i| HB_TRACE( HB_TR_DEBUG, ( "oTV:hovered" ) } ) oTV:setModel( oDirModel ) oTV:move( 5, 7 ) oTV:resize( 345, 365 ) OTV:show() RETURN NIL - +#endif /*----------------------------------------------------------------------*/ STATIC FUNCTION Build_ListBox( oWnd, aPos, aSize ) @@ -553,6 +523,7 @@ STATIC FUNCTION Dialogs( cType, oParent ) oDlg:setWindowTitle( "Harbour-QT Preview Dialog" ) oDlg:exec() CASE cType == "Wizard" + QMessageBox():critical( oParent, "XXX", "yyy" ) oDlg := QWizard() oDlg:setWindowTitle( "Harbour-QT Wizard to Show Slides etc." ) oDlg:exec()