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.
This commit is contained in:
Pritpal Bedi
2012-05-17 21:16:12 +00:00
parent e01bcbd238
commit f58a4e033a
5 changed files with 52 additions and 28 deletions

View File

@@ -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

View File

@@ -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 ""

View File

@@ -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

View File

@@ -39,17 +39,17 @@ HB_FUNC( QT_QMENUBAR )
<PROTOS>
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 )

View File

@@ -19,7 +19,7 @@ New = pParent
<CODE>
#include <QtGui/QToolBar>
#include <QtGui/QIcon>
#include <QtGui/QAction>
/* QToolBar ( const QString & title, QWidget * parent = 0 )
* QToolBar ( QWidget * parent = 0 )
@@ -53,13 +53,13 @@ HB_FUNC( QT_QTOOLBAR )
<PROTOS>
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