diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 768302443d..8275f335e7 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,25 @@ 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 + + Implemented: detach a returned object of a method where parent + do not retain the ownership of the child with itself. In that case + Harbour has to delete it explicitly. This can be activated with + [*R=1*] tag postfixing the method call in relevant .qth. + + EXAMPLE: QToolBar():addAction( cText ) + + * contrib/hbqt/qtgui/qth/QMenu.qth + * contrib/hbqt/qtgui/qth/QMenuBar.qth + * contrib/hbqt/qtgui/qth/QToolBar.qth + + Added: [*R=1*] tags whereever necessary. + + ; NOTE: I have tried with QAction() only to locate where it is + returned as a not-owned object. Please dig into Qt documentation + to find the other occurances. I know it is a tedious job, but + we have to do it anyway, which me alone cannot achieve. + 2012-05-17 23:08 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * harbour/include/hbgtinfo.ch + added new HB_GTI_FONTATTRIBUTE value: HB_GTI_FONTA_CTRLCHARS diff --git a/harbour/contrib/hbqt/hbmk2_qt.hb b/harbour/contrib/hbqt/hbmk2_qt.hb index a5288e7a61..56b0a4b4ec 100644 --- a/harbour/contrib/hbqt/hbmk2_qt.hb +++ b/harbour/contrib/hbqt/hbmk2_qt.hb @@ -2523,6 +2523,9 @@ METHOD HbQtSource:parseProto( cProto, fBody_ ) CASE "V" oMtd:cVersion := cVal EXIT + CASE "R" + oMtd:nDetachRet := val( cVal ) + EXIT CASE "xxx" EXIT ENDSWITCH @@ -2925,7 +2928,8 @@ 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, .F. ) + oMtd:cCmd := hbqtgen_Get_Command( oRet:cCast, oMtd:cCmn, oMtd:nDetachRet > 0 ) oMtd:cPrgRet := "o" + oMtd:cDocNMRet CASE hbqtgen_isAqtObject( oRet:cCast ) .AND. ; @@ -2954,24 +2958,24 @@ METHOD HbQtSource:buildCppCode( oMtd ) CASE oRet:lAnd .AND. oRet:lConst cRef := oRet:cCast - oMtd:cCmd := hbqtgen_Get_Command( oRet:cCast, oMtd:cCmn ) + oMtd:cCmd := hbqtgen_Get_Command( oRet:cCast, oMtd:cCmn, .T. ) oMtd:cPrgRet := "o" + oMtd:cDocNMRet CASE oRet:lConst cRef := oRet:cCast - oMtd:cCmd := hbqtgen_Get_Command( oRet:cCast, oMtd:cCmn ) + oMtd:cCmd := hbqtgen_Get_Command( oRet:cCast, oMtd:cCmn, .T. ) oMtd:cPrgRet := "o" + oMtd:cDocNMRet CASE oRet:lAnd cRef := oRet:cCast - oMtd:cCmd := hbqtgen_Get_Command( oRet:cCast, oMtd:cCmn ) + oMtd:cCmd := hbqtgen_Get_Command( oRet:cCast, oMtd:cCmn, .T. ) oMtd:cPrgRet := "o" + oMtd:cDocNMRet OTHERWISE /* No attribute is attached to return value */ IF hbqtgen_isAqtObject( oRet:cCast ) cRef := oRet:cCast - oMtd:cCmd := hbqtgen_Get_Command( oRet:cCast, oMtd:cCmn ) + oMtd:cCmd := hbqtgen_Get_Command( oRet:cCast, oMtd:cCmn, .T. ) oMtd:cPrgRet := "o" + oMtd:cDocNMRet ELSE oMtd:cError := "<<< " + oMtd:cProto + " | " + oRet:cCast + " >>>" @@ -3020,6 +3024,7 @@ CREATE CLASS HbqtMethod VAR nDetach INIT 0 VAR nAttach INIT 0 VAR cVersion INIT "" + VAR nDetachRet INIT -1 VAR cFun INIT "" VAR cRet INIT "" diff --git a/harbour/contrib/hbqt/qtgui/qth/QMenu.qth b/harbour/contrib/hbqt/qtgui/qth/QMenu.qth index f5006b3037..38db4726ac 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QMenu.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QMenu.qth @@ -56,17 +56,17 @@ QAction * actionAt ( const QPoint & pt ) const QRect actionGeometry ( QAction * act ) const QAction * activeAction () const -QAction * addAction ( const QString & text ) -QAction * addAction ( const QIcon & icon, const QString & text ) -QAction * addAction ( const QString & text, const QObject * receiver, const char * member, const QKeySequence & shortcut = 0 ) -QAction * addAction ( const QIcon & icon, const QString & text, const QObject * receiver, const char * member, const QKeySequence & shortcut = 0 ) +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, const QKeySequence & shortcut = 0 ) [*R=1*] +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 ) -QMenu * addMenu ( const QString & title ) -QMenu * addMenu ( const QIcon & icon, const QString & title ) +QAction * addMenu ( QMenu * menu ) [*D=1;R=1*] +QMenu * addMenu ( const QString & title ) [*R=1*] +QMenu * addMenu ( const QIcon & icon, const QString & title ) [*R=1*] -QAction * addSeparator () +QAction * addSeparator () [*R=1*] void clear () QAction * defaultAction () const @@ -75,8 +75,8 @@ QAction * exec ( const QPoint & p, QAction * action = 0 ) void hideTearOffMenu () QIcon icon () const -QAction * insertMenu ( QAction * before, QMenu * menu ) -QAction * insertSeparator ( QAction * before ) +QAction * insertMenu ( QAction * before, QMenu * menu ) [*D=2;R=1*] +QAction * insertSeparator ( QAction * before ) [*R=1*] bool isEmpty () const bool isTearOffEnabled () const bool isTearOffMenuVisible () const diff --git a/harbour/contrib/hbqt/qtgui/qth/QMenuBar.qth b/harbour/contrib/hbqt/qtgui/qth/QMenuBar.qth index 8b27269537..edd48f260b 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QMenuBar.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QMenuBar.qth @@ -39,17 +39,17 @@ HB_FUNC( QT_QMENUBAR ) QAction * activeAction () const -QAction * addAction ( const QString & text ) -QAction * addAction ( const QString & text, const QObject * receiver, const char * member ) +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 ) +QAction * addMenu ( QMenu * menu ) [*D=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 ) -QAction * insertSeparator ( QAction * before ) +QAction * insertMenu ( QAction * before, QMenu * menu ) [*D=2;R=1*] +QAction * insertSeparator ( QAction * before ) [*R=1*] bool isDefaultUp () const // OSMenuRef macMenu () void setActiveAction ( QAction * act ) diff --git a/harbour/contrib/hbqt/qtgui/qth/QToolBar.qth b/harbour/contrib/hbqt/qtgui/qth/QToolBar.qth index 26c77c1ab5..ad2ccc6115 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QToolBar.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QToolBar.qth @@ -19,7 +19,7 @@ New = pParent #include #include - +#include /* QToolBar ( const QString & title, QWidget * parent = 0 ) * QToolBar ( QWidget * parent = 0 ) @@ -53,13 +53,13 @@ HB_FUNC( QT_QTOOLBAR ) QAction * actionAt ( const QPoint & p ) const QAction * actionAt ( int x, int y ) const -void addAction ( QAction * action ) [*D=1*] -QAction * addAction ( const QString & text ) -QAction * addAction ( const QIcon & icon, const QString & text ) -QAction * addAction ( const QString & text, const QObject * receiver, const char * member ) -QAction * addAction ( const QIcon & icon, const QString & text, const QObject * receiver, const char * member ) [*D=3*] -QAction * addSeparator () -QAction * addWidget ( QWidget * widget ) +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 * addSeparator () [*R=1*] +QAction * addWidget ( QWidget * widget ) [*D=1;R=1*] Qt::ToolBarAreas allowedAreas () const void clear () QSize iconSize () const