From 87e60a5b3a2af83a3e66f5201a056785c703c5ec Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Thu, 17 Feb 2011 02:48:16 +0000 Subject: [PATCH] 2011-02-16 18:40 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtgui/qth/QTableWidget.qth * contrib/hbqt/qtgui/qth/QTreeWidget.qth * contrib/hbqt/qtgui/qth/QTreeWidgetItem.qth + Added: [*A=1*] token to methods where ownership is returned back to HVM from Qt object. * contrib/hbqt/hbmk2_qt.hbs + Implemented: protocol to transfer the ownership to free a Qt object to HVM. TODO: spot methods in all .qth files where ownership is switched to application instead of its parent. Speak-out if you find one. --- harbour/ChangeLog | 13 +++++++++++++ harbour/contrib/hbqt/hbmk2_qt.hbs | 16 ++++++++++------ harbour/contrib/hbqt/qtgui/qth/QTableWidget.qth | 6 +++--- harbour/contrib/hbqt/qtgui/qth/QTreeWidget.qth | 2 +- .../contrib/hbqt/qtgui/qth/QTreeWidgetItem.qth | 2 +- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 3c4cf2c5cd..6a829892ab 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,19 @@ The license applies to all entries newer than 2009-04-28. */ +2011-02-16 18:40 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtgui/qth/QTableWidget.qth + * contrib/hbqt/qtgui/qth/QTreeWidget.qth + * contrib/hbqt/qtgui/qth/QTreeWidgetItem.qth + + Added: [*A=1*] token to methods where ownership is + returned back to HVM from Qt object. + * contrib/hbqt/hbmk2_qt.hbs + + Implemented: protocol to transfer the ownership to free + a Qt object to HVM. + TODO: spot methods in all .qth files where ownership + is switched to application instead of its parent. + Speak-out if you find one. + 2011-02-16 17:02 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtgui/qth/HBQPlainTextEdit.qth ! Fix: optional parameter was not properly laid. diff --git a/harbour/contrib/hbqt/hbmk2_qt.hbs b/harbour/contrib/hbqt/hbmk2_qt.hbs index 10a0bf92fe..1caa145ab4 100644 --- a/harbour/contrib/hbqt/hbmk2_qt.hbs +++ b/harbour/contrib/hbqt/hbmk2_qt.hbs @@ -1595,14 +1595,14 @@ METHOD HbQtSource:buildMethodBody( oMtd ) ELSE FP := oMtd:cCmd ENDIF - // + + /* Manage Re-Attached */ + IF oMtd:nAttach > 0 + FP := strtran( FP, ", false", ", true" ) + ENDIF + /* Manage detached Argument */ IF oMtd:nDetach > 0 - #if 0 - aadd( ::txt_, " HBQT_GC_T * q = ( HBQT_GC_T * ) hb_parptrGC( hbqt_gcFuncs(), " + hb_ntos( oMtd:nDetach + 1 ) + " );" ) - aadd( ::txt_, " if( q && q->ph )" ) - aadd( ::txt_, " q->bNew = false;" ) - #endif aadd( ::txt_, " hbqt_detachgcpointer( " + hb_ntos( oMtd:nDetach + 1 ) + " );" ) ENDIF @@ -2200,6 +2200,9 @@ METHOD HbQtSource:parseProto( cProto, fBody_ ) CASE "D" oMtd:nDetach := val( cVal ) EXIT + CASE "A" + oMtd:nAttach := val( cVal ) + EXIT CASE "xxx" EXIT ENDSWITCH @@ -2675,6 +2678,7 @@ CREATE CLASS HbqtMethod DATA cMrk INIT "" // ^^^ DATA nDetach INIT 0 + DATA nAttach INIT 0 DATA cFun INIT "" DATA cRet INIT "" diff --git a/harbour/contrib/hbqt/qtgui/qth/QTableWidget.qth b/harbour/contrib/hbqt/qtgui/qth/QTableWidget.qth index c4a720263e..d1da600437 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QTableWidget.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QTableWidget.qth @@ -70,9 +70,9 @@ void setRowCount ( int rows ) void setVerticalHeaderItem ( int row, QTableWidgetItem * item ) [*D=2*] void setVerticalHeaderLabels ( const QStringList & labels ) void sortItems ( int column, Qt::SortOrder order = Qt::AscendingOrder ) -QTableWidgetItem * takeHorizontalHeaderItem ( int column ) -QTableWidgetItem * takeItem ( int row, int column ) -QTableWidgetItem * takeVerticalHeaderItem ( int row ) +QTableWidgetItem * takeHorizontalHeaderItem ( int column ) [*A=1*] +QTableWidgetItem * takeItem ( int row, int column ) [*A=1*] +QTableWidgetItem * takeVerticalHeaderItem ( int row ) [*A=1*] QTableWidgetItem * verticalHeaderItem ( int row ) const int visualColumn ( int logicalColumn ) const QRect visualItemRect ( const QTableWidgetItem * item ) const diff --git a/harbour/contrib/hbqt/qtgui/qth/QTreeWidget.qth b/harbour/contrib/hbqt/qtgui/qth/QTreeWidget.qth index 04410550e3..3b89b03e67 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QTreeWidget.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QTreeWidget.qth @@ -64,7 +64,7 @@ void setHeaderLabels ( const QStringList & labels ) void setItemWidget ( QTreeWidgetItem * item, int column, QWidget * widget ) int sortColumn () const void sortItems ( int column, Qt::SortOrder order ) -QTreeWidgetItem * takeTopLevelItem ( int index ) +QTreeWidgetItem * takeTopLevelItem ( int index ) [*A=1*] QTreeWidgetItem * topLevelItem ( int index ) const int topLevelItemCount () const QRect visualItemRect ( const QTreeWidgetItem * item ) const diff --git a/harbour/contrib/hbqt/qtgui/qth/QTreeWidgetItem.qth b/harbour/contrib/hbqt/qtgui/qth/QTreeWidgetItem.qth index cca1ed6262..afa43736fb 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QTreeWidgetItem.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QTreeWidgetItem.qth @@ -98,7 +98,7 @@ void setWhatsThis ( int column, const QString & whatsThis ) QSize sizeHint ( int column ) const void sortChildren ( int column, Qt::SortOrder order ) QString statusTip ( int column ) const -QTreeWidgetItem * takeChild ( int index ) +QTreeWidgetItem * takeChild ( int index ) [*A=1*] QList takeChildren () QString text ( int column ) const int textAlignment ( int column ) const