From 37a107dcf9b4e3c18864f75c5b985a511c87cff2 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Fri, 18 May 2012 01:59:52 +0000 Subject: [PATCH] 2012-05-17 14:07 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/hbmk2_qt.hb ! Fix to last fix. * contrib/hbqt/qtgui/qth/QListWidget.qth * contrib/hbqt/qtgui/qth/QMainWindow.qth + Added: attach/detach/return_not_new tags. [*D=n;A=n;R=n*] * contrib/hbqt/tests/demoqt.prg ! On path to prevent memory leaks. Please investigate the code changes and you will know how many objects were been around without any mechanism to free them. You can take help of Qt documentation. ; NOTE: currently demoqt.prg is the test bed for oncoming GC related changes. * contrib/hbide/hbqreportsmanager.prg * contrib/hbide/hbqtoolbar.prg * contrib/hbide/idebrowse.prg * contrib/hbide/ideeditor.prg * contrib/hbide/ideharbourhelp.prg ! On path to preparation for memory leakage. ; WARNING: hbIDE is not at stable stage present. ; I always wondered why memory consumption goes on increasing with time application written with hbQT. Now I have the answer, and hopefully in few coming days a great amount of them will be covered. --- harbour/ChangeLog | 32 +++++ harbour/contrib/hbide/hbqreportsmanager.prg | 26 ++-- harbour/contrib/hbide/hbqtoolbar.prg | 10 +- harbour/contrib/hbide/idebrowse.prg | 73 ++++++---- harbour/contrib/hbide/ideeditor.prg | 127 +++++++++--------- harbour/contrib/hbide/ideharbourhelp.prg | 8 +- harbour/contrib/hbqt/hbmk2_qt.hb | 10 +- .../contrib/hbqt/qtgui/qth/QListWidget.qth | 2 +- .../contrib/hbqt/qtgui/qth/QMainWindow.qth | 4 +- harbour/contrib/hbqt/tests/demoqt.prg | 27 ++-- 10 files changed, 191 insertions(+), 128 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 8275f335e7..11157ee757 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,38 @@ The license applies to all entries newer than 2009-04-28. */ +2012-05-17 14:07 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/hbmk2_qt.hb + ! Fix to last fix. + + * contrib/hbqt/qtgui/qth/QListWidget.qth + * contrib/hbqt/qtgui/qth/QMainWindow.qth + + Added: attach/detach/return_not_new tags. + [*D=n;A=n;R=n*] + + * contrib/hbqt/tests/demoqt.prg + ! On path to prevent memory leaks. + Please investigate the code changes and you will know + how many objects were been around without any mechanism + to free them. You can take help of Qt documentation. + + ; NOTE: currently demoqt.prg is the test bed for oncoming + GC related changes. + + * contrib/hbide/hbqreportsmanager.prg + * contrib/hbide/hbqtoolbar.prg + * contrib/hbide/idebrowse.prg + * contrib/hbide/ideeditor.prg + * contrib/hbide/ideharbourhelp.prg + ! On path to preparation for memory leakage. + + ; WARNING: hbIDE is not at stable stage present. + + ; I always wondered why memory consumption goes on increasing + with time application written with hbQT. Now I have the answer, + and hopefully in few coming days a great amount of them will be + covered. + 2012-05-17 14:07 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/hbmk2_qt.hb + Implemented: detach a returned object of a method where parent diff --git a/harbour/contrib/hbide/hbqreportsmanager.prg b/harbour/contrib/hbide/hbqreportsmanager.prg index 312462ef64..9a72f42bff 100644 --- a/harbour/contrib/hbide/hbqreportsmanager.prg +++ b/harbour/contrib/hbide/hbqreportsmanager.prg @@ -1256,19 +1256,19 @@ METHOD HbqReportsManager:buildToolbar() qTBar:orientation := Qt_Horizontal qTBar:create( "ReportManager_Top_Toolbar" ) - qTBar:addToolButton( "New" , "New Report" , app_image( "new" ), {|| ::execEvent( "buttonNew_clicked" ) } ) - qTBar:addToolButton( "Open" , "Open Report" , app_image( "open3" ), {|| ::execEvent( "buttonOpen_clicked" ) } ) - qTBar:addToolButton( "Save" , "Save Report" , app_image( "save3" ), {|| ::execEvent( "buttonSave_clicked" ) } ) - qTBar:addToolButton( "Close" , "Close Report" , app_image( "close3" ), {|| ::execEvent( "buttonClose_clicked" ) } ) - qTBar:addToolButton( "Print" , "Print Report" , app_image( "print" ), {|| ::execEvent( "buttonPrint_clicked" ) } ) - qTBar:addSeparator() - qTBar:addToolButton( "ToBack" , "Push to back" , app_image( "toback" ), {|| ::execEvent( "buttonToBack_clicked" ) }, .f., .f. ) - qTBar:addToolButton( "ToFront" , "Bring to front" , app_image( "tofront" ), {|| ::execEvent( "buttonToFront_clicked" ) }, .f., .f. ) - qTBar:addSeparator() - qTBar:addToolButton( "RotateL" , "Rotate anti-clock wise", app_image( "unload_1" ), {|| ::execEvent( "buttonRotateL_clicked" ) }, .f., .f. ) - qTBar:addToolButton( "RotateR" , "Rotate clock wise" , app_image( "load_1" ), {|| ::execEvent( "buttonRotateR_clicked" ) }, .f., .f. ) - qTBar:addSeparator() - qTBar:addToolButton( "Portrait" , "Portrait orientation" , app_image( "r-portrait" ), {|| ::execEvent( "buttonPortrait_clicked" ) }, .f., .f. ) + qTBar:addToolButton( "New" , "New Report" , app_image( "new" ), {|| ::execEvent( "buttonNew_clicked" ) } ) + qTBar:addToolButton( "Open" , "Open Report" , app_image( "open3" ), {|| ::execEvent( "buttonOpen_clicked" ) } ) + qTBar:addToolButton( "Save" , "Save Report" , app_image( "save3" ), {|| ::execEvent( "buttonSave_clicked" ) } ) + qTBar:addToolButton( "Close" , "Close Report" , app_image( "close3" ), {|| ::execEvent( "buttonClose_clicked" ) } ) + qTBar:addToolButton( "Print" , "Print Report" , app_image( "print" ), {|| ::execEvent( "buttonPrint_clicked" ) } ) + qTBar:addSeparator() + qTBar:addToolButton( "ToBack" , "Push to back" , app_image( "toback" ), {|| ::execEvent( "buttonToBack_clicked" ) }, .f., .f. ) + qTBar:addToolButton( "ToFront" , "Bring to front" , app_image( "tofront" ), {|| ::execEvent( "buttonToFront_clicked" ) }, .f., .f. ) + qTBar:addSeparator() + qTBar:addToolButton( "RotateL" , "Rotate anti-clock wise", app_image( "unload_1" ), {|| ::execEvent( "buttonRotateL_clicked" ) }, .f., .f. ) + qTBar:addToolButton( "RotateR" , "Rotate clock wise" , app_image( "load_1" ), {|| ::execEvent( "buttonRotateR_clicked" ) }, .f., .f. ) + qTBar:addSeparator() + qTBar:addToolButton( "Portrait" , "Portrait orientation" , app_image( "r-portrait" ), {|| ::execEvent( "buttonPortrait_clicked" ) }, .f., .f. ) qTBar:addToolButton( "Landscape", "Landscape orientation" , app_image( "r-landscape" ), {|| ::execEvent( "buttonLandscape_clicked" ) }, .f., .f. ) qTBar:addSeparator() diff --git a/harbour/contrib/hbide/hbqtoolbar.prg b/harbour/contrib/hbide/hbqtoolbar.prg index 119b1de1fc..90bc41fedf 100644 --- a/harbour/contrib/hbide/hbqtoolbar.prg +++ b/harbour/contrib/hbide/hbqtoolbar.prg @@ -77,6 +77,7 @@ CLASS HbqToolbar DATA cName DATA oParent DATA hItems INIT {=>} + DATA hActions INIT {=>} DATA allowedAreas INIT Qt_TopToolBarArea DATA initialArea INIT Qt_TopToolBarArea @@ -182,6 +183,8 @@ METHOD HbqToolbar:destroy() ::qByte := NIL ::oWidget := NIL + ::hActions := NIL + RETURN Self /*----------------------------------------------------------------------*/ @@ -247,13 +250,14 @@ METHOD HbqToolbar:addWidget( cName, qWidget ) ::oWidget:addAction( qAction ) ::hItems[ cName ] := qWidget + ::hActions[ cName ] := qAction RETURN Self /*----------------------------------------------------------------------*/ METHOD HbqToolbar:addToolButton( cName, cDesc, cImage, bAction, lCheckable, lDragEnabled ) - LOCAL oButton + LOCAL oButton, oActBtn DEFAULT cName TO hbide_getNextIDasString( "IdeToolButton" ) DEFAULT cDesc TO "" @@ -277,9 +281,11 @@ METHOD HbqToolbar:addToolButton( cName, cDesc, cImage, bAction, lCheckable, lDra IF hb_isBlock( bAction ) oButton:connect( "clicked()", bAction ) ENDIF - ::oWidget:addWidget( oButton ) + oActBtn := ::oWidget:addWidget( oButton ) ::hItems[ cName ] := oButton + ::hActions[ cName ] := oActBtn + RETURN oButton /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbide/idebrowse.prg b/harbour/contrib/hbide/idebrowse.prg index c817998538..a2d5cad2c7 100644 --- a/harbour/contrib/hbide/idebrowse.prg +++ b/harbour/contrib/hbide/idebrowse.prg @@ -142,7 +142,8 @@ CLASS IdeBrowseManager INHERIT IdeObject DATA lStructOpen INIT .f. DATA lDeletedOn INIT .t. - + DATA qComboAction + METHOD new( oIde ) METHOD create( oIde ) METHOD show() @@ -987,7 +988,9 @@ METHOD IdeBrowseManager:addArray( aData, aAttr ) METHOD IdeBrowseManager:buildToolbar() LOCAL nW := 25 - +#if 0 + LOCAL qTBar +#endif STATIC sp0,sp1,sp2,sp3 IF empty( sp0 ) @@ -997,6 +1000,27 @@ METHOD IdeBrowseManager:buildToolbar() sp3 := QLabel(); sp3:setMinimumWidth( nW ) ENDIF +#if 0 + qTBar := HbqToolbar():new() + qTBar:orientation := Qt_Horizontal + qTBar:setIconSize( QSize( 16,16 ) ) + + + qTBar:addToolButton( "Open" , "Open a table" , app_image( "open3" ), {|| ::execEvent( "buttonOpen_clicked" ) }, .f. } ) + + qTBar:addToolButton( "Toggle" , "Show/hide form view", app_image( "formview" ), {|| ::execEvent( "buttonShowForm_clicked" ) }, .t. } ) + + qTBar:addToolButton( "Structure", "Table Structure" , app_image( "dbstruct" ), {|| ::execEvent( "buttonDbStruct_clicked" ) }, .f. } ) + + + qTBar:addToolButton( "Search" , "Search in table" , app_image( "find" ), {|| ::execEvent( "buttonFind_clicked" ) }, .f. } ) + qTBar:addToolButton( "Goto" , "Goto record" , app_image( "gotoline3" ), {|| ::execEvent( "buttonGoto_clicked" ) }, .f. } ) + + qTBar:addToolButton( "Close" , "Close current table", app_image( "dc_delete" ), {|| ::execEvent( "buttonClose_clicked" ) }, .f. } ) + + + ::qToolbar := qTBar +#else ::qToolbar := QToolbar() ::qToolbar:setIconSize( QSize( 16,16 ) ) ::qToolbar:setStyleSheet( GetStyleSheet( "QToolBar", ::nAnimantionMode ) ) @@ -1018,6 +1042,7 @@ METHOD IdeBrowseManager:buildToolbar() ::buildToolButton( ::qToolbar, { "Close current table", "dc_delete" , {|| ::execEvent( "buttonClose_clicked" ) }, .f. } ) ::qToolbar:addWidget( sp3 ) ::buildTablesButton() +#endif RETURN Self @@ -1100,27 +1125,6 @@ METHOD IdeBrowseManager:buildConxnCombo() /*----------------------------------------------------------------------*/ -METHOD IdeBrowseManager:loadConxnCombo( cDriver ) - LOCAL aConxns, cConxn, a_ - - DEFAULT cDriver TO ::currentDriver() - - ::aConxns := {} - - IF !empty( aConxns := hbide_execScriptFunction( "connections", cDriver ) ) - aeval( aConxns, {|e| aadd( ::aConxns, e ) } ) - ENDIF - - ::qConxnCombo:clear() - FOR EACH cConxn IN ::aConxns - a_:= hb_aTokens( cConxn, ";" ) - ::qConxnCombo:addItem( alltrim( a_[ 1 ] ) ) - NEXT - - RETURN Self - -/*----------------------------------------------------------------------*/ - METHOD IdeBrowseManager:buildRddsCombo() LOCAL aRdds, cRdd @@ -1134,7 +1138,7 @@ METHOD IdeBrowseManager:buildRddsCombo() cRdd := alltrim( cRdd ) ::qRddCombo:addItem( cRdd ) NEXT - ::qToolBar:addWidget( ::qRddCombo ) + ::qComboAction := ::qToolBar:addWidget( ::qRddCombo ) ::qRddCombo:connect( "currentIndexChanged(QString)", {|p| ::loadConxnCombo( p ) } ) @@ -1180,6 +1184,27 @@ METHOD IdeBrowseManager:buildIndexButton() /*----------------------------------------------------------------------*/ +METHOD IdeBrowseManager:loadConxnCombo( cDriver ) + LOCAL aConxns, cConxn, a_ + + DEFAULT cDriver TO ::currentDriver() + + ::aConxns := {} + + IF !empty( aConxns := hbide_execScriptFunction( "connections", cDriver ) ) + aeval( aConxns, {|e| aadd( ::aConxns, e ) } ) + ENDIF + + ::qConxnCombo:clear() + FOR EACH cConxn IN ::aConxns + a_:= hb_aTokens( cConxn, ";" ) + ::qConxnCombo:addItem( alltrim( a_[ 1 ] ) ) + NEXT + + RETURN Self + +/*----------------------------------------------------------------------*/ + STATIC FUNCTION hbide_getMenuBlock( oPanel, oBrw, cIndex ) RETURN {|| oPanel:setIndex( oBrw, cIndex ) } diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index f58c9f4561..8074744801 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -1359,13 +1359,7 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView, a ::qLayout:setContentsMargins( 0,0,0,0 ) // ::oTab:oWidget:setLayout( ::qLayout ) - - ::qHSpltr := QSplitter() - ::qHSpltr:setOrientation( Qt_Horizontal ) - - ::qVSpltr := QSplitter() - ::qVSpltr:setOrientation( Qt_Vertical ) - + ::oEdit := IdeEdit():new( ::oIde, Self, 0 ) ::oEdit:aBookMarks := aBookMarks ::oEdit:create() @@ -1400,6 +1394,66 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme, cView, a /*----------------------------------------------------------------------*/ +METHOD IdeEditor:destroy() + LOCAL n, oEdit + + HB_TRACE( HB_TR_DEBUG, "..........................................................IdeEditor:destroy()", 0 ) + + ::oEdit:qEdit:disconnect( "updateRequest(QRect,int)" ) + + IF !empty( ::qTimerSave ) + ::qTimerSave:disconnect( "timeout()" ) + ::qTimerSave:stop() + ::qTimerSave := NIL + ENDIF + /* This code is reached under normal circumstances, so delete auto saved file */ + ferase( hbide_pathToOSPath( ::cPath + ::cFile + ::cExt + ".tmp" ) ) + +// ::qHiliter := NIL + + ::qCqEdit := NIL + ::qCoEdit := NIL + ::qEdit := NIL + + DO WHILE len( ::aEdits ) > 0 + oEdit := ::aEdits[ 1 ] + hb_adel( ::aEdits, 1, .t. ) + oEdit:destroy() + ENDDO + ::oEdit:destroy() + + IF !Empty( ::qDocument ) + ::qDocument := NIL + ENDIF + + IF !Empty( ::qHiliter ) + ::qHiliter := NIL + ENDIF + + ::qSplitter := NIL + ::oEdit := NIL + ::qLayout := NIL + + IF ( n := ascan( ::aTabs, {|e_| e_[ TAB_OEDITOR ] == Self } ) ) > 0 + hb_adel( ::oIde:aTabs, n, .T. ) + ENDIF + + ::oEM:removeSourceInTree( ::sourceFile ) + + ::qTabWidget:removeTab( ::qTabWidget:indexOf( ::oTab:oWidget ) ) + ::oTab := NIL + + IF ::qTabWidget:count() == 0 + IF ::lDockRVisible + ::oFuncDock:hide() + ::oIde:lDockRVisible := .f. + ENDIF + ENDIF + HB_TRACE( HB_TR_DEBUG, "................................................................IdeEditor:destroy()", 1 ) + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeEditor:relay( oEdit ) LOCAL oEdt @@ -1458,65 +1512,6 @@ METHOD IdeEditor:split( nOrient, oEditP ) /*----------------------------------------------------------------------*/ -METHOD IdeEditor:destroy() - LOCAL n, oEdit - - HB_TRACE( HB_TR_DEBUG, "..........................................................IdeEditor:destroy()", 0 ) - - ::oEdit:qEdit:disconnect( "updateRequest(QRect,int)" ) - - IF !empty( ::qTimerSave ) - ::qTimerSave:disconnect( "timeout()" ) - ::qTimerSave:stop() - ::qTimerSave := NIL - ENDIF - /* This code is reached under normal circumstances, so delete auto saved file */ - ferase( hbide_pathToOSPath( ::cPath + ::cFile + ::cExt + ".tmp" ) ) - - ::qHiliter := NIL - - ::qCqEdit := NIL - ::qCoEdit := NIL - ::qEdit := NIL - - DO WHILE len( ::aEdits ) > 0 - oEdit := ::aEdits[ 1 ] - hb_adel( ::aEdits, 1, .t. ) - oEdit:destroy() - ENDDO - ::oEdit:destroy() - - IF !Empty( ::qDocument ) - ::qDocument := NIL - ENDIF - - IF !Empty( ::qHiliter ) - ::qHiliter := NIL - ENDIF - - ::oEdit := NIL - ::qLayout := NIL - - IF ( n := ascan( ::aTabs, {|e_| e_[ TAB_OEDITOR ] == Self } ) ) > 0 - hb_adel( ::oIde:aTabs, n, .T. ) - ENDIF - - ::oEM:removeSourceInTree( ::sourceFile ) - - ::qTabWidget:removeTab( ::qTabWidget:indexOf( ::oTab:oWidget ) ) - ::oTab := NIL - - IF ::qTabWidget:count() == 0 - IF ::lDockRVisible - ::oFuncDock:hide() - ::oIde:lDockRVisible := .f. - ENDIF - ENDIF - HB_TRACE( HB_TR_DEBUG, "................................................................IdeEditor:destroy()", 1 ) - RETURN Self - -/*----------------------------------------------------------------------*/ - METHOD IdeEditor:prepareBufferToSave( cBuffer ) LOCAL cE, cEOL, a_, s diff --git a/harbour/contrib/hbide/ideharbourhelp.prg b/harbour/contrib/hbide/ideharbourhelp.prg index 60c938473a..79f6c37dbd 100644 --- a/harbour/contrib/hbide/ideharbourhelp.prg +++ b/harbour/contrib/hbide/ideharbourhelp.prg @@ -685,8 +685,8 @@ METHOD IdeHarbourHelp:refreshDocTree() RETURN Self ENDIF - ::oUI:q_treeDoc:disconnect( "itemSelectionChanged()" ) - ::oUI:q_treeCategory:disconnect( "itemSelectionChanged()" ) + //::oUI:q_treeDoc:disconnect( "itemSelectionChanged()" ) + //::oUI:q_treeCategory:disconnect( "itemSelectionChanged()" ) ::showApplicationCursor( Qt_BusyCursor ) /* Clean Environment */ @@ -764,8 +764,8 @@ METHOD IdeHarbourHelp:refreshDocTree() ::oUI:q_treeDoc:expandItem( oRoot ) ::showApplicationCursor() - ::oUI:q_treeDoc:connect( "itemSelectionChanged()" , {|| ::execEvent( "treeDoc_itemSelectionChanged" ) } ) - ::oUI:q_treeCategory:connect( "itemSelectionChanged()" , {|| ::execEvent( "treeCategory_itemSelectionChanged" ) } ) + //::oUI:q_treeDoc:connect( "itemSelectionChanged()" , {|| ::execEvent( "treeDoc_itemSelectionChanged" ) } ) + //::oUI:q_treeCategory:connect( "itemSelectionChanged()" , {|| ::execEvent( "treeCategory_itemSelectionChanged" ) } ) RETURN Self diff --git a/harbour/contrib/hbqt/hbmk2_qt.hb b/harbour/contrib/hbqt/hbmk2_qt.hb index 56b0a4b4ec..deef4b6f03 100644 --- a/harbour/contrib/hbqt/hbmk2_qt.hb +++ b/harbour/contrib/hbqt/hbmk2_qt.hb @@ -2929,7 +2929,7 @@ METHOD HbQtSource:buildCppCode( oMtd ) CASE oRet:lFar .AND. ! oRet:lConst cRef := oRet:cCast //oMtd:cCmd := hbqtgen_Get_Command( oRet:cCast, oMtd:cCmn, .F. ) - oMtd:cCmd := hbqtgen_Get_Command( oRet:cCast, oMtd:cCmn, oMtd:nDetachRet > 0 ) + oMtd:cCmd := hbqtgen_Get_Command( oRet:cCast, oMtd:cCmn, .F., oMtd:nDetachRet > 0 ) oMtd:cPrgRet := "o" + oMtd:cDocNMRet CASE hbqtgen_isAqtObject( oRet:cCast ) .AND. ; @@ -3171,16 +3171,20 @@ STATIC FUNCTION hbqtgen_Get_Command_1( cWgt, cCmn ) /*----------------------------------------------------------------------*/ -STATIC FUNCTION hbqtgen_Get_Command( cWgt, cCmn, lNew ) +STATIC FUNCTION hbqtgen_Get_Command( cWgt, cCmn, lNew, isRetDetached ) IF lNew == NIL lNew := .T. ENDIF + IF isRetDetached == NIL + isRetDetached := .f. + ENDIF IF lNew RETURN "hbqt_create_objectGC( hbqt_gcAllocate_" + cWgt + "( new " + cWgt + "( " + cCmn + " ), true ) , " + '"HB_' + Upper( cWgt ) +'" )' ELSE - RETURN "hbqt_create_objectGC( hbqt_gcAllocate_" + cWgt + "( " + cCmn + ", false ) , " + '"HB_' + Upper( cWgt ) +'" )' + RETURN "hbqt_create_objectGC( hbqt_gcAllocate_" + cWgt + "( " + cCmn + ", " + iif( isRetDetached, "true", "false" ) + " ) , " + '"HB_' + Upper( cWgt ) +'" )' + //RETURN "hbqt_create_objectGC( hbqt_gcAllocate_" + cWgt + "( " + cCmn + ", " + iif( isRetDetached, "false", "false" ) + " ) , " + '"HB_' + Upper( cWgt ) +'" )' ENDIF RETURN "" diff --git a/harbour/contrib/hbqt/qtgui/qth/QListWidget.qth b/harbour/contrib/hbqt/qtgui/qth/QListWidget.qth index 3f00e65409..c971042639 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QListWidget.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QListWidget.qth @@ -74,7 +74,7 @@ void setCurrentRow ( int row, QItemSelectionModel::SelectionFlags command ) void setItemWidget ( QListWidgetItem * item, QWidget * widget ) void setSortingEnabled ( bool enable ) void sortItems ( Qt::SortOrder order = Qt::AscendingOrder ) -QListWidgetItem * takeItem ( int row ) +QListWidgetItem * takeItem ( int row ) QRect visualItemRect ( const QListWidgetItem * item ) const diff --git a/harbour/contrib/hbqt/qtgui/qth/QMainWindow.qth b/harbour/contrib/hbqt/qtgui/qth/QMainWindow.qth index 837cab3013..d2770db991 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QMainWindow.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QMainWindow.qth @@ -72,8 +72,8 @@ 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 ) -void addToolBar ( QToolBar * toolbar ) +void addToolBar ( Qt::ToolBarArea area, QToolBar * toolbar ) [*D=2*] +void addToolBar ( QToolBar * toolbar ) [*D=1*] QToolBar * addToolBar ( const QString & title ) // NOT implemented void addToolBarBreak ( Qt::ToolBarArea area = Qt::TopToolBarArea ) QWidget * centralWidget () const diff --git a/harbour/contrib/hbqt/tests/demoqt.prg b/harbour/contrib/hbqt/tests/demoqt.prg index 5150349338..c4b78b59cf 100644 --- a/harbour/contrib/hbqt/tests/demoqt.prg +++ b/harbour/contrib/hbqt/tests/demoqt.prg @@ -197,9 +197,10 @@ PROCEDURE ExecOneMore() /*----------------------------------------------------------------------*/ STATIC FUNCTION Build_MenuBar( oWnd ) - LOCAL oMenuBar, oMenu1, oMenu2 + LOCAL oMenuBar, oMenu1, oMenu2, oAM1, oAM2 LOCAL oActNew, oActOpen, oActSave, oActExit LOCAL oActColors, oActFonts, oActPgSetup, oActPreview, oActWiz, oActWeb, oActOther + LOCAL oS1, oS2, oS3, oS4, oS5 oMenuBar := QMenuBar() oMenuBar:resize( oWnd:width(), 25 ) @@ -217,17 +218,17 @@ STATIC FUNCTION Build_MenuBar( oWnd ) oActOpen := oMenu1:addAction( hb_dirBase() + "open.png", "&Open" ) oActOpen:connect( "triggered(bool)", {|w,l| FileDialog( "Open" , w, l ) } ) - oMenu1:addSeparator() + oS1 := oMenu1:addSeparator() oActSave := oMenu1:addAction( hb_dirBase() + "save.png", "&Save" ) oActSave:connect( "triggered(bool)", {|w,l| FileDialog( "Save" , w, l ) } ) - oMenu1:addSeparator() + oS2 := oMenu1:addSeparator() oActExit := oMenu1:addAction( "E&xit" ) oActExit:connect( "triggered(bool)", {|| QApplication():quit() } ) - oMenuBar:addMenu( oMenu1 ) + oAM1 := oMenuBar:addMenu( oMenu1 ) oMenu2 := QMenu() oMenu2:setTitle( "&Dialogs" ) @@ -238,7 +239,7 @@ STATIC FUNCTION Build_MenuBar( oWnd ) oActFonts := oMenu2:addAction( "&Fonts" ) oActFonts:connect( "triggered(bool)", {|w,l| Dialogs( "Fonts", w, l ) } ) - oMenu2:addSeparator() + oS3 := oMenu2:addSeparator() oActPgSetup := oMenu2:addAction( "&PageSetup" ) oActPgSetup:connect( "triggered(bool)", {|w,l| Dialogs( "PageSetup", w, l ) } ) @@ -246,7 +247,7 @@ STATIC FUNCTION Build_MenuBar( oWnd ) oActPreview := oMenu2:addAction( "P&review" ) oActPreview:connect( "triggered(bool)", {|w,l| Dialogs( "Preview", w, l ) } ) - oMenu2:addSeparator() + oS4 := oMenu2:addSeparator() oActWiz := oMenu2:addAction( "&Wizard" ) oActWiz:connect( "triggered(bool)", {|w,l| Dialogs( "Wizard", w, l ) } ) @@ -254,22 +255,23 @@ STATIC FUNCTION Build_MenuBar( oWnd ) oActWeb := oMenu2:addAction( "W&ebPage" ) oActWeb:connect( "triggered(bool)", {|w,l| Dialogs( "WebPage", w, l ) } ) - oMenu2:addSeparator() + oS5 := oMenu2:addSeparator() oActOther := oMenu2:addAction( "&Another Dialog" ) oActOther:connect( "triggered(bool)", {|| ExecOneMore() } ) - oMenuBar:addMenu( oMenu2 ) + oAM2 := oMenuBar:addMenu( oMenu2 ) oWnd:setMenuBar( oMenuBar ) RETURN { oMenu1, oMenu2, oMenuBar, oActNew, oActOpen, oActSave, oActExit, ; - oActColors, oActFonts, oActPgSetup, oActPreview, oActWiz, oActWeb, oActOther } + oActColors, oActFonts, oActPgSetup, oActPreview, oActWiz, oActWeb, ; + oActOther, oS1, oS2, oS3, oS4, oS5, oAM1, oAM2 } /*----------------------------------------------------------------------*/ STATIC FUNCTION Build_ToolBar( oWnd ) - LOCAL oTB, oActNew, oActOpen, oActSave + LOCAL oTB, oActNew, oActOpen, oActSave, oS1 /* Create a Toolbar Object */ oTB := QToolBar() @@ -280,7 +282,6 @@ STATIC FUNCTION Build_ToolBar( oWnd ) oActNew:setIcon( hb_dirBase() + "new.png" ) oActNew:setToolTip( "A New File" ) oActNew:connect( "triggered(bool)", {|w,l| FileDialog( "New" , w, l ) } ) - /* Attach Action with Toolbar */ oTB:addAction( oActNew ) @@ -293,7 +294,7 @@ STATIC FUNCTION Build_ToolBar( oWnd ) /* Attach Action with Toolbar */ oTB:addAction( oActOpen ) - oTB:addSeparator() + oS1 := oTB:addSeparator() /* Create another action */ oActSave := QAction( oWnd ) @@ -307,7 +308,7 @@ STATIC FUNCTION Build_ToolBar( oWnd ) /* Add this toolbar with main window */ oWnd:addToolBar( oTB ) - RETURN { oActNew, oActOpen, oActSave, oTB } + RETURN { oActNew, oActOpen, oActSave, oTB, oS1 } /*----------------------------------------------------------------------*/