diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f77cdae088..33c5e9c49f 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,82 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-01-16 22:29 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbqt/generator/hbqtgen.prg + * contrib/hbqt/generator/qt45.qtp + * contrib/hbqt/hbqt.h + * contrib/hbqt/hbqt_base.cpp + * contrib/hbqt/hbqt_garbage.h + * contrib/hbqt/hbqt_hbdbfmodel.cpp + * contrib/hbqt/hbqt_hbevents.cpp + * contrib/hbqt/hbqt_hbqmainwindow.cpp + * contrib/hbqt/hbqt_hbqsyntaxhighlighter.cpp + * contrib/hbqt/hbqt_hbqsyntaxhighlighter.h + * contrib/hbqt/hbqt_hbqtableview.cpp + * contrib/hbqt/hbqt_hbslots.cpp + + + contrib/hbqt/qth/HBQTextBlockUserData.qth + * contrib/hbqt/qth/QAbstractTextDocumentLayout.qth + * contrib/hbqt/qth/QApplication.qth + * contrib/hbqt/qth/QClipboard.qth + * contrib/hbqt/qth/QComboBox.qth + * contrib/hbqt/qth/QCursor.qth + * contrib/hbqt/qth/QDragEnterEvent.qth + * contrib/hbqt/qth/QDragLeaveEvent.qth + * contrib/hbqt/qth/QDropEvent.qth + * contrib/hbqt/qth/QFocusEvent.qth + * contrib/hbqt/qth/QGradient.qth + * contrib/hbqt/qth/QKeyEvent.qth + * contrib/hbqt/qth/QLabel.qth + * contrib/hbqt/qth/QLayoutItem.qth + * contrib/hbqt/qth/QLineEdit.qth + * contrib/hbqt/qth/QMoveEvent.qth + * contrib/hbqt/qth/QPaintDevice.qth + + contrib/hbqt/qth/QPaintEngine.qth + * contrib/hbqt/qth/QPrintEngine.qth + * contrib/hbqt/qth/QResizeEvent.qth + * contrib/hbqt/qth/QSplitter.qth + * contrib/hbqt/qth/QStandardItemModel.qth + * contrib/hbqt/qth/QStyleHintReturn.qth + * contrib/hbqt/qth/QStyleHintReturnMask.qth + * contrib/hbqt/qth/QStyleHintReturnVariant.qth + * contrib/hbqt/qth/QTextBlock.qth + * contrib/hbqt/qth/QTextCursor.qth + + contrib/hbqt/qth/QTextList.qth + * contrib/hbqt/qth/QWheelEvent.qth + * contrib/hbqt/qth/QWidget.qth + + * contrib/hbqt/tests/demoqt.prg + + * contrib/hbxbp/tests/demoxbp.prg + + * contrib/hbxbp/xbpgeneric.prg + * contrib/hbxbp/xbpmenubar.prg + + * contrib/hbqt/qtcore/*.cpp + * contrib/hbqt/qtgui/*.cpp + * contrib/hbqt/qtnetwork/*.cpp + + ! This commit change some rules to parse .qth files to + prepare the wrappers to be encapsulated in hb_retptrGC + envelop. It also attempts to pin-point the spots where + mem-leak could occur. Only very few calls are left to + plain hb_retptr() which eventually will be handled + the other way. + + Only delete ( Q* ) p; is retained. Other two methods are + eliminated. Demos are updated to respect it. + + demoQT and demoXBP now consume very less memory when new + dialogs are opened. It means memory management has + improved with this commit. Anyhow still I can see + memory growing specially in browser navigation. As I + remember sometime in past I could manage the sonstant memory, + but now I do not remember at what stage we were on Qt. + + Though all the three variants, demoQT, demoXBP, hbIDE are + working properly, still there could be regression, please test. + 2010-01-16 13:43 UTC+0500 April White (april users.sourceforge.net) * contrib/hbbtree/test/test.prg * moved existing code into procedures in preparation for diff --git a/harbour/contrib/hbqt/generator/hbqtgen.prg b/harbour/contrib/hbqt/generator/hbqtgen.prg index b68e99defd..6590efd5bd 100644 --- a/harbour/contrib/hbqt/generator/hbqtgen.prg +++ b/harbour/contrib/hbqt/generator/hbqtgen.prg @@ -517,10 +517,9 @@ STATIC FUNCTION GenSource( cProFile, cPathIn, cPathOut, cPathDoc ) aadd( cpp_, "" ) ENDIF - lList := ascan( cls_, {|e_| lower( e_[ 1 ] ) == "list" .and. lower( e_[ 2 ] ) == "yes" } ) > 0 - //cWgt := IF( lList, cWidget +"< void * >", cWidget ) - lDestructor := ascan( cls_, {|e_| lower( e_[ 1 ] ) == "destructor" .and. lower( e_[ 2 ] ) == "no"} ) == 0 - lObject := ascan( cls_, {|e_| lower( e_[ 1 ] ) == "qobject" .and. lower( e_[ 2 ] ) == "no"} ) == 0 + lList := ascan( cls_, {|e_| lower( e_[ 1 ] ) == "list" .AND. lower( e_[ 2 ] ) == "yes" } ) > 0 + lDestructor := ascan( cls_, {|e_| lower( e_[ 1 ] ) == "destructor" .AND. lower( e_[ 2 ] ) == "no" } ) == 0 + lObject := ascan( cls_, {|e_| lower( e_[ 1 ] ) == "qobject" .AND. lower( e_[ 2 ] ) == "no" } ) == 0 IF ( lNewGCtoQT ) lConst := .f. @@ -532,110 +531,68 @@ STATIC FUNCTION GenSource( cProFile, cPathIn, cPathOut, cPathDoc ) ENDIF ENDIF NEXT - IF ( lDestructor ) .AND. ( lConst ) - IF lObject - aadd( cpp_, "typedef struct" ) - aadd( cpp_, "{" ) - aadd( cpp_, " void * ph;" ) - aadd( cpp_, " QT_G_FUNC_PTR func;" ) - aadd( cpp_, " QPointer< "+ cWidget +" > pq;" ) - aadd( cpp_, "} QGC_POINTER_" + cWidget + ";" ) - aadd( cpp_, " " ) - ENDIF + + aadd( cpp_, "typedef struct" ) + aadd( cpp_, "{" ) + aadd( cpp_, " void * ph;" ) + aadd( cpp_, " bool bNew;" ) + aadd( cpp_, " QT_G_FUNC_PTR func;" ) + IF lObject + aadd( cpp_, " QPointer< "+ cWidget +" > pq;" ) ENDIF + aadd( cpp_, "} QGC_POINTER_" + cWidget + ";" ) + aadd( cpp_, " " ) + aadd( cpp_, "QT_G_FUNC( hbqt_gcRelease_" + cWidget + " )" ) aadd( cpp_, "{" ) IF ( lDestructor ) .AND. ( lConst ) IF lObject aadd( cpp_, " QGC_POINTER_" + cWidget + " * p = ( QGC_POINTER_" + cWidget + " * ) Cargo; " ) aadd( cpp_, " " ) - aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_' + pad( cWidget, 27 ) + ' p=%p", p));') - aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_' + pad( cWidget, 27 ) + ' ph=%p pq=%p", p->ph, (void *)(p->pq)));') - aadd( cpp_, " " ) - aadd( cpp_, " if( p && p->ph && p->pq ) " ) - aadd( cpp_, " { " ) - aadd( cpp_, " const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject();" ) - aadd( cpp_, ' if( ( QString ) m->className() != ( QString ) "QObject" )' ) + aadd( cpp_, " if( p && p->bNew )" ) + aadd( cpp_, " {" ) + aadd( cpp_, " if( p->ph && p->pq )" ) aadd( cpp_, " {" ) - aadd( cpp_, " switch( hbqt_get_object_release_method() )" ) + aadd( cpp_, " const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject();" ) + aadd( cpp_, ' if( ( QString ) m->className() != ( QString ) "QObject" )' ) aadd( cpp_, " {" ) - aadd( cpp_, " case HBQT_RELEASE_WITH_DELETE:" ) aadd( cpp_, " delete ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) p->ph ); " ) - aadd( cpp_, " break;" ) - aadd( cpp_, " case HBQT_RELEASE_WITH_DESTRUTOR:" ) - aadd( cpp_, " ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) p->ph )->~" + cWidget + "(); " ) - aadd( cpp_, " break;" ) - aadd( cpp_, " case HBQT_RELEASE_WITH_DELETE_LATER:" ) - aadd( cpp_, " ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) p->ph )->deleteLater(); " ) - aadd( cpp_, " break;" ) + aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "YES_rel_' + pad( cWidget, 27 ) + 'ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );') + aadd( cpp_, " p->ph = NULL;" ) aadd( cpp_, " }" ) + aadd( cpp_, " else" ) + aadd( cpp_, " {" ) + aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "NO__rel_' + pad( cWidget, 27 ) + 'ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );') + aadd( cpp_, " }" ) + ELSE + aadd( cpp_, " QGC_POINTER * p = ( QGC_POINTER * ) Cargo;" ) + aadd( cpp_, " " ) + aadd( cpp_, " if( p && p->bNew )" ) + aadd( cpp_, " {" ) + aadd( cpp_, " if( p->ph )" ) + aadd( cpp_, " {" ) + aadd( cpp_, " delete ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) p->ph ); " ) + aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "YES_rel_' + pad( cWidget, 27 ) + 'ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );') aadd( cpp_, " p->ph = NULL;" ) - aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_' + pad( cWidget, 27 ) + ' Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );') - aadd( cpp_, " }" ) - aadd( cpp_, " else" ) - aadd( cpp_, " {" ) - aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_' + pad( cWidget, 27 ) + ' Object Name Missing!" ) );') - aadd( cpp_, " }" ) - ELSE - aadd( cpp_, " QGC_POINTER * p = ( QGC_POINTER * ) Cargo; " ) - aadd( cpp_, " " ) - aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_' + pad( cWidget, 27 ) + ' p=%p", p ) );' ) - aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_' + pad( cWidget, 27 ) + ' ph=%p", p->ph ) );' ) - aadd( cpp_, " " ) - aadd( cpp_, " if( p && p->ph ) " ) - aadd( cpp_, " { " ) - aadd( cpp_, " delete ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) p->ph ); " ) - //aadd( cpp_, " ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) p->ph )->~" + cWidget + "(); " ) - aadd( cpp_, " p->ph = NULL;" ) - aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_' + pad( cWidget, 27 ) + ' Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );') ENDIF + aadd( cpp_, " }" ) + aadd( cpp_, " else" ) + aadd( cpp_, " {" ) + aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_' + pad( cWidget, 27 ) + ' Object already deleted!" ) );' ) + aadd( cpp_, " }" ) aadd( cpp_, " }" ) aadd( cpp_, " else" ) aadd( cpp_, " {" ) - aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_' + pad( cWidget, 27 ) + ' Object Already deleted!" ) );' ) + aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_' + pad( cWidget, 27 ) + ' Object not created with - new" ) );' ) + aadd( cpp_, " p->ph = NULL;" ) aadd( cpp_, " }" ) ELSE aadd( cpp_, " HB_SYMBOL_UNUSED( Cargo );" ) ENDIF - aadd( cpp_, "} " ) - aadd( cpp_, " " ) - ELSE - aadd( cpp_, "QT_G_FUNC( hbqt_gcRelease_" + cWidget + " ) " ) - aadd( cpp_, "{ " ) - IF lDestructor - aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_' + pad( cWidget, 27 ) + ' %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );') - aadd( cpp_, "" ) - aadd( cpp_, " void * ph = ( void * ) Cargo; " ) - aadd( cpp_, " if( ph ) " ) - aadd( cpp_, " { " ) - IF lObject - aadd( cpp_, " const QMetaObject * m = ( ( QObject * ) ph )->metaObject();" ) - aadd( cpp_, ' if( ( QString ) m->className() != ( QString ) "QObject" )' ) - aadd( cpp_, " {" ) - //aadd( cpp_, " delete ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) ph ); " ) - aadd( cpp_, " ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) ph )->~" + cWidget + "(); " ) - aadd( cpp_, " ph = NULL;" ) - aadd( cpp_, " }" ) - aadd( cpp_, " else" ) - aadd( cpp_, " {" ) - aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( " Object Name Missin: ' + pad( cWidget, 27 ) + '" ) );') - aadd( cpp_, " }" ) - ELSE - //aadd( cpp_, " delete ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) ph ); " ) - aadd( cpp_, " ( ( " + cWidget + IF( lList, "< void * >", "" ) + " * ) ph )->~" + cWidget + "(); " ) - aadd( cpp_, " ph = NULL;" ) - ENDIF - aadd( cpp_, " }" ) - aadd( cpp_, " else" ) - aadd( cpp_, " {" ) - aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( "! ph_____' + cWidget + '" ) );') - aadd( cpp_, " }" ) - ELSE - aadd( cpp_, " HB_SYMBOL_UNUSED( Cargo );" ) - ENDIF - aadd( cpp_, "} " ) - aadd( cpp_, " " ) + aadd( cpp_, "}" ) + aadd( cpp_, "" ) ENDIF + /* Insert CONSTRUCTOR - if defined */ lConst := .f. FOR i := 3 TO len( new_ ) - 1 @@ -648,27 +605,28 @@ STATIC FUNCTION GenSource( cProFile, cPathIn, cPathOut, cPathDoc ) NEXT IF ( lNewGCtoQT ) - IF lConst - IF lDestructor - aadd( cpp_, "void * hbqt_gcAllocate_" + cWidget + "( void * pObj )" ) - aadd( cpp_, "{ " ) - IF lObject - aadd( cpp_, " QGC_POINTER_" + cWidget + " * p = ( QGC_POINTER_" + cWidget + " * ) hb_gcAllocate( sizeof( QGC_POINTER_" + cWidget + " ), hbqt_gcFuncs() );" ) - ELSE - aadd( cpp_, " QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() );" ) - ENDIF - aadd( cpp_, "" ) - aadd( cpp_, " p->ph = pObj;" ) - aadd( cpp_, " p->func = hbqt_gcRelease_" + cWidget + ";" ) - IF lObject - aadd( cpp_, " new( & p->pq ) QPointer< "+ cWidget +" >( ( " + cWidget + " * ) pObj );" ) - ENDIF - aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( " new_' + pad( cWidget, 27 ) + ' %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );') - aadd( cpp_, " return p;" ) - aadd( cpp_, "}" ) - aadd( cpp_, "" ) - ENDIF + aadd( cpp_, "void * hbqt_gcAllocate_" + cWidget + "( void * pObj, bool bNew )" ) + aadd( cpp_, "{ " ) + IF lObject + aadd( cpp_, " QGC_POINTER_" + cWidget + " * p = ( QGC_POINTER_" + cWidget + " * ) hb_gcAllocate( sizeof( QGC_POINTER_" + cWidget + " ), hbqt_gcFuncs() );" ) + ELSE + aadd( cpp_, " QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() );" ) ENDIF + aadd( cpp_, "" ) + aadd( cpp_, " p->ph = pObj;" ) + aadd( cpp_, " p->bNew = bNew;" ) + aadd( cpp_, " p->func = hbqt_gcRelease_" + cWidget + ";" ) + aadd( cpp_, "" ) + aadd( cpp_, " if( bNew )" ) + aadd( cpp_, " {" ) + IF lObject + aadd( cpp_, " new( & p->pq ) QPointer< "+ cWidget +" >( ( " + cWidget + " * ) pObj );" ) + ENDIF + aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( " _new_' + pad( cWidget, 27 ) + 'ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );') + aadd( cpp_, " }" ) + aadd( cpp_, " return p;" ) + aadd( cpp_, "}" ) + aadd( cpp_, "" ) aadd( cpp_, new_[ 1 ] ) // Func definition aadd( cpp_, new_[ 2 ] ) // { @@ -690,55 +648,14 @@ STATIC FUNCTION GenSource( cProFile, cPathIn, cPathOut, cPathDoc ) NEXT aadd( cpp_, " " ) IF lDestructor - aadd( cpp_, " hb_retptrGC( hbqt_gcAllocate_" + cWidget + "( pObj ) );" ) - ELSE - aadd( cpp_, " hb_retptr( pObj );" ) - ENDIF - ENDIF - aadd( cpp_, new_[ len( new_ ) ] ) // } - ELSE - aadd( cpp_, new_[ 1 ] ) // Func definition - aadd( cpp_, new_[ 2 ] ) // { - IF lConst - IF lDestructor - aadd( cpp_, " QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() );" ) - ENDIF - IF lObject - aadd( cpp_, " QPointer< "+ cWidget +" > pObj = NULL;" ) - ELSE - aadd( cpp_, " void * pObj = NULL;" ) - ENDIF - - aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( " ' + IIF( lDestructor, 'GC', 'NON-GC' ) + ': new ' + pad( cWidget, 27 ) + ' %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );' ) - - aadd( cpp_, "" ) - FOR i := 3 TO len( new_ ) - 1 - IF left( ltrim( new_[ i ] ), 2 ) != "//" - IF "hb_retptr(" $ new_[ i ] - s := trim( strtran( new_[ i ], "hb_retptr(", "pObj =" ) ) - s := strtran( s, ");", ";" ) - aadd( cpp_, s ) - ELSE - aadd( cpp_, new_[ i ] ) - ENDIF - ENDIF - NEXT - aadd( cpp_, "" ) - - aadd( cpp_, ' HB_TRACE( HB_TR_DEBUG, ( " ' + IIF( lDestructor, 'GC', 'NON-GC' ) + ': ' + pad( cWidget, 27 ) + ' %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) );' ) - - //IF lObject .or. IsMemObject( cWidget ) - IF lDestructor - aadd( cpp_, " p->ph = pObj;" ) - aadd( cpp_, " p->func = hbqt_gcRelease_" + cWidget +";" ) - aadd( cpp_, " " ) - aadd( cpp_, " hb_retptrGC( p );" ) + aadd( cpp_, " hb_retptrGC( hbqt_gcAllocate_" + cWidget + "( pObj, true ) );" ) ELSE aadd( cpp_, " hb_retptr( pObj );" ) ENDIF ENDIF aadd( cpp_, new_[ len( new_ ) ] ) // } ENDIF + /* Insert Functions */ aeval( txt_, {|e| aadd( cpp_, strtran( e, chr( 13 ), '' ) ) } ) @@ -788,36 +705,34 @@ FUNCTION GetSourcePathByLib( cWidget, cPathOut, cExt, cPre ) /*----------------------------------------------------------------------*/ -#define PRT_L_CONST 1 -#define PRT_L_FAR 2 -#define PRT_L_AND 3 -#define PRT_L_VIRT 4 -#define PRT_NAME 5 -#define PRT_CAST 6 -#define PRT_DEFAULT 7 -#define PRT_RAW 8 -#define PRT_BODY 9 -#define PRT_DOC 10 -#define PRT_BODY_PRE 11 +#define PRT_L_CONST 1 +#define PRT_L_FAR 2 +#define PRT_L_AND 3 +#define PRT_L_VIRT 4 +#define PRT_NAME 5 +#define PRT_CAST 6 +#define PRT_DEFAULT 7 +#define PRT_RAW 8 +#define PRT_BODY 9 +#define PRT_DOC 10 +#define PRT_BODY_PRE 11 +#define PRT_L_CONST_LAST 12 -#define PRT_ATTRB_MAX 11 +#define PRT_ATTRB_MAX 12 #define THIS_PROPER( s ) ( upper( left( s,1 ) ) + substr( s,2 ) ) STATIC FUNCTION ParseProto( cProto, cWidget, txt_, doc_, aEnum, func_ ) - LOCAL aRet, aA, aArgus, aArg, aPar, aPre - LOCAL n, nn, nHBIdx - LOCAL cPre, cPar, cRet, cFun, cParas, cDocs, cCmd, cPas, s, ss + LOCAL aRet, aA, aArgus, aArg, aPar, aPre, n, nn, nHBIdx + LOCAL cPre, cPar, cRet, cFun, cParas, cDocs, cCmd, cPas, s, ss, cFirstParamCast LOCAL cWdg, cCmn, cPrgRet, cHBFunc, cHBIdx, cDocNM LOCAL lSuccess LOCAL cInt := 'int,qint16,quint16,QChar,short,ushort' LOCAL cIntLong := 'qint32,quint32,QRgb' LOCAL cIntLongLong := 'qint64,quint64,qlonglong,qulonglong' - LOCAL cFirstParamCast cParas := '' cDocs := '' - //aArgus := {} aRet := {}; aArgus := {} n := at( '(', cProto ) @@ -827,24 +742,25 @@ STATIC FUNCTION ParseProto( cProto, cWidget, txt_, doc_, aEnum, func_ ) /* Pull out pre-mid-post components */ cPre := alltrim( substr( cProto, 1, n-1 ) ) cPar := alltrim( substr( cProto, n+1, nn-1-n ) ) - cPas := alltrim( substr( cProto, nn+1 ) ) + cPas := alltrim( substr( cProto, nn+1 ) ) /* parse cPre, it has two components */ n := rat( ' ', cPre ) IF n > 0 /* And it must be, otherwise it is constructor function which we write in section */ - cFun := alltrim( substr( cPre, n+1 ) ) - cRet := alltrim( substr( cPre, 1, n-1 ) ) + cFun := alltrim( substr( cPre, n + 1 ) ) + cRet := alltrim( substr( cPre, 1, n - 1 ) ) ELSE cFun := cPre cRet := '' ENDIF aRet := array( PRT_ATTRB_MAX ) - - aRet[ PRT_L_CONST ] := 'const' $ cRet .or. 'const' $ cPas - aRet[ PRT_L_AND ] := '&' $ cRet - aRet[ PRT_L_FAR ] := '*' $ cRet - aRet[ PRT_L_VIRT ] := 'virtual' $ cRet + JustACall( cPas ) //////////////////////////////////////////////////////// + aRet[ PRT_L_CONST ] := 'const' $ cRet //.or. 'const' $ cPas + aRet[ PRT_L_AND ] := '&' $ cRet + aRet[ PRT_L_FAR ] := '*' $ cRet + aRet[ PRT_L_VIRT ] := 'virtual' $ cRet + aRet[ PRT_L_CONST_LAST ] := 'const' $ cPas cRet := strtran( cRet, 'const ' , '' ) cRet := strtran( cRet, '& ' , '' ) @@ -1064,7 +980,6 @@ STATIC FUNCTION ParseProto( cProto, cWidget, txt_, doc_, aEnum, func_ ) CASE aA[ PRT_L_AND ] .and. aA[ PRT_L_CONST ] s := '*hbqt_par_' + aA[ PRT_CAST ] + '( ' + cHBIdx + ' )' IF !empty( aA[ PRT_DEFAULT ] ) .and. ( '(' $ aA[ PRT_DEFAULT ] ) - //aA[ PRT_BODY ] := '( HB_ISNIL( ' + cHBIdx + ' ) ? ' + aA[ PRT_DEFAULT ] + ' : ' + s + ' )' aA[ PRT_BODY ] := '( HB_ISPOINTER( ' + cHBIdx + ' ) ? ' + s + ' : ' + aA[ PRT_DEFAULT ] + ' )' ELSE aA[ PRT_BODY ] := s @@ -1092,7 +1007,8 @@ STATIC FUNCTION ParseProto( cProto, cWidget, txt_, doc_, aEnum, func_ ) /* Build complete code line */ IF .t. - aA := aRet + aA := aRet /* T A K E C A R E */ + // cWdg := 'hbqt_par_' + cWidget + '( 1 )->' cParas := '( ' + cParas + ' )' cCmn := cWdg + cFun + cParas @@ -1147,10 +1063,41 @@ STATIC FUNCTION ParseProto( cProto, cWidget, txt_, doc_, aEnum, func_ ) cCmd := 'hb_retc( ' + cCmn + ' )' cPrgRet := 'c' + cDocNM - CASE aA[ PRT_L_FAR ] + CASE aA[ PRT_L_FAR ] .AND. ( aA[ PRT_CAST ] $ "uchar" ) cCmd := 'hb_retptr( ( ' + aA[ PRT_CAST ] + '* ) ' + cCmn + ' )' cPrgRet := 'p' + cDocNM +// CASE aA[ PRT_L_FAR ] + CASE aA[ PRT_L_FAR ] .AND. !( aA[ PRT_L_CONST ] ) + //cCmd := 'hb_retptr( ( ' + aA[ PRT_CAST ] + '* ) ' + cCmn + ' )' + IF ( left( aA[ PRT_CAST ], 1 ) == 'Q' ) + cCmd := Get_Command( aA[ PRT_CAST ], cCmn, .F. ) + ELSE + cCmd := 'hb_retptr( ( ' + aA[ PRT_CAST ] + '* ) ' + cCmn + ' )' + ENDIF + cPrgRet := 'p' + cDocNM + + CASE ( left( aA[ PRT_CAST ], 1 ) == 'Q' ) .AND. ; + aA[ PRT_L_FAR ] .AND. ; + aA[ PRT_L_CONST ] .AND. ; + ( "Abstract" $ aA[ PRT_CAST ] ) + cCmd := 'hb_retptr( ( ' + aA[ PRT_CAST ] + '* ) ' + cCmn + ' )' + cPrgRet := 'p' + cDocNM + + CASE ( left( aA[ PRT_CAST ], 1 ) == 'Q' ) .AND. ; + aA[ PRT_L_FAR ] .AND. ; + aA[ PRT_L_CONST ] .AND. ; + aA[ PRT_L_VIRT ] + cCmd := 'hb_retptr( ( ' + aA[ PRT_CAST ] + '* ) ' + cCmn + ' )' + cPrgRet := 'p' + cDocNM + + CASE ( left( aA[ PRT_CAST ], 1 ) == 'Q' ) .AND. ; + aA[ PRT_L_FAR ] .AND. ; + aA[ PRT_L_CONST ] .AND. ; + aA[ PRT_L_CONST_LAST ] + cCmd := Get_Command_1( aA[ PRT_CAST ], cCmn ) + cPrgRet := 'p' + cDocNM + CASE aA[ PRT_L_AND ] .AND. aA[ PRT_L_CONST ] cCmd := Get_Command( aA[ PRT_CAST ], cCmn ) cPrgRet := 'p' + cDocNM @@ -1165,7 +1112,7 @@ STATIC FUNCTION ParseProto( cProto, cWidget, txt_, doc_, aEnum, func_ ) OTHERWISE /* No attribute is attached to return value */ - IF (left( aA[ PRT_CAST ], 1 ) == 'Q') + IF ( left( aA[ PRT_CAST ], 1 ) == 'Q' ) cCmd := Get_Command( aA[ PRT_CAST ], cCmn ) cPrgRet := 'p' + cDocNM @@ -1329,8 +1276,6 @@ STATIC FUNCTION ParseVariables( cProto, cWidget, txt_, doc_, aEnum, func_ ) OTHERWISE /* No attribute is attached to return value */ IF (left( aA[ PRT_CAST ], 1 ) == 'Q') -// cCmd := 'hb_retptr( new ' + aA[ PRT_CAST ] + '( ' + cCmn + ' ) )' -// cCmd := 'hb_retptrGC( hbqt_pToGCPointer( new ' + aA[ PRT_CAST ] + '( ' + cCmn + ' ) ) )' cCmd := Get_Command( aA[ PRT_CAST ], cCmn ) cPrgRet := 'p' + cDocNM @@ -1413,7 +1358,7 @@ STATIC FUNCTION BuildHeader( txt_, nMode ) aadd( txt_, " * Harbour Project source code:" ) aadd( txt_, " * QT wrapper main header" ) aadd( txt_, " * " ) - aadd( txt_, " * Copyright 2009 Pritpal Bedi " ) + aadd( txt_, " * Copyright 2009-2010 Pritpal Bedi " ) aadd( txt_, " * " ) aadd( txt_, " * Copyright 2009 Marcos Antonio Gambeta " ) aadd( txt_, " * www - http://www.harbour-project.org" ) @@ -1462,7 +1407,7 @@ STATIC FUNCTION BuildHeader( txt_, nMode ) aadd( txt_, "" ) IF nMode == 0 aadd( txt_, '#include "hbapi.h"' ) - aadd( txt_, '#include "../hbqt.h"' ) ///////////// + aadd( txt_, '#include "../hbqt.h"' ) ///////////// aadd( txt_, "" ) aadd( txt_, "/*----------------------------------------------------------------------*/" ) aadd( txt_, "#if QT_VERSION >= 0x040500" ) @@ -1672,9 +1617,9 @@ STATIC FUNCTION Build_GarbageFile( cpp_, cPathOut ) NEXT aadd( txt_, "" ) - IF (lNewGCtoQT) + IF ( lNewGCtoQT ) FOR EACH s IN cpp_ - aadd( txt_, "extern void * hbqt_gcAllocate_" + s + "( void * pObj );" ) + aadd( txt_, "extern void * hbqt_gcAllocate_" + s + "( void * pObj, bool bNew );" ) NEXT aadd( txt_, "" ) ENDIF @@ -2333,16 +2278,23 @@ FUNCTION IsMemObject( cWidget ) /*----------------------------------------------------------------------*/ -FUNCTION Get_Command( cWgt, cCmn ) - STATIC a_:={} +FUNCTION Get_Command_1( cWgt, cCmn ) + + RETURN 'hb_retptrGC( hbqt_gcAllocate_' + cWgt + '( new ' + cWgt + '( *( ' + cCmn + ' ) ), true ) )' + +/*----------------------------------------------------------------------*/ + +FUNCTION Get_Command( cWgt, cCmn, lNew ) LOCAL cRet - IF ascan( a_, cWgt ) == 0 - aadd( a_, cWgt ) - ENDIF + DEFAULT lNew TO .T. - IF (lNewGCtoQT) - cRet := 'hb_retptrGC( hbqt_gcAllocate_' + cWgt + '( new ' + cWgt + '( ' + cCmn + ' ) ) )' + IF ( lNewGCtoQT ) + IF lNew + cRet := 'hb_retptrGC( hbqt_gcAllocate_' + cWgt + '( new ' + cWgt + '( ' + cCmn + ' ), true ) )' + ELSE + cRet := 'hb_retptrGC( hbqt_gcAllocate_' + cWgt + '( ' + cCmn + ', false ) )' + ENDIF ELSE cRet := 'hb_retptrGC( hbqt_ptrTOgcpointer( new ' + cWgt + '( ' + cCmn + ' ), hbqt_gcRelease_' + cWgt +' ) )' ENDIF @@ -2391,3 +2343,8 @@ FUNCTION ParsePtr( cParam ) RETURN cPar /*----------------------------------------------------------------------*/ + +FUNCTION JustACall() + RETURN nil + +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/generator/qt45.qtp b/harbour/contrib/hbqt/generator/qt45.qtp index 8ff2ead228..e3c48a4366 100644 --- a/harbour/contrib/hbqt/generator/qt45.qtp +++ b/harbour/contrib/hbqt/generator/qt45.qtp @@ -14,7 +14,7 @@ -D=../doc - +HBQTextBlockUserData.qth QAbstractButton.qth QAbstractItemDelegate.qth QAbstractItemModel.qth @@ -137,10 +137,11 @@ QMoveEvent.qth QMovie.qth QNetworkRequest.qth QObject.qth -QPaintDevice.qth -QPainterPath.qth QPageSetupDialog.qth +QPaintDevice.qth +QPaintEngine.qth QPainter.qth +QPainterPath.qth QPaintEvent.qth QPalette.qth QPen.qth @@ -248,6 +249,7 @@ QTextItem.qth QTextLayout.qth QTextLength.qth QTextLine.qth +QTextList.qth QTextListFormat.qth QTextObject.qth QTextOption.qth diff --git a/harbour/contrib/hbqt/hbqt.h b/harbour/contrib/hbqt/hbqt.h index 838bfd6a1e..f69b97b6ac 100644 --- a/harbour/contrib/hbqt/hbqt.h +++ b/harbour/contrib/hbqt/hbqt.h @@ -69,7 +69,8 @@ typedef QT_G_FUNC_ * QT_G_FUNC_PTR; typedef struct { - void * ph; + void * ph; + bool bNew; QT_G_FUNC_PTR func; } QGC_POINTER; @@ -224,6 +225,8 @@ extern void * hbqt_pPtrFromObj( int iParam ); #define hbqt_par_QObject( n ) ( ( QObject * ) hbqt_gcpointer( n ) ) #define hbqt_par_QPageSetupDialog( n ) ( ( QPageSetupDialog * ) hbqt_gcpointer( n ) ) #define hbqt_par_QPaintDevice( n ) ( ( QPaintDevice * ) hbqt_gcpointer( n ) ) +#define hbqt_par_QPaintEngine( n ) ( ( QPaintEngine * ) hbqt_gcpointer( n ) ) +#define hbqt_par_QPaintEngineState( n ) ( ( QPaintEngineState * ) hbqt_gcpointer( n ) ) #define hbqt_par_QPainter( n ) ( ( QPainter * ) hbqt_gcpointer( n ) ) #define hbqt_par_QPainterPath( n ) ( ( QPainterPath * ) hbqt_gcpointer( n ) ) #define hbqt_par_QPaintEvent( n ) ( ( QPaintEvent * ) hbqt_gcpointer( n ) ) @@ -336,6 +339,7 @@ extern void * hbqt_pPtrFromObj( int iParam ); #define hbqt_par_QTextImageFormat( n ) ( ( QTextImageFormat * ) hbqt_gcpointer( n ) ) #define hbqt_par_QTextInlineObject( n ) ( ( QTextInlineObject * ) hbqt_gcpointer( n ) ) #define hbqt_par_QTextItem( n ) ( ( QTextItem * ) hbqt_gcpointer( n ) ) +#define hbqt_par_QTextList( n ) ( ( QTextList * ) hbqt_gcpointer( n ) ) #define hbqt_par_QTextLayout( n ) ( ( QTextLayout * ) hbqt_gcpointer( n ) ) #define hbqt_par_QTextLength( n ) ( ( QTextLength * ) hbqt_gcpointer( n ) ) #define hbqt_par_QTextLine( n ) ( ( QTextLine * ) hbqt_gcpointer( n ) ) diff --git a/harbour/contrib/hbqt/hbqt_base.cpp b/harbour/contrib/hbqt/hbqt_base.cpp index f816dccd2c..fc7b084b10 100644 --- a/harbour/contrib/hbqt/hbqt_base.cpp +++ b/harbour/contrib/hbqt/hbqt_base.cpp @@ -81,11 +81,22 @@ HB_FUNC( QT_FINDCHILD ) HB_FUNC( HBQT_ISEQUALGCQTPOINTER ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_parptrGC( hbqt_gcFuncs(), 1 ); + QGC_POINTER * q = ( QGC_POINTER * ) hb_parptrGC( hbqt_gcFuncs(), 2 ); - if( p && p->ph ) - hb_retl( p->ph == hb_parptr( 2 ) ); + if( p && q ) + { + if( p->ph && q->ph ) + hb_retl( p->ph == q->ph ); + else + hb_retl( false ); + } else - hb_retl( false ); + { + if( p && p->ph ) + hb_retl( p->ph == hb_parptr( 2 ) ); + else + hb_retl( false ); + } } #if defined( HB_OS_WIN ) diff --git a/harbour/contrib/hbqt/hbqt_garbage.h b/harbour/contrib/hbqt/hbqt_garbage.h index b22d0bbf88..585c0a63b6 100644 --- a/harbour/contrib/hbqt/hbqt_garbage.h +++ b/harbour/contrib/hbqt/hbqt_garbage.h @@ -8,6 +8,7 @@ /* or the generator tool itself, and run regenarate. */ /* -------------------------------------------------------------------- */ +extern QT_G_FUNC( hbqt_gcRelease_HBQTextBlockUserData ); extern QT_G_FUNC( hbqt_gcRelease_QAbstractButton ); extern QT_G_FUNC( hbqt_gcRelease_QAbstractItemDelegate ); extern QT_G_FUNC( hbqt_gcRelease_QAbstractItemModel ); @@ -130,10 +131,11 @@ extern QT_G_FUNC( hbqt_gcRelease_QMoveEvent ); extern QT_G_FUNC( hbqt_gcRelease_QMovie ); extern QT_G_FUNC( hbqt_gcRelease_QNetworkRequest ); extern QT_G_FUNC( hbqt_gcRelease_QObject ); -extern QT_G_FUNC( hbqt_gcRelease_QPaintDevice ); -extern QT_G_FUNC( hbqt_gcRelease_QPainterPath ); extern QT_G_FUNC( hbqt_gcRelease_QPageSetupDialog ); +extern QT_G_FUNC( hbqt_gcRelease_QPaintDevice ); +extern QT_G_FUNC( hbqt_gcRelease_QPaintEngine ); extern QT_G_FUNC( hbqt_gcRelease_QPainter ); +extern QT_G_FUNC( hbqt_gcRelease_QPainterPath ); extern QT_G_FUNC( hbqt_gcRelease_QPaintEvent ); extern QT_G_FUNC( hbqt_gcRelease_QPalette ); extern QT_G_FUNC( hbqt_gcRelease_QPen ); @@ -241,6 +243,7 @@ extern QT_G_FUNC( hbqt_gcRelease_QTextItem ); extern QT_G_FUNC( hbqt_gcRelease_QTextLayout ); extern QT_G_FUNC( hbqt_gcRelease_QTextLength ); extern QT_G_FUNC( hbqt_gcRelease_QTextLine ); +extern QT_G_FUNC( hbqt_gcRelease_QTextList ); extern QT_G_FUNC( hbqt_gcRelease_QTextListFormat ); extern QT_G_FUNC( hbqt_gcRelease_QTextObject ); extern QT_G_FUNC( hbqt_gcRelease_QTextOption ); @@ -281,276 +284,279 @@ extern QT_G_FUNC( hbqt_gcRelease_QWindowsStyle ); extern QT_G_FUNC( hbqt_gcRelease_QWizard ); extern QT_G_FUNC( hbqt_gcRelease_QWizardPage ); -extern void * hbqt_gcAllocate_QAbstractButton( void * pObj ); -extern void * hbqt_gcAllocate_QAbstractItemDelegate( void * pObj ); -extern void * hbqt_gcAllocate_QAbstractItemModel( void * pObj ); -extern void * hbqt_gcAllocate_QAbstractItemView( void * pObj ); -extern void * hbqt_gcAllocate_QAbstractListModel( void * pObj ); -extern void * hbqt_gcAllocate_QAbstractProxyModel( void * pObj ); -extern void * hbqt_gcAllocate_QAbstractPrintDialog( void * pObj ); -extern void * hbqt_gcAllocate_QAbstractScrollArea( void * pObj ); -extern void * hbqt_gcAllocate_QAbstractSlider( void * pObj ); -extern void * hbqt_gcAllocate_QAbstractSpinBox( void * pObj ); -extern void * hbqt_gcAllocate_QAbstractTableModel( void * pObj ); -extern void * hbqt_gcAllocate_QAbstractTextDocumentLayout( void * pObj ); -extern void * hbqt_gcAllocate_QAction( void * pObj ); -extern void * hbqt_gcAllocate_QActionGroup( void * pObj ); -extern void * hbqt_gcAllocate_QApplication( void * pObj ); -extern void * hbqt_gcAllocate_QBitArray( void * pObj ); -extern void * hbqt_gcAllocate_QBitmap( void * pObj ); -extern void * hbqt_gcAllocate_QBoxLayout( void * pObj ); -extern void * hbqt_gcAllocate_QBrush( void * pObj ); -extern void * hbqt_gcAllocate_QButtonGroup( void * pObj ); -extern void * hbqt_gcAllocate_QByteArray( void * pObj ); -extern void * hbqt_gcAllocate_QCalendarWidget( void * pObj ); -extern void * hbqt_gcAllocate_QCheckBox( void * pObj ); -extern void * hbqt_gcAllocate_QClipboard( void * pObj ); -extern void * hbqt_gcAllocate_QColor( void * pObj ); -extern void * hbqt_gcAllocate_QColorDialog( void * pObj ); -extern void * hbqt_gcAllocate_QComboBox( void * pObj ); -extern void * hbqt_gcAllocate_QCommandLinkButton( void * pObj ); -extern void * hbqt_gcAllocate_QCommonStyle( void * pObj ); -extern void * hbqt_gcAllocate_QCompleter( void * pObj ); -extern void * hbqt_gcAllocate_QConicalGradient( void * pObj ); -extern void * hbqt_gcAllocate_QContextMenuEvent( void * pObj ); -extern void * hbqt_gcAllocate_QCoreApplication( void * pObj ); -extern void * hbqt_gcAllocate_QCursor( void * pObj ); -extern void * hbqt_gcAllocate_QDataStream( void * pObj ); -extern void * hbqt_gcAllocate_QDate( void * pObj ); -extern void * hbqt_gcAllocate_QDateEdit( void * pObj ); -extern void * hbqt_gcAllocate_QDateTime( void * pObj ); -extern void * hbqt_gcAllocate_QDateTimeEdit( void * pObj ); -extern void * hbqt_gcAllocate_QDesktopWidget( void * pObj ); -extern void * hbqt_gcAllocate_QDial( void * pObj ); -extern void * hbqt_gcAllocate_QDialog( void * pObj ); -extern void * hbqt_gcAllocate_QDir( void * pObj ); -extern void * hbqt_gcAllocate_QDirModel( void * pObj ); -extern void * hbqt_gcAllocate_QDockWidget( void * pObj ); -extern void * hbqt_gcAllocate_QDoubleSpinBox( void * pObj ); -extern void * hbqt_gcAllocate_QDropEvent( void * pObj ); -extern void * hbqt_gcAllocate_QDragMoveEvent( void * pObj ); -extern void * hbqt_gcAllocate_QDragEnterEvent( void * pObj ); -extern void * hbqt_gcAllocate_QDragLeaveEvent( void * pObj ); -extern void * hbqt_gcAllocate_QErrorMessage( void * pObj ); -extern void * hbqt_gcAllocate_QEvent( void * pObj ); -extern void * hbqt_gcAllocate_QEventLoop( void * pObj ); -extern void * hbqt_gcAllocate_QFile( void * pObj ); -extern void * hbqt_gcAllocate_QFileDialog( void * pObj ); -extern void * hbqt_gcAllocate_QFileInfo( void * pObj ); -extern void * hbqt_gcAllocate_QFileIconProvider( void * pObj ); -extern void * hbqt_gcAllocate_QFileSystemModel( void * pObj ); -extern void * hbqt_gcAllocate_QFocusEvent( void * pObj ); -extern void * hbqt_gcAllocate_QFocusFrame( void * pObj ); -extern void * hbqt_gcAllocate_QFont( void * pObj ); -extern void * hbqt_gcAllocate_QFontComboBox( void * pObj ); -extern void * hbqt_gcAllocate_QFontDatabase( void * pObj ); -extern void * hbqt_gcAllocate_QFontDialog( void * pObj ); -extern void * hbqt_gcAllocate_QFontInfo( void * pObj ); -extern void * hbqt_gcAllocate_QFontMetrics( void * pObj ); -extern void * hbqt_gcAllocate_QFontMetricsF( void * pObj ); -extern void * hbqt_gcAllocate_QFormLayout( void * pObj ); -extern void * hbqt_gcAllocate_QFrame( void * pObj ); -extern void * hbqt_gcAllocate_QFtp( void * pObj ); -extern void * hbqt_gcAllocate_QGradient( void * pObj ); -extern void * hbqt_gcAllocate_QGridLayout( void * pObj ); -extern void * hbqt_gcAllocate_QGroupBox( void * pObj ); -extern void * hbqt_gcAllocate_QHBoxLayout( void * pObj ); -extern void * hbqt_gcAllocate_QHeaderView( void * pObj ); -extern void * hbqt_gcAllocate_QHelpEvent( void * pObj ); -extern void * hbqt_gcAllocate_QHttp( void * pObj ); -extern void * hbqt_gcAllocate_QHttpHeader( void * pObj ); -extern void * hbqt_gcAllocate_QHttpRequestHeader( void * pObj ); -extern void * hbqt_gcAllocate_QHttpResponseHeader( void * pObj ); -extern void * hbqt_gcAllocate_QIcon( void * pObj ); -extern void * hbqt_gcAllocate_QInputContext( void * pObj ); -extern void * hbqt_gcAllocate_QInputMethodEvent( void * pObj ); -extern void * hbqt_gcAllocate_QImage( void * pObj ); -extern void * hbqt_gcAllocate_QImageReader( void * pObj ); -extern void * hbqt_gcAllocate_QImageWriter( void * pObj ); -extern void * hbqt_gcAllocate_QInputDialog( void * pObj ); -extern void * hbqt_gcAllocate_QInputEvent( void * pObj ); -extern void * hbqt_gcAllocate_QIODevice( void * pObj ); -extern void * hbqt_gcAllocate_QItemSelection( void * pObj ); -extern void * hbqt_gcAllocate_QItemSelectionModel( void * pObj ); -extern void * hbqt_gcAllocate_QKeyEvent( void * pObj ); -extern void * hbqt_gcAllocate_QKeySequence( void * pObj ); -extern void * hbqt_gcAllocate_QLabel( void * pObj ); -extern void * hbqt_gcAllocate_QLatin1Char( void * pObj ); -extern void * hbqt_gcAllocate_QLatin1String( void * pObj ); -extern void * hbqt_gcAllocate_QLayout( void * pObj ); -extern void * hbqt_gcAllocate_QLayoutItem( void * pObj ); -extern void * hbqt_gcAllocate_QLCDNumber( void * pObj ); -extern void * hbqt_gcAllocate_QLine( void * pObj ); -extern void * hbqt_gcAllocate_QLineF( void * pObj ); -extern void * hbqt_gcAllocate_QLinearGradient( void * pObj ); -extern void * hbqt_gcAllocate_QLineEdit( void * pObj ); -extern void * hbqt_gcAllocate_QList( void * pObj ); -extern void * hbqt_gcAllocate_QListView( void * pObj ); -extern void * hbqt_gcAllocate_QListWidget( void * pObj ); -extern void * hbqt_gcAllocate_QListWidgetItem( void * pObj ); -extern void * hbqt_gcAllocate_QLocale( void * pObj ); -extern void * hbqt_gcAllocate_QMainWindow( void * pObj ); -extern void * hbqt_gcAllocate_QMatrix( void * pObj ); -extern void * hbqt_gcAllocate_QMdiArea( void * pObj ); -extern void * hbqt_gcAllocate_QMdiSubWindow( void * pObj ); -extern void * hbqt_gcAllocate_QMenu( void * pObj ); -extern void * hbqt_gcAllocate_QMenuBar( void * pObj ); -extern void * hbqt_gcAllocate_QMessageBox( void * pObj ); -extern void * hbqt_gcAllocate_QMimeData( void * pObj ); -extern void * hbqt_gcAllocate_QModelIndex( void * pObj ); -extern void * hbqt_gcAllocate_QMouseEvent( void * pObj ); -extern void * hbqt_gcAllocate_QMoveEvent( void * pObj ); -extern void * hbqt_gcAllocate_QMovie( void * pObj ); -extern void * hbqt_gcAllocate_QNetworkRequest( void * pObj ); -extern void * hbqt_gcAllocate_QObject( void * pObj ); -extern void * hbqt_gcAllocate_QPaintDevice( void * pObj ); -extern void * hbqt_gcAllocate_QPainterPath( void * pObj ); -extern void * hbqt_gcAllocate_QPageSetupDialog( void * pObj ); -extern void * hbqt_gcAllocate_QPainter( void * pObj ); -extern void * hbqt_gcAllocate_QPaintEvent( void * pObj ); -extern void * hbqt_gcAllocate_QPalette( void * pObj ); -extern void * hbqt_gcAllocate_QPen( void * pObj ); -extern void * hbqt_gcAllocate_QPicture( void * pObj ); -extern void * hbqt_gcAllocate_QPixmap( void * pObj ); -extern void * hbqt_gcAllocate_QPlainTextEdit( void * pObj ); -extern void * hbqt_gcAllocate_QPoint( void * pObj ); -extern void * hbqt_gcAllocate_QPointF( void * pObj ); -extern void * hbqt_gcAllocate_QPolygon( void * pObj ); -extern void * hbqt_gcAllocate_QPolygonF( void * pObj ); -extern void * hbqt_gcAllocate_QPrintDialog( void * pObj ); -extern void * hbqt_gcAllocate_QPrintEngine( void * pObj ); -extern void * hbqt_gcAllocate_QPrinter( void * pObj ); -extern void * hbqt_gcAllocate_QPrintPreviewDialog( void * pObj ); -extern void * hbqt_gcAllocate_QProcess( void * pObj ); -extern void * hbqt_gcAllocate_QProgressBar( void * pObj ); -extern void * hbqt_gcAllocate_QProgressDialog( void * pObj ); -extern void * hbqt_gcAllocate_QPushButton( void * pObj ); -extern void * hbqt_gcAllocate_QRadialGradient( void * pObj ); -extern void * hbqt_gcAllocate_QRadioButton( void * pObj ); -extern void * hbqt_gcAllocate_QRect( void * pObj ); -extern void * hbqt_gcAllocate_QRectF( void * pObj ); -extern void * hbqt_gcAllocate_QRegion( void * pObj ); -extern void * hbqt_gcAllocate_QRegExp( void * pObj ); -extern void * hbqt_gcAllocate_QResizeEvent( void * pObj ); -extern void * hbqt_gcAllocate_QResource( void * pObj ); -extern void * hbqt_gcAllocate_QScrollArea( void * pObj ); -extern void * hbqt_gcAllocate_QScrollBar( void * pObj ); -extern void * hbqt_gcAllocate_QSessionManager( void * pObj ); -extern void * hbqt_gcAllocate_QSettings( void * pObj ); -extern void * hbqt_gcAllocate_QSignalMapper( void * pObj ); -extern void * hbqt_gcAllocate_QSize( void * pObj ); -extern void * hbqt_gcAllocate_QSizeF( void * pObj ); -extern void * hbqt_gcAllocate_QSizeGrip( void * pObj ); -extern void * hbqt_gcAllocate_QSizePolicy( void * pObj ); -extern void * hbqt_gcAllocate_QSlider( void * pObj ); -extern void * hbqt_gcAllocate_QSound( void * pObj ); -extern void * hbqt_gcAllocate_QSpacerItem( void * pObj ); -extern void * hbqt_gcAllocate_QSpinBox( void * pObj ); -extern void * hbqt_gcAllocate_QSplashScreen( void * pObj ); -extern void * hbqt_gcAllocate_QSplitter( void * pObj ); -extern void * hbqt_gcAllocate_QStandardItem( void * pObj ); -extern void * hbqt_gcAllocate_QStandardItemModel( void * pObj ); -extern void * hbqt_gcAllocate_QStatusBar( void * pObj ); -extern void * hbqt_gcAllocate_QStringList( void * pObj ); -extern void * hbqt_gcAllocate_QStringListModel( void * pObj ); -extern void * hbqt_gcAllocate_QStyle( void * pObj ); -extern void * hbqt_gcAllocate_QStyledItemDelegate( void * pObj ); -extern void * hbqt_gcAllocate_QStyleFactory( void * pObj ); -extern void * hbqt_gcAllocate_QStyleHintReturn( void * pObj ); -extern void * hbqt_gcAllocate_QStyleHintReturnMask( void * pObj ); -extern void * hbqt_gcAllocate_QStyleHintReturnVariant( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOption( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionButton( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionComboBox( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionComplex( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionDockWidget( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionFocusRect( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionFrame( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionGroupBox( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionHeader( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionMenuItem( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionProgressBar( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionSizeGrip( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionSlider( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionSpinBox( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionTab( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionTabBarBase( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionTabWidgetFrame( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionTitleBar( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionToolBar( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionToolBox( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionToolButton( void * pObj ); -extern void * hbqt_gcAllocate_QStyleOptionViewItem( void * pObj ); -extern void * hbqt_gcAllocate_QStylePainter( void * pObj ); -extern void * hbqt_gcAllocate_QSyntaxHighlighter( void * pObj ); -extern void * hbqt_gcAllocate_QSystemTrayIcon( void * pObj ); -extern void * hbqt_gcAllocate_QTabBar( void * pObj ); -extern void * hbqt_gcAllocate_QTableView( void * pObj ); -extern void * hbqt_gcAllocate_QTableWidget( void * pObj ); -extern void * hbqt_gcAllocate_QTableWidgetItem( void * pObj ); -extern void * hbqt_gcAllocate_QTabWidget( void * pObj ); -extern void * hbqt_gcAllocate_QTableWidgetSelectionRange( void * pObj ); -extern void * hbqt_gcAllocate_QTextBlock( void * pObj ); -extern void * hbqt_gcAllocate_QTextBlockFormat( void * pObj ); -extern void * hbqt_gcAllocate_QTextBlockGroup( void * pObj ); -extern void * hbqt_gcAllocate_QTextBrowser( void * pObj ); -extern void * hbqt_gcAllocate_QTextBoundaryFinder( void * pObj ); -extern void * hbqt_gcAllocate_QTextCharFormat( void * pObj ); -extern void * hbqt_gcAllocate_QTextCodec( void * pObj ); -extern void * hbqt_gcAllocate_QTextCursor( void * pObj ); -extern void * hbqt_gcAllocate_QTextDecoder( void * pObj ); -extern void * hbqt_gcAllocate_QTextDocument( void * pObj ); -extern void * hbqt_gcAllocate_QTextDocumentFragment( void * pObj ); -extern void * hbqt_gcAllocate_QTextDocumentWriter( void * pObj ); -extern void * hbqt_gcAllocate_QTextEdit( void * pObj ); -extern void * hbqt_gcAllocate_QTextEncoder( void * pObj ); -extern void * hbqt_gcAllocate_QTextFormat( void * pObj ); -extern void * hbqt_gcAllocate_QTextFragment( void * pObj ); -extern void * hbqt_gcAllocate_QTextFrame( void * pObj ); -extern void * hbqt_gcAllocate_QTextFrameFormat( void * pObj ); -extern void * hbqt_gcAllocate_QTextImageFormat( void * pObj ); -extern void * hbqt_gcAllocate_QTextInlineObject( void * pObj ); -extern void * hbqt_gcAllocate_QTextItem( void * pObj ); -extern void * hbqt_gcAllocate_QTextLayout( void * pObj ); -extern void * hbqt_gcAllocate_QTextLength( void * pObj ); -extern void * hbqt_gcAllocate_QTextLine( void * pObj ); -extern void * hbqt_gcAllocate_QTextListFormat( void * pObj ); -extern void * hbqt_gcAllocate_QTextObject( void * pObj ); -extern void * hbqt_gcAllocate_QTextOption( void * pObj ); -extern void * hbqt_gcAllocate_QTextStream( void * pObj ); -extern void * hbqt_gcAllocate_QTextTableFormat( void * pObj ); -extern void * hbqt_gcAllocate_QThread( void * pObj ); -extern void * hbqt_gcAllocate_QTime( void * pObj ); -extern void * hbqt_gcAllocate_QTimeEdit( void * pObj ); -extern void * hbqt_gcAllocate_QTimer( void * pObj ); -extern void * hbqt_gcAllocate_QToolBar( void * pObj ); -extern void * hbqt_gcAllocate_QToolBox( void * pObj ); -extern void * hbqt_gcAllocate_QToolButton( void * pObj ); -extern void * hbqt_gcAllocate_QTransform( void * pObj ); -extern void * hbqt_gcAllocate_QTranslator( void * pObj ); -extern void * hbqt_gcAllocate_QTreeView( void * pObj ); -extern void * hbqt_gcAllocate_QTreeWidget( void * pObj ); -extern void * hbqt_gcAllocate_QTreeWidgetItem( void * pObj ); -extern void * hbqt_gcAllocate_QUiLoader( void * pObj ); -extern void * hbqt_gcAllocate_QUrl( void * pObj ); -extern void * hbqt_gcAllocate_QValidator( void * pObj ); -extern void * hbqt_gcAllocate_QVariant( void * pObj ); -extern void * hbqt_gcAllocate_QVBoxLayout( void * pObj ); -extern void * hbqt_gcAllocate_QWebFrame( void * pObj ); -extern void * hbqt_gcAllocate_QWebHistory( void * pObj ); -extern void * hbqt_gcAllocate_QWebHistoryInterface( void * pObj ); -extern void * hbqt_gcAllocate_QWebHistoryItem( void * pObj ); -extern void * hbqt_gcAllocate_QWebHitTestResult( void * pObj ); -extern void * hbqt_gcAllocate_QWebPage( void * pObj ); -extern void * hbqt_gcAllocate_QWebPluginFactory( void * pObj ); -extern void * hbqt_gcAllocate_QWebSecurityOrigin( void * pObj ); -extern void * hbqt_gcAllocate_QWebSettings( void * pObj ); -extern void * hbqt_gcAllocate_QWebView( void * pObj ); -extern void * hbqt_gcAllocate_QWheelEvent( void * pObj ); -extern void * hbqt_gcAllocate_QWidget( void * pObj ); -extern void * hbqt_gcAllocate_QWidgetAction( void * pObj ); -extern void * hbqt_gcAllocate_QWidgetItem( void * pObj ); -extern void * hbqt_gcAllocate_QWindowsStyle( void * pObj ); -extern void * hbqt_gcAllocate_QWizard( void * pObj ); -extern void * hbqt_gcAllocate_QWizardPage( void * pObj ); +extern void * hbqt_gcAllocate_HBQTextBlockUserData( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QAbstractButton( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QAbstractItemDelegate( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QAbstractItemModel( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QAbstractItemView( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QAbstractListModel( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QAbstractProxyModel( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QAbstractPrintDialog( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QAbstractScrollArea( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QAbstractSlider( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QAbstractSpinBox( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QAbstractTableModel( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QAbstractTextDocumentLayout( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QAction( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QActionGroup( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QApplication( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QBitArray( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QBitmap( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QBoxLayout( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QBrush( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QButtonGroup( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QByteArray( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QCalendarWidget( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QCheckBox( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QClipboard( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QColor( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QColorDialog( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QComboBox( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QCommandLinkButton( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QCommonStyle( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QCompleter( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QConicalGradient( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QContextMenuEvent( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QCoreApplication( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QCursor( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QDataStream( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QDate( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QDateEdit( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QDateTime( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QDateTimeEdit( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QDesktopWidget( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QDial( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QDialog( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QDir( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QDirModel( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QDockWidget( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QDoubleSpinBox( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QDropEvent( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QDragMoveEvent( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QDragEnterEvent( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QDragLeaveEvent( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QErrorMessage( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QEvent( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QEventLoop( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QFile( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QFileDialog( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QFileInfo( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QFileIconProvider( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QFileSystemModel( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QFocusEvent( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QFocusFrame( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QFont( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QFontComboBox( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QFontDatabase( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QFontDialog( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QFontInfo( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QFontMetrics( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QFontMetricsF( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QFormLayout( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QFrame( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QFtp( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QGradient( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QGridLayout( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QGroupBox( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QHBoxLayout( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QHeaderView( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QHelpEvent( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QHttp( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QHttpHeader( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QHttpRequestHeader( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QHttpResponseHeader( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QIcon( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QInputContext( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QInputMethodEvent( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QImage( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QImageReader( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QImageWriter( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QInputDialog( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QInputEvent( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QIODevice( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QItemSelection( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QItemSelectionModel( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QKeyEvent( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QKeySequence( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QLabel( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QLatin1Char( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QLatin1String( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QLayout( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QLayoutItem( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QLCDNumber( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QLine( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QLineF( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QLinearGradient( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QLineEdit( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QList( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QListView( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QListWidget( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QListWidgetItem( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QLocale( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QMainWindow( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QMatrix( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QMdiArea( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QMdiSubWindow( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QMenu( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QMenuBar( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QMessageBox( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QMimeData( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QModelIndex( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QMouseEvent( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QMoveEvent( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QMovie( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QNetworkRequest( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QObject( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPageSetupDialog( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPaintDevice( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPaintEngine( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPainter( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPainterPath( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPaintEvent( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPalette( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPen( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPicture( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPixmap( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPlainTextEdit( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPoint( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPointF( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPolygon( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPolygonF( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPrintDialog( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPrintEngine( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPrinter( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPrintPreviewDialog( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QProcess( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QProgressBar( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QProgressDialog( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPushButton( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QRadialGradient( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QRadioButton( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QRect( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QRectF( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QRegion( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QRegExp( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QResizeEvent( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QResource( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QScrollArea( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QScrollBar( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QSessionManager( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QSettings( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QSignalMapper( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QSize( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QSizeF( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QSizeGrip( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QSizePolicy( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QSlider( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QSound( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QSpacerItem( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QSpinBox( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QSplashScreen( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QSplitter( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStandardItem( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStandardItemModel( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStatusBar( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStringList( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStringListModel( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyle( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyledItemDelegate( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleFactory( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleHintReturn( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleHintReturnMask( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleHintReturnVariant( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOption( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionButton( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionComboBox( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionComplex( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionDockWidget( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionFocusRect( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionFrame( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionGroupBox( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionHeader( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionMenuItem( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionProgressBar( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionSizeGrip( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionSlider( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionSpinBox( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionTab( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionTabBarBase( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionTabWidgetFrame( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionTitleBar( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionToolBar( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionToolBox( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionToolButton( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStyleOptionViewItem( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStylePainter( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QSyntaxHighlighter( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QSystemTrayIcon( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTabBar( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTableView( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTableWidget( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTableWidgetItem( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTabWidget( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTableWidgetSelectionRange( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextBlock( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextBlockFormat( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextBlockGroup( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextBrowser( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextBoundaryFinder( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextCharFormat( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextCodec( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextCursor( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextDecoder( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextDocument( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextDocumentFragment( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextDocumentWriter( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextEdit( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextEncoder( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextFormat( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextFragment( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextFrame( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextFrameFormat( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextImageFormat( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextInlineObject( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextItem( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextLayout( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextLength( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextLine( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextList( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextListFormat( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextObject( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextOption( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextStream( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTextTableFormat( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QThread( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTime( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTimeEdit( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTimer( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QToolBar( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QToolBox( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QToolButton( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTransform( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTranslator( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTreeView( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTreeWidget( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTreeWidgetItem( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QUiLoader( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QUrl( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QValidator( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QVariant( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QVBoxLayout( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWebFrame( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWebHistory( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWebHistoryInterface( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWebHistoryItem( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWebHitTestResult( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWebPage( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWebPluginFactory( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWebSecurityOrigin( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWebSettings( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWebView( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWheelEvent( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWidget( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWidgetAction( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWidgetItem( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWindowsStyle( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWizard( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWizardPage( void * pObj, bool bNew ); diff --git a/harbour/contrib/hbqt/hbqt_hbdbfmodel.cpp b/harbour/contrib/hbqt/hbqt_hbdbfmodel.cpp index 7ba60a7ac5..76faea719d 100644 --- a/harbour/contrib/hbqt/hbqt_hbdbfmodel.cpp +++ b/harbour/contrib/hbqt/hbqt_hbdbfmodel.cpp @@ -309,6 +309,7 @@ void HBDbfModel::hbSetRowColumns( int rows, int cols ) typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< HBDbfModel > pq; } QGC_POINTER_HBDbfModel; @@ -317,26 +318,14 @@ static QT_G_FUNC( hbqt_release_HBDbfModel ) { QGC_POINTER_HBDbfModel * p = ( QGC_POINTER_HBDbfModel * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "release_HBDbfModel p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "release_HBDbfModel ph=%p pq=%p", p->ph, (void *)(p->pq))); - +if( p->bNew ) +{ if( p && p->ph && p->pq ) { const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); if( ( QString ) m->className() != ( QString ) "QObject" ) { - switch( hbqt_get_object_release_method() ) - { - case HBQT_RELEASE_WITH_DELETE: - delete ( ( HBDbfModel * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( HBDbfModel * ) p->ph )->~HBDbfModel(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( HBDbfModel * ) p->ph )->deleteLater(); - break; - } + delete ( ( HBDbfModel * ) p->ph ); p->ph = NULL; HB_TRACE( HB_TR_DEBUG, ( "release_HBDbfModel Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } @@ -350,12 +339,19 @@ static QT_G_FUNC( hbqt_release_HBDbfModel ) HB_TRACE( HB_TR_DEBUG, ( "DEL release_HBDbfModel Object Already deleted!" ) ); } } +else +{ + HB_TRACE( HB_TR_ALWAYS, ( "PTR_rel_HBDbfModel Object not created with - new" ) ); + p->ph = NULL; +} +} -static void * hbqt_gcAllocate_HBDbfModel( void * pObj ) +static void * hbqt_gcAllocate_HBDbfModel( void * pObj, bool bNew ) { QGC_POINTER_HBDbfModel * p = ( QGC_POINTER_HBDbfModel * ) hb_gcAllocate( sizeof( QGC_POINTER_HBDbfModel ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_release_HBDbfModel; new( & p->pq ) QPointer< HBDbfModel >( ( HBDbfModel * ) pObj ); HB_TRACE( HB_TR_DEBUG, ( " new_HBDbfModel %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); @@ -368,7 +364,7 @@ HB_FUNC( QT_HBDBFMODEL ) pObj = ( HBDbfModel * ) new HBDbfModel( ( PHB_ITEM ) hb_param( 1, HB_IT_BLOCK ) ); - hb_retptrGC( hbqt_gcAllocate_HBDbfModel( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_HBDbfModel( pObj, true ) ); } HB_FUNC( QT_HBDBFMODEL_RESET ) @@ -378,7 +374,7 @@ HB_FUNC( QT_HBDBFMODEL_RESET ) HB_FUNC( QT_HBDBFMODEL_INDEX ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_HBDbfModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), QModelIndex() ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_HBDbfModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), QModelIndex() ) ), true ) ); } HB_FUNC( QT_HBDBFMODEL_HBSETROWCOLUMNS ) diff --git a/harbour/contrib/hbqt/hbqt_hbevents.cpp b/harbour/contrib/hbqt/hbqt_hbevents.cpp index e0acc094c3..acb85fd545 100644 --- a/harbour/contrib/hbqt/hbqt_hbevents.cpp +++ b/harbour/contrib/hbqt/hbqt_hbevents.cpp @@ -70,6 +70,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< HBEvents > pq; } QGC_POINTER_HBEvents; @@ -78,45 +79,42 @@ static QT_G_FUNC( hbqt_release_HBEvents ) { QGC_POINTER_HBEvents * p = ( QGC_POINTER_HBEvents * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "release_HBEvents p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "release_HBEvents ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( HBEvents * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( HBEvents * ) p->ph )->~HBEvents(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( HBEvents * ) p->ph )->deleteLater(); - break; + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_HBEvents Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO release_HBEvents Object Name Missing!" ) ); + p->ph = NULL; } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "release_HBEvents Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO release_HBEvents Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL release_HBEvents Object Already deleted!" ) ); + p->ph = NULL; } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL release_HBEvents Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_HBEvents : Object not created with - new" ) ); + p->ph = NULL; } } -static void * hbqt_gcAllocate_HBEvents( void * pObj ) +static void * hbqt_gcAllocate_HBEvents( void * pObj, bool bNew ) { QGC_POINTER_HBEvents * p = ( QGC_POINTER_HBEvents * ) hb_gcAllocate( sizeof( QGC_POINTER_HBEvents ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_release_HBEvents; new( & p->pq ) QPointer< HBEvents >( ( HBEvents * ) pObj ); HB_TRACE( HB_TR_DEBUG, ( " new_HBEvents %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); @@ -251,7 +249,7 @@ HB_FUNC( QT_EVENTS_NEW ) pObj = ( HBEvents * ) new HBEvents(); - hb_retptrGC( hbqt_gcAllocate_HBEvents( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_HBEvents( pObj, true ) ); } #endif diff --git a/harbour/contrib/hbqt/hbqt_hbqmainwindow.cpp b/harbour/contrib/hbqt/hbqt_hbqmainwindow.cpp index be25a9c29a..7ab079eb88 100644 --- a/harbour/contrib/hbqt/hbqt_hbqmainwindow.cpp +++ b/harbour/contrib/hbqt/hbqt_hbqmainwindow.cpp @@ -255,6 +255,7 @@ void HBQMainWindow::closeEvent( QCloseEvent * event ) typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< HBQMainWindow > pq; } QGC_POINTER_HBQMainWindow; @@ -263,45 +264,42 @@ static QT_G_FUNC( release_HBQMainWindow ) { QGC_POINTER_HBQMainWindow * p = ( QGC_POINTER_HBQMainWindow * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "release_HBQMainWindow p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "release_HBQMainWindow ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p && p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( HBQMainWindow * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( HBQMainWindow * ) p->ph )->~HBQMainWindow(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( HBQMainWindow * ) p->ph )->deleteLater(); - break; + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_HBQMainWindow Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_HBQMainWindow : Object Name Missing!" ) ); + p->ph = NULL; } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "release_HBQMainWindow Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO release_HBQMainWindow Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_HBQMainWindow : Object Already deleted!" ) ); + p->ph = NULL; } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL release_HBQMainWindow Object Already deleted!" ) ); + HB_TRACE( HB_TR_ALWAYS, ( "PTR_rel_HBQMainWindow : Object not created with - new" ) ); + p->ph = NULL; } } -static void * hbqt_gcAllocate_HBQMainWindow( void * pObj ) +static void * hbqt_gcAllocate_HBQMainWindow( void * pObj, bool bNew ) { QGC_POINTER_HBQMainWindow * p = ( QGC_POINTER_HBQMainWindow * ) hb_gcAllocate( sizeof( QGC_POINTER_HBQMainWindow ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = release_HBQMainWindow; new( & p->pq ) QPointer< HBQMainWindow >( ( HBQMainWindow * ) pObj ); HB_TRACE( HB_TR_DEBUG, ( " new_HBQMainWindow %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); @@ -314,7 +312,7 @@ HB_FUNC( QT_HBQMAINWINDOW ) pObj = ( HBQMainWindow * ) new HBQMainWindow( hb_itemNew( hb_param( 1, HB_IT_BLOCK ) ), hb_parni( 2 ) ); - hb_retptrGC( hbqt_gcAllocate_HBQMainWindow( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_HBQMainWindow( pObj, true ) ); } #endif diff --git a/harbour/contrib/hbqt/hbqt_hbqsyntaxhighlighter.cpp b/harbour/contrib/hbqt/hbqt_hbqsyntaxhighlighter.cpp index 04067167d5..dc3e40dbad 100644 --- a/harbour/contrib/hbqt/hbqt_hbqsyntaxhighlighter.cpp +++ b/harbour/contrib/hbqt/hbqt_hbqsyntaxhighlighter.cpp @@ -63,8 +63,7 @@ #include #include -HBQTextBlockUserData::HBQTextBlockUserData() - : QTextBlockUserData() +HBQTextBlockUserData::HBQTextBlockUserData() : QTextBlockUserData() { state = -1; } @@ -75,6 +74,10 @@ void HBQTextBlockUserData::setData( int iState ) { state = iState; } +HBQTextBlockUserData * HBQTextBlockUserData::data( const QTextBlock& block ) +{ + return static_cast( block.userData() ); +} HBQSyntaxHighlighter::HBQSyntaxHighlighter( QTextDocument * parent ) @@ -136,6 +139,13 @@ void HBQSyntaxHighlighter::highlightBlock( const QString &text ) #endif QRegExp expression; + QTextBlock curBlock( currentBlock() ); + bool bMerge = false; + //HBQTextBlockUserData * data = HBQTextBlockUserData::data( curBlock ); + HBQTextBlockUserData * data = ( HBQTextBlockUserData * ) curBlock.userData(); + + if( data ) + bMerge = ( data->state == 99 ); foreach( const hHighlightingRule &rule, hhighlightingRules ) { @@ -144,7 +154,17 @@ void HBQSyntaxHighlighter::highlightBlock( const QString &text ) while( index >= 0 ) { int length = expression.matchedLength(); - setFormat( index, length, rule.format ); + QTextBlockFormat tBlockFormat( curBlock.blockFormat() ); + QBrush brush( tBlockFormat.background() ); + + if( bMerge ) + { + HB_TRACE( HB_TR_ALWAYS, ( "text = %s", ( char * ) &text ) ); + setFormat( index, length, rule.format ); + } + else + setFormat( index, length, rule.format ); + index = expression.indexIn( text, index + length ); } } @@ -292,48 +312,4 @@ HB_FUNC( QT_HBQSYNTAXHIGHLIGHTER_SETHBFORMAT ) hbqt_par_HBQSyntaxHighlighter( 1 )->setHBFormat( hbqt_par_QString( 2 ), *hbqt_par_QTextCharFormat( 3 ) ); } - - - - -QT_G_FUNC( hbqt_gcRelease_HBQTextBlockUserData ) -{ - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - - if( p && p->ph ) - { - delete ( ( HBQTextBlockUserData * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_HBQTextBlockUserData Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); - } - else - { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_HBQTextBlockUserData Object Already deleted!" ) ); - } -} - -void * hbqt_gcAllocate_HBQTextBlockUserData( void * pObj ) -{ - QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); - - p->ph = pObj; - p->func = hbqt_gcRelease_HBQTextBlockUserData; - HB_TRACE( HB_TR_DEBUG, ( " new_HBQTextBlockUserData %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); - return p; -} - -HB_FUNC( QT_HBQTEXTBLOCKUSERDATA ) -{ - void * pObj = NULL; - - pObj = new HBQTextBlockUserData(); - - hb_retptrGC( hbqt_gcAllocate_HBQTextBlockUserData( pObj ) ); -} - -HB_FUNC( QT_HBQTEXTBLOCKUSERDATA_SETDATA ) -{ - hbqt_par_HBQTextBlockUserData( 1 )->setData( hb_parni( 2 ) ); -} - #endif diff --git a/harbour/contrib/hbqt/hbqt_hbqsyntaxhighlighter.h b/harbour/contrib/hbqt/hbqt_hbqsyntaxhighlighter.h index 9f76d100cf..8d96f113ee 100644 --- a/harbour/contrib/hbqt/hbqt_hbqsyntaxhighlighter.h +++ b/harbour/contrib/hbqt/hbqt_hbqsyntaxhighlighter.h @@ -67,6 +67,8 @@ public: HBQTextBlockUserData(); ~HBQTextBlockUserData(); + HBQTextBlockUserData * data( const QTextBlock& block ); + void setData( int state ); int state; diff --git a/harbour/contrib/hbqt/hbqt_hbqtableview.cpp b/harbour/contrib/hbqt/hbqt_hbqtableview.cpp index 9f49390060..98b6fdf374 100644 --- a/harbour/contrib/hbqt/hbqt_hbqtableview.cpp +++ b/harbour/contrib/hbqt/hbqt_hbqtableview.cpp @@ -131,6 +131,7 @@ void HBQTableView::scrollTo( const QModelIndex & index, QAbstractItemView::Scrol typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< HBQTableView > pq; } QGC_POINTER_HBQTableView; @@ -139,45 +140,42 @@ static QT_G_FUNC( release_HBQTableView ) { QGC_POINTER_HBQTableView * p = ( QGC_POINTER_HBQTableView * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "release_HBQTableView p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "release_HBQTableView ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + HB_TRACE( HB_TR_DEBUG, ( "release_HBQTableView ph=%p pq=%p", p->ph, (void *)(p->pq))); + + if( p && p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( HBQTableView * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( HBQTableView * ) p->ph )->~HBQTableView(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( HBQTableView * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_HBQTableView ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_HBQTableView Object Name Missing!" ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "release_HBQTableView Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO release_HBQTableView Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_HBQTableView Object Already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL release_HBQTableView Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_HBQTableView Object not created with - new" ) ); + p->ph = NULL; } } -static void * hbqt_gcAllocate_HBQTableView( void * pObj ) +static void * hbqt_gcAllocate_HBQTableView( void * pObj, bool bNew ) { QGC_POINTER_HBQTableView * p = ( QGC_POINTER_HBQTableView * ) hb_gcAllocate( sizeof( QGC_POINTER_HBQTableView ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = release_HBQTableView; new( & p->pq ) QPointer< HBQTableView >( ( HBQTableView * ) pObj ); HB_TRACE( HB_TR_DEBUG, ( " new_HBQTableView %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); @@ -188,14 +186,14 @@ HB_FUNC( QT_HBQTABLEVIEW ) { void * pObj = NULL; - pObj = ( HBQTableView* ) new HBQTableView( hbqt_par_QWidget( 1 ) ) ; + pObj = new HBQTableView( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_HBQTableView( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_HBQTableView( pObj, true ) ); } HB_FUNC( QT_HBQTABLEVIEW_NAVIGATE ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_HBQTableView( 1 )->navigate( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_HBQTableView( 1 )->navigate( hb_parni( 2 ) ) ), true ) ); } #endif diff --git a/harbour/contrib/hbqt/hbqt_hbslots.cpp b/harbour/contrib/hbqt/hbqt_hbslots.cpp index 3bd9382a22..7154711f08 100644 --- a/harbour/contrib/hbqt/hbqt_hbslots.cpp +++ b/harbour/contrib/hbqt/hbqt_hbslots.cpp @@ -329,6 +329,7 @@ static bool disconnect_signal( QObject * object, const char * signal ) typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< HBSlots > pq; } QGC_POINTER_HBSlots; @@ -337,45 +338,40 @@ static QT_G_FUNC( hbqt_release_HBSlots ) { QGC_POINTER_HBSlots * p = ( QGC_POINTER_HBSlots * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "release_HBSlots p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "release_HBSlots ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( HBSlots * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( HBSlots * ) p->ph )->~HBSlots(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( HBSlots * ) p->ph )->deleteLater(); - break; + p->ph = NULL; + HB_TRACE( HB_TR_DEBUG, ( "release_HBSlots Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO release_HBSlots Object Name Missing!" ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "release_HBSlots Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO release_HBSlots Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_HBSlots : Object Already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL release_HBSlots Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_HBSlots : Object not created with - new" ) ); + p->ph = NULL; } } -static void * hbqt_gcAllocate_HBSlots( void * pObj ) +static void * hbqt_gcAllocate_HBSlots( void * pObj, bool bNew ) { QGC_POINTER_HBSlots * p = ( QGC_POINTER_HBSlots * ) hb_gcAllocate( sizeof( QGC_POINTER_HBSlots ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_release_HBSlots; new( & p->pq ) QPointer< HBSlots >( ( HBSlots * ) pObj ); HB_TRACE( HB_TR_DEBUG, ( " new_HBSlots %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); @@ -576,7 +572,6 @@ static void hbqt_SlotsExecQTextCursor( HBSlots * t_slots, QObject * object, cons { PHB_ITEM pObject = hb_itemPutPtr( NULL, object ); PHB_ITEM p1 = hb_itemPutPtr( NULL, new QTextCursor( cursor ) ); - //PHB_ITEM p1 = hb_itemPutPtr( NULL, *cursor ); hb_vmEvalBlockV( t_slots->listBlock.at( i - 1 ), 2, pObject, p1 ); hb_itemRelease( pObject ); delete ( ( QTextCursor * ) hb_itemGetPtr( p1 ) ); @@ -912,6 +907,7 @@ HB_FUNC( QT_SLOTS_DISCONNECT ) if( object ) { const char * signal = hb_parcx( 3 ); + int i = object->property( signal ).toInt(); if( i > 0 && i <= t_slots->listBlock.size() ) @@ -922,7 +918,7 @@ HB_FUNC( QT_SLOTS_DISCONNECT ) bRet = ( disconnect_signal( object, signal ) == true ); - //HB_TRACE( HB_TR_DEBUG, ( " QT_SLOTS_DISCONNECT: %s %s", bRet ? "YES" : "NO", signal ) ); + HB_TRACE( HB_TR_DEBUG, ( " QT_SLOTS_DISCONNECT: %s %s", bRet ? "YES" : "NO", signal ) ); } } } @@ -936,7 +932,7 @@ HB_FUNC( QT_SLOTS_NEW ) pObj = ( HBSlots * ) new HBSlots(); - hb_retptrGC( hbqt_gcAllocate_HBSlots( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_HBSlots( pObj, true ) ); } #endif diff --git a/harbour/contrib/hbqt/qtcore/QAbstractItemModel.cpp b/harbour/contrib/hbqt/qtcore/QAbstractItemModel.cpp index a5ba516fd1..1bff8314aa 100644 --- a/harbour/contrib/hbqt/qtcore/QAbstractItemModel.cpp +++ b/harbour/contrib/hbqt/qtcore/QAbstractItemModel.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -96,11 +96,35 @@ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QAbstractItemModel > pq; +} QGC_POINTER_QAbstractItemModel; + QT_G_FUNC( hbqt_gcRelease_QAbstractItemModel ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QAbstractItemModel( void * pObj, bool bNew ) +{ + QGC_POINTER_QAbstractItemModel * p = ( QGC_POINTER_QAbstractItemModel * ) hb_gcAllocate( sizeof( QGC_POINTER_QAbstractItemModel ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QAbstractItemModel; + + if( bNew ) + { + new( & p->pq ) QPointer< QAbstractItemModel >( ( QAbstractItemModel * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QAbstractItemModel ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QABSTRACTITEMMODEL ) { } @@ -109,7 +133,7 @@ HB_FUNC( QT_QABSTRACTITEMMODEL ) */ HB_FUNC( QT_QABSTRACTITEMMODEL_BUDDY ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemModel( 1 )->buddy( *hbqt_par_QModelIndex( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemModel( 1 )->buddy( *hbqt_par_QModelIndex( 2 ) ) ), true ) ); } /* @@ -133,7 +157,7 @@ HB_FUNC( QT_QABSTRACTITEMMODEL_COLUMNCOUNT ) */ HB_FUNC( QT_QABSTRACTITEMMODEL_DATA ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QAbstractItemModel( 1 )->data( *hbqt_par_QModelIndex( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : Qt::DisplayRole ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QAbstractItemModel( 1 )->data( *hbqt_par_QModelIndex( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : Qt::DisplayRole ) ) ), true ) ); } /* @@ -181,7 +205,7 @@ HB_FUNC( QT_QABSTRACTITEMMODEL_HASINDEX ) */ HB_FUNC( QT_QABSTRACTITEMMODEL_HEADERDATA ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QAbstractItemModel( 1 )->headerData( hb_parni( 2 ), ( Qt::Orientation ) hb_parni( 3 ), ( HB_ISNUM( 4 ) ? hb_parni( 4 ) : Qt::DisplayRole ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QAbstractItemModel( 1 )->headerData( hb_parni( 2 ), ( Qt::Orientation ) hb_parni( 3 ), ( HB_ISNUM( 4 ) ? hb_parni( 4 ) : Qt::DisplayRole ) ) ), true ) ); } /* @@ -189,7 +213,7 @@ HB_FUNC( QT_QABSTRACTITEMMODEL_HEADERDATA ) */ HB_FUNC( QT_QABSTRACTITEMMODEL_INDEX ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QModelIndex( 4 ) : QModelIndex() ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QModelIndex( 4 ) : QModelIndex() ) ) ), true ) ); } /* @@ -229,7 +253,7 @@ HB_FUNC( QT_QABSTRACTITEMMODEL_INSERTROWS ) */ HB_FUNC( QT_QABSTRACTITEMMODEL_MIMETYPES ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QAbstractItemModel( 1 )->mimeTypes() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QAbstractItemModel( 1 )->mimeTypes() ), true ) ); } /* @@ -237,7 +261,7 @@ HB_FUNC( QT_QABSTRACTITEMMODEL_MIMETYPES ) */ HB_FUNC( QT_QABSTRACTITEMMODEL_PARENT ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemModel( 1 )->parent( *hbqt_par_QModelIndex( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemModel( 1 )->parent( *hbqt_par_QModelIndex( 2 ) ) ), true ) ); } /* @@ -309,7 +333,7 @@ HB_FUNC( QT_QABSTRACTITEMMODEL_SETSUPPORTEDDRAGACTIONS ) */ HB_FUNC( QT_QABSTRACTITEMMODEL_SIBLING ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemModel( 1 )->sibling( hb_parni( 2 ), hb_parni( 3 ), *hbqt_par_QModelIndex( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemModel( 1 )->sibling( hb_parni( 2 ), hb_parni( 3 ), *hbqt_par_QModelIndex( 4 ) ) ), true ) ); } /* @@ -325,7 +349,7 @@ HB_FUNC( QT_QABSTRACTITEMMODEL_SORT ) */ HB_FUNC( QT_QABSTRACTITEMMODEL_SPAN ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QAbstractItemModel( 1 )->span( *hbqt_par_QModelIndex( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QAbstractItemModel( 1 )->span( *hbqt_par_QModelIndex( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QAbstractListModel.cpp b/harbour/contrib/hbqt/qtcore/QAbstractListModel.cpp index 6f5e819d01..dd7200aaa1 100644 --- a/harbour/contrib/hbqt/qtcore/QAbstractListModel.cpp +++ b/harbour/contrib/hbqt/qtcore/QAbstractListModel.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -76,11 +76,35 @@ * ~QAbstractListModel () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QAbstractListModel > pq; +} QGC_POINTER_QAbstractListModel; + QT_G_FUNC( hbqt_gcRelease_QAbstractListModel ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QAbstractListModel( void * pObj, bool bNew ) +{ + QGC_POINTER_QAbstractListModel * p = ( QGC_POINTER_QAbstractListModel * ) hb_gcAllocate( sizeof( QGC_POINTER_QAbstractListModel ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QAbstractListModel; + + if( bNew ) + { + new( & p->pq ) QPointer< QAbstractListModel >( ( QAbstractListModel * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QAbstractListModel ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QABSTRACTLISTMODEL ) { } @@ -89,7 +113,7 @@ HB_FUNC( QT_QABSTRACTLISTMODEL ) */ HB_FUNC( QT_QABSTRACTLISTMODEL_INDEX ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractListModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QModelIndex( 4 ) : QModelIndex() ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractListModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QModelIndex( 4 ) : QModelIndex() ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QAbstractTableModel.cpp b/harbour/contrib/hbqt/qtcore/QAbstractTableModel.cpp index 14f28f7514..ab1ecfaee8 100644 --- a/harbour/contrib/hbqt/qtcore/QAbstractTableModel.cpp +++ b/harbour/contrib/hbqt/qtcore/QAbstractTableModel.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -76,11 +76,35 @@ * ~QAbstractTableModel () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QAbstractTableModel > pq; +} QGC_POINTER_QAbstractTableModel; + QT_G_FUNC( hbqt_gcRelease_QAbstractTableModel ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QAbstractTableModel( void * pObj, bool bNew ) +{ + QGC_POINTER_QAbstractTableModel * p = ( QGC_POINTER_QAbstractTableModel * ) hb_gcAllocate( sizeof( QGC_POINTER_QAbstractTableModel ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QAbstractTableModel; + + if( bNew ) + { + new( & p->pq ) QPointer< QAbstractTableModel >( ( QAbstractTableModel * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QAbstractTableModel ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QABSTRACTTABLEMODEL ) { } @@ -89,7 +113,7 @@ HB_FUNC( QT_QABSTRACTTABLEMODEL ) */ HB_FUNC( QT_QABSTRACTTABLEMODEL_INDEX ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractTableModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QModelIndex( 4 ) : QModelIndex() ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractTableModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QModelIndex( 4 ) : QModelIndex() ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QBitArray.cpp b/harbour/contrib/hbqt/qtcore/QBitArray.cpp index 5062ac348d..603f7ee33c 100644 --- a/harbour/contrib/hbqt/qtcore/QBitArray.cpp +++ b/harbour/contrib/hbqt/qtcore/QBitArray.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -76,32 +76,49 @@ * QBitArray ( const QBitArray & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QBitArray; + QT_G_FUNC( hbqt_gcRelease_QBitArray ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QBitArray p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QBitArray ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QBitArray * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QBitArray Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QBitArray * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QBitArray ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QBitArray Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QBitArray Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QBitArray Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QBitArray( void * pObj ) +void * hbqt_gcAllocate_QBitArray( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QBitArray; - HB_TRACE( HB_TR_DEBUG, ( " new_QBitArray %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QBitArray ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -111,7 +128,7 @@ HB_FUNC( QT_QBITARRAY ) pObj = new QBitArray() ; - hb_retptrGC( hbqt_gcAllocate_QBitArray( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QBitArray( pObj, true ) ); } /* * bool at ( int i ) const diff --git a/harbour/contrib/hbqt/qtcore/QByteArray.cpp b/harbour/contrib/hbqt/qtcore/QByteArray.cpp index 593ad9f808..7156168f90 100644 --- a/harbour/contrib/hbqt/qtcore/QByteArray.cpp +++ b/harbour/contrib/hbqt/qtcore/QByteArray.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -94,32 +94,49 @@ * ~QByteArray () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QByteArray; + QT_G_FUNC( hbqt_gcRelease_QByteArray ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QByteArray p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QByteArray ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QByteArray * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QByteArray Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QByteArray * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QByteArray ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QByteArray Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QByteArray Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QByteArray Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QByteArray( void * pObj ) +void * hbqt_gcAllocate_QByteArray( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QByteArray; - HB_TRACE( HB_TR_DEBUG, ( " new_QByteArray %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QByteArray ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -129,14 +146,14 @@ HB_FUNC( QT_QBYTEARRAY ) pObj = new QByteArray() ; - hb_retptrGC( hbqt_gcAllocate_QByteArray( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( pObj, true ) ); } /* * QByteArray & append ( const QByteArray & ba ) */ HB_FUNC( QT_QBYTEARRAY_APPEND ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->append( *hbqt_par_QByteArray( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->append( *hbqt_par_QByteArray( 2 ) ) ), true ) ); } /* @@ -144,7 +161,7 @@ HB_FUNC( QT_QBYTEARRAY_APPEND ) */ HB_FUNC( QT_QBYTEARRAY_APPEND_1 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->append( hbqt_par_QString( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->append( hbqt_par_QString( 2 ) ) ), true ) ); } /* @@ -152,7 +169,7 @@ HB_FUNC( QT_QBYTEARRAY_APPEND_1 ) */ HB_FUNC( QT_QBYTEARRAY_APPEND_2 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->append( hbqt_par_char( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->append( hbqt_par_char( 2 ) ) ), true ) ); } /* @@ -160,7 +177,7 @@ HB_FUNC( QT_QBYTEARRAY_APPEND_2 ) */ HB_FUNC( QT_QBYTEARRAY_APPEND_3 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->append( hbqt_par_char( 2 ), hb_parni( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->append( hbqt_par_char( 2 ), hb_parni( 3 ) ) ), true ) ); } /* @@ -168,7 +185,7 @@ HB_FUNC( QT_QBYTEARRAY_APPEND_3 ) */ HB_FUNC( QT_QBYTEARRAY_APPEND_4 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->append( ( char ) hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->append( ( char ) hb_parni( 2 ) ) ), true ) ); } /* @@ -288,7 +305,7 @@ HB_FUNC( QT_QBYTEARRAY_ENDSWITH_2 ) */ HB_FUNC( QT_QBYTEARRAY_FILL ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->fill( ( char ) hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : -1 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->fill( ( char ) hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : -1 ) ) ), true ) ); } /* @@ -328,7 +345,7 @@ HB_FUNC( QT_QBYTEARRAY_INDEXOF_3 ) */ HB_FUNC( QT_QBYTEARRAY_INSERT ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->insert( hb_parni( 2 ), *hbqt_par_QByteArray( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->insert( hb_parni( 2 ), *hbqt_par_QByteArray( 3 ) ) ), true ) ); } /* @@ -336,7 +353,7 @@ HB_FUNC( QT_QBYTEARRAY_INSERT ) */ HB_FUNC( QT_QBYTEARRAY_INSERT_1 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->insert( hb_parni( 2 ), hbqt_par_QString( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->insert( hb_parni( 2 ), hbqt_par_QString( 3 ) ) ), true ) ); } /* @@ -344,7 +361,7 @@ HB_FUNC( QT_QBYTEARRAY_INSERT_1 ) */ HB_FUNC( QT_QBYTEARRAY_INSERT_2 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->insert( hb_parni( 2 ), hbqt_par_char( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->insert( hb_parni( 2 ), hbqt_par_char( 3 ) ) ), true ) ); } /* @@ -352,7 +369,7 @@ HB_FUNC( QT_QBYTEARRAY_INSERT_2 ) */ HB_FUNC( QT_QBYTEARRAY_INSERT_3 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->insert( hb_parni( 2 ), ( char ) hb_parni( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->insert( hb_parni( 2 ), ( char ) hb_parni( 3 ) ) ), true ) ); } /* @@ -408,7 +425,7 @@ HB_FUNC( QT_QBYTEARRAY_LASTINDEXOF_3 ) */ HB_FUNC( QT_QBYTEARRAY_LEFT ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->left( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->left( hb_parni( 2 ) ) ), true ) ); } /* @@ -416,7 +433,7 @@ HB_FUNC( QT_QBYTEARRAY_LEFT ) */ HB_FUNC( QT_QBYTEARRAY_LEFTJUSTIFIED ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->leftJustified( hb_parni( 2 ), ( char ) hb_parni( 3 ), hb_parl( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->leftJustified( hb_parni( 2 ), ( char ) hb_parni( 3 ), hb_parl( 4 ) ) ), true ) ); } /* @@ -432,7 +449,7 @@ HB_FUNC( QT_QBYTEARRAY_LENGTH ) */ HB_FUNC( QT_QBYTEARRAY_MID ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->mid( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : -1 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->mid( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : -1 ) ) ), true ) ); } /* @@ -440,7 +457,7 @@ HB_FUNC( QT_QBYTEARRAY_MID ) */ HB_FUNC( QT_QBYTEARRAY_PREPEND ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->prepend( *hbqt_par_QByteArray( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->prepend( *hbqt_par_QByteArray( 2 ) ) ), true ) ); } /* @@ -448,7 +465,7 @@ HB_FUNC( QT_QBYTEARRAY_PREPEND ) */ HB_FUNC( QT_QBYTEARRAY_PREPEND_1 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->prepend( hbqt_par_char( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->prepend( hbqt_par_char( 2 ) ) ), true ) ); } /* @@ -456,7 +473,7 @@ HB_FUNC( QT_QBYTEARRAY_PREPEND_1 ) */ HB_FUNC( QT_QBYTEARRAY_PREPEND_2 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->prepend( ( char ) hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->prepend( ( char ) hb_parni( 2 ) ) ), true ) ); } /* @@ -512,7 +529,7 @@ HB_FUNC( QT_QBYTEARRAY_PUSH_FRONT_2 ) */ HB_FUNC( QT_QBYTEARRAY_REMOVE ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->remove( hb_parni( 2 ), hb_parni( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->remove( hb_parni( 2 ), hb_parni( 3 ) ) ), true ) ); } /* @@ -520,7 +537,7 @@ HB_FUNC( QT_QBYTEARRAY_REMOVE ) */ HB_FUNC( QT_QBYTEARRAY_REPEATED ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->repeated( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->repeated( hb_parni( 2 ) ) ), true ) ); } /* @@ -528,7 +545,7 @@ HB_FUNC( QT_QBYTEARRAY_REPEATED ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hb_parni( 2 ), hb_parni( 3 ), *hbqt_par_QByteArray( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hb_parni( 2 ), hb_parni( 3 ), *hbqt_par_QByteArray( 4 ) ) ), true ) ); } /* @@ -536,7 +553,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_1 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hb_parni( 2 ), hb_parni( 3 ), hbqt_par_char( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hb_parni( 2 ), hb_parni( 3 ), hbqt_par_char( 4 ) ) ), true ) ); } /* @@ -544,7 +561,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_1 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_2 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( *hbqt_par_QByteArray( 2 ), *hbqt_par_QByteArray( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( *hbqt_par_QByteArray( 2 ), *hbqt_par_QByteArray( 3 ) ) ), true ) ); } /* @@ -552,7 +569,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_2 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_3 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_char( 2 ), *hbqt_par_QByteArray( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_char( 2 ), *hbqt_par_QByteArray( 3 ) ) ), true ) ); } /* @@ -560,7 +577,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_3 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_4 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_char( 2 ), hb_parni( 3 ), hbqt_par_char( 4 ), hb_parni( 5 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_char( 2 ), hb_parni( 3 ), hbqt_par_char( 4 ), hb_parni( 5 ) ) ), true ) ); } /* @@ -568,7 +585,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_4 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_5 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( *hbqt_par_QByteArray( 2 ), hbqt_par_char( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( *hbqt_par_QByteArray( 2 ), hbqt_par_char( 3 ) ) ), true ) ); } /* @@ -576,7 +593,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_5 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_6 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_QString( 2 ), *hbqt_par_QByteArray( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_QString( 2 ), *hbqt_par_QByteArray( 3 ) ) ), true ) ); } /* @@ -584,7 +601,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_6 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_7 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_QString( 2 ), hbqt_par_char( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_QString( 2 ), hbqt_par_char( 3 ) ) ), true ) ); } /* @@ -592,7 +609,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_7 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_8 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_char( 2 ), hbqt_par_char( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( hbqt_par_char( 2 ), hbqt_par_char( 3 ) ) ), true ) ); } /* @@ -600,7 +617,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_8 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_9 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( ( char ) hb_parni( 2 ), *hbqt_par_QByteArray( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( ( char ) hb_parni( 2 ), *hbqt_par_QByteArray( 3 ) ) ), true ) ); } /* @@ -608,7 +625,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_9 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_10 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( ( char ) hb_parni( 2 ), hbqt_par_QString( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( ( char ) hb_parni( 2 ), hbqt_par_QString( 3 ) ) ), true ) ); } /* @@ -616,7 +633,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_10 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_11 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( ( char ) hb_parni( 2 ), hbqt_par_char( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( ( char ) hb_parni( 2 ), hbqt_par_char( 3 ) ) ), true ) ); } /* @@ -624,7 +641,7 @@ HB_FUNC( QT_QBYTEARRAY_REPLACE_11 ) */ HB_FUNC( QT_QBYTEARRAY_REPLACE_12 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( ( char ) hb_parni( 2 ), ( char ) hb_parni( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->replace( ( char ) hb_parni( 2 ), ( char ) hb_parni( 3 ) ) ), true ) ); } /* @@ -648,7 +665,7 @@ HB_FUNC( QT_QBYTEARRAY_RESIZE ) */ HB_FUNC( QT_QBYTEARRAY_RIGHT ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->right( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->right( hb_parni( 2 ) ) ), true ) ); } /* @@ -656,7 +673,7 @@ HB_FUNC( QT_QBYTEARRAY_RIGHT ) */ HB_FUNC( QT_QBYTEARRAY_RIGHTJUSTIFIED ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->rightJustified( hb_parni( 2 ), ( char ) hb_parni( 3 ), hb_parl( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->rightJustified( hb_parni( 2 ), ( char ) hb_parni( 3 ), hb_parl( 4 ) ) ), true ) ); } /* @@ -664,7 +681,7 @@ HB_FUNC( QT_QBYTEARRAY_RIGHTJUSTIFIED ) */ HB_FUNC( QT_QBYTEARRAY_SETNUM ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ), true ) ); } /* @@ -672,7 +689,7 @@ HB_FUNC( QT_QBYTEARRAY_SETNUM ) */ HB_FUNC( QT_QBYTEARRAY_SETNUM_1 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ), true ) ); } /* @@ -680,7 +697,7 @@ HB_FUNC( QT_QBYTEARRAY_SETNUM_1 ) */ HB_FUNC( QT_QBYTEARRAY_SETNUM_2 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ), true ) ); } /* @@ -688,7 +705,7 @@ HB_FUNC( QT_QBYTEARRAY_SETNUM_2 ) */ HB_FUNC( QT_QBYTEARRAY_SETNUM_3 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ), true ) ); } /* @@ -696,7 +713,7 @@ HB_FUNC( QT_QBYTEARRAY_SETNUM_3 ) */ HB_FUNC( QT_QBYTEARRAY_SETNUM_4 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( ( qlonglong ) hb_parnint( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( ( qlonglong ) hb_parnint( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ), true ) ); } /* @@ -704,7 +721,7 @@ HB_FUNC( QT_QBYTEARRAY_SETNUM_4 ) */ HB_FUNC( QT_QBYTEARRAY_SETNUM_5 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( ( qulonglong ) hb_parnint( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( ( qulonglong ) hb_parnint( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : 10 ) ) ), true ) ); } /* @@ -712,7 +729,7 @@ HB_FUNC( QT_QBYTEARRAY_SETNUM_5 ) */ HB_FUNC( QT_QBYTEARRAY_SETNUM_6 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parnd( 2 ), ( char ) hb_parni( 3 ), ( HB_ISNUM( 4 ) ? hb_parni( 4 ) : 6 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parnd( 2 ), ( char ) hb_parni( 3 ), ( HB_ISNUM( 4 ) ? hb_parni( 4 ) : 6 ) ) ), true ) ); } /* @@ -720,7 +737,7 @@ HB_FUNC( QT_QBYTEARRAY_SETNUM_6 ) */ HB_FUNC( QT_QBYTEARRAY_SETNUM_7 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parnd( 2 ), ( char ) hb_parni( 3 ), ( HB_ISNUM( 4 ) ? hb_parni( 4 ) : 6 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->setNum( hb_parnd( 2 ), ( char ) hb_parni( 3 ), ( HB_ISNUM( 4 ) ? hb_parni( 4 ) : 6 ) ) ), true ) ); } /* @@ -728,7 +745,7 @@ HB_FUNC( QT_QBYTEARRAY_SETNUM_7 ) */ HB_FUNC( QT_QBYTEARRAY_SIMPLIFIED ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->simplified() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->simplified() ), true ) ); } /* @@ -776,7 +793,7 @@ HB_FUNC( QT_QBYTEARRAY_STARTSWITH_2 ) */ HB_FUNC( QT_QBYTEARRAY_TOBASE64 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->toBase64() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->toBase64() ), true ) ); } /* @@ -808,7 +825,7 @@ HB_FUNC( QT_QBYTEARRAY_TOFLOAT ) */ HB_FUNC( QT_QBYTEARRAY_TOHEX ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->toHex() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->toHex() ), true ) ); } /* @@ -852,7 +869,7 @@ HB_FUNC( QT_QBYTEARRAY_TOLONGLONG ) */ HB_FUNC( QT_QBYTEARRAY_TOLOWER ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->toLower() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->toLower() ), true ) ); } /* @@ -860,7 +877,7 @@ HB_FUNC( QT_QBYTEARRAY_TOLOWER ) */ HB_FUNC( QT_QBYTEARRAY_TOPERCENTENCODING ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->toPercentEncoding( ( HB_ISPOINTER( 2 ) ? *hbqt_par_QByteArray( 2 ) : QByteArray() ), ( HB_ISPOINTER( 3 ) ? *hbqt_par_QByteArray( 3 ) : QByteArray() ), ( char ) hb_parni( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->toPercentEncoding( ( HB_ISPOINTER( 2 ) ? *hbqt_par_QByteArray( 2 ) : QByteArray() ), ( HB_ISPOINTER( 3 ) ? *hbqt_par_QByteArray( 3 ) : QByteArray() ), ( char ) hb_parni( 4 ) ) ), true ) ); } /* @@ -928,7 +945,7 @@ HB_FUNC( QT_QBYTEARRAY_TOUSHORT ) */ HB_FUNC( QT_QBYTEARRAY_TOUPPER ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->toUpper() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->toUpper() ), true ) ); } /* @@ -936,7 +953,7 @@ HB_FUNC( QT_QBYTEARRAY_TOUPPER ) */ HB_FUNC( QT_QBYTEARRAY_TRIMMED ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->trimmed() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QByteArray( 1 )->trimmed() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QCoreApplication.cpp b/harbour/contrib/hbqt/qtcore/QCoreApplication.cpp index b30a1f694f..4dd17084b1 100644 --- a/harbour/contrib/hbqt/qtcore/QCoreApplication.cpp +++ b/harbour/contrib/hbqt/qtcore/QCoreApplication.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,11 +81,35 @@ * ~QCoreApplication () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QCoreApplication > pq; +} QGC_POINTER_QCoreApplication; + QT_G_FUNC( hbqt_gcRelease_QCoreApplication ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QCoreApplication( void * pObj, bool bNew ) +{ + QGC_POINTER_QCoreApplication * p = ( QGC_POINTER_QCoreApplication * ) hb_gcAllocate( sizeof( QGC_POINTER_QCoreApplication ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QCoreApplication; + + if( bNew ) + { + new( & p->pq ) QPointer< QCoreApplication >( ( QCoreApplication * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QCoreApplication ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QCOREAPPLICATION ) { } @@ -150,7 +174,7 @@ HB_FUNC( QT_QCOREAPPLICATION_APPLICATIONVERSION ) */ HB_FUNC( QT_QCOREAPPLICATION_ARGUMENTS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QCoreApplication( 1 )->arguments() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QCoreApplication( 1 )->arguments() ), true ) ); } /* @@ -206,7 +230,7 @@ HB_FUNC( QT_QCOREAPPLICATION_INSTALLTRANSLATOR ) */ HB_FUNC( QT_QCOREAPPLICATION_INSTANCE ) { - hb_retptr( ( QCoreApplication* ) hbqt_par_QCoreApplication( 1 )->instance() ); + hb_retptrGC( hbqt_gcAllocate_QCoreApplication( hbqt_par_QCoreApplication( 1 )->instance(), false ) ); } /* @@ -214,7 +238,7 @@ HB_FUNC( QT_QCOREAPPLICATION_INSTANCE ) */ HB_FUNC( QT_QCOREAPPLICATION_LIBRARYPATHS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QCoreApplication( 1 )->libraryPaths() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QCoreApplication( 1 )->libraryPaths() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QDataStream.cpp b/harbour/contrib/hbqt/qtcore/QDataStream.cpp index 7a7e99d992..e1cef49283 100644 --- a/harbour/contrib/hbqt/qtcore/QDataStream.cpp +++ b/harbour/contrib/hbqt/qtcore/QDataStream.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -84,32 +84,49 @@ * virtual ~QDataStream () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QDataStream; + QT_G_FUNC( hbqt_gcRelease_QDataStream ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDataStream p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDataStream ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QDataStream * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QDataStream Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QDataStream * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QDataStream ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QDataStream Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QDataStream Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QDataStream Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QDataStream( void * pObj ) +void * hbqt_gcAllocate_QDataStream( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QDataStream; - HB_TRACE( HB_TR_DEBUG, ( " new_QDataStream %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QDataStream ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -119,7 +136,7 @@ HB_FUNC( QT_QDATASTREAM ) pObj = new QDataStream() ; - hb_retptrGC( hbqt_gcAllocate_QDataStream( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QDataStream( pObj, true ) ); } /* * bool atEnd () const @@ -142,7 +159,7 @@ HB_FUNC( QT_QDATASTREAM_BYTEORDER ) */ HB_FUNC( QT_QDATASTREAM_DEVICE ) { - hb_retptr( ( QIODevice* ) hbqt_par_QDataStream( 1 )->device() ); + hb_retptrGC( hbqt_gcAllocate_QIODevice( hbqt_par_QDataStream( 1 )->device(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QDate.cpp b/harbour/contrib/hbqt/qtcore/QDate.cpp index 815abc1b82..f7f04416bb 100644 --- a/harbour/contrib/hbqt/qtcore/QDate.cpp +++ b/harbour/contrib/hbqt/qtcore/QDate.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,32 +79,49 @@ * QDate ( int y, int m, int d ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QDate; + QT_G_FUNC( hbqt_gcRelease_QDate ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDate p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDate ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QDate * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QDate Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QDate * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QDate ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QDate Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QDate Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QDate Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QDate( void * pObj ) +void * hbqt_gcAllocate_QDate( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QDate; - HB_TRACE( HB_TR_DEBUG, ( " new_QDate %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QDate ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -114,14 +131,14 @@ HB_FUNC( QT_QDATE ) pObj = new QDate() ; - hb_retptrGC( hbqt_gcAllocate_QDate( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QDate( pObj, true ) ); } /* * QDate addDays ( int ndays ) const */ HB_FUNC( QT_QDATE_ADDDAYS ) { - hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QDate( 1 )->addDays( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QDate( 1 )->addDays( hb_parni( 2 ) ) ), true ) ); } /* @@ -129,7 +146,7 @@ HB_FUNC( QT_QDATE_ADDDAYS ) */ HB_FUNC( QT_QDATE_ADDMONTHS ) { - hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QDate( 1 )->addMonths( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QDate( 1 )->addMonths( hb_parni( 2 ) ) ), true ) ); } /* @@ -137,7 +154,7 @@ HB_FUNC( QT_QDATE_ADDMONTHS ) */ HB_FUNC( QT_QDATE_ADDYEARS ) { - hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QDate( 1 )->addYears( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QDate( 1 )->addYears( hb_parni( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QDateTime.cpp b/harbour/contrib/hbqt/qtcore/QDateTime.cpp index c0ffc017c6..e3479059a8 100644 --- a/harbour/contrib/hbqt/qtcore/QDateTime.cpp +++ b/harbour/contrib/hbqt/qtcore/QDateTime.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,32 +79,49 @@ * ~QDateTime () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QDateTime; + QT_G_FUNC( hbqt_gcRelease_QDateTime ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDateTime p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDateTime ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QDateTime * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QDateTime Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QDateTime * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QDateTime ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QDateTime Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QDateTime Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QDateTime Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QDateTime( void * pObj ) +void * hbqt_gcAllocate_QDateTime( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QDateTime; - HB_TRACE( HB_TR_DEBUG, ( " new_QDateTime %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QDateTime ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -114,14 +131,14 @@ HB_FUNC( QT_QDATETIME ) pObj = ( QDateTime* ) new QDateTime() ; - hb_retptrGC( hbqt_gcAllocate_QDateTime( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( pObj, true ) ); } /* * QDateTime addDays ( int ndays ) const */ HB_FUNC( QT_QDATETIME_ADDDAYS ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->addDays( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->addDays( hb_parni( 2 ) ) ), true ) ); } /* @@ -129,7 +146,7 @@ HB_FUNC( QT_QDATETIME_ADDDAYS ) */ HB_FUNC( QT_QDATETIME_ADDMSECS ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->addMSecs( hb_parnint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->addMSecs( hb_parnint( 2 ) ) ), true ) ); } /* @@ -137,7 +154,7 @@ HB_FUNC( QT_QDATETIME_ADDMSECS ) */ HB_FUNC( QT_QDATETIME_ADDMONTHS ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->addMonths( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->addMonths( hb_parni( 2 ) ) ), true ) ); } /* @@ -145,7 +162,7 @@ HB_FUNC( QT_QDATETIME_ADDMONTHS ) */ HB_FUNC( QT_QDATETIME_ADDSECS ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->addSecs( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->addSecs( hb_parni( 2 ) ) ), true ) ); } /* @@ -153,7 +170,7 @@ HB_FUNC( QT_QDATETIME_ADDSECS ) */ HB_FUNC( QT_QDATETIME_ADDYEARS ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->addYears( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->addYears( hb_parni( 2 ) ) ), true ) ); } /* @@ -161,7 +178,7 @@ HB_FUNC( QT_QDATETIME_ADDYEARS ) */ HB_FUNC( QT_QDATETIME_DATE ) { - hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QDateTime( 1 )->date() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QDateTime( 1 )->date() ), true ) ); } /* @@ -233,7 +250,7 @@ HB_FUNC( QT_QDATETIME_SETTIME_T ) */ HB_FUNC( QT_QDATETIME_TIME ) { - hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QDateTime( 1 )->time() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QDateTime( 1 )->time() ), true ) ); } /* @@ -249,7 +266,7 @@ HB_FUNC( QT_QDATETIME_TIMESPEC ) */ HB_FUNC( QT_QDATETIME_TOLOCALTIME ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->toLocalTime() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->toLocalTime() ), true ) ); } /* @@ -273,7 +290,7 @@ HB_FUNC( QT_QDATETIME_TOSTRING_1 ) */ HB_FUNC( QT_QDATETIME_TOTIMESPEC ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->toTimeSpec( ( Qt::TimeSpec ) hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->toTimeSpec( ( Qt::TimeSpec ) hb_parni( 2 ) ) ), true ) ); } /* @@ -289,7 +306,7 @@ HB_FUNC( QT_QDATETIME_TOTIME_T ) */ HB_FUNC( QT_QDATETIME_TOUTC ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->toUTC() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->toUTC() ), true ) ); } /* @@ -297,7 +314,7 @@ HB_FUNC( QT_QDATETIME_TOUTC ) */ HB_FUNC( QT_QDATETIME_CURRENTDATETIME ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->currentDateTime() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->currentDateTime() ), true ) ); } /* @@ -305,7 +322,7 @@ HB_FUNC( QT_QDATETIME_CURRENTDATETIME ) */ HB_FUNC( QT_QDATETIME_FROMSTRING ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->fromString( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::DateFormat ) hb_parni( 3 ) : ( Qt::DateFormat ) Qt::TextDate ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->fromString( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::DateFormat ) hb_parni( 3 ) : ( Qt::DateFormat ) Qt::TextDate ) ) ), true ) ); } /* @@ -313,7 +330,7 @@ HB_FUNC( QT_QDATETIME_FROMSTRING ) */ HB_FUNC( QT_QDATETIME_FROMSTRING_1 ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->fromString( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->fromString( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ), true ) ); } /* @@ -321,7 +338,7 @@ HB_FUNC( QT_QDATETIME_FROMSTRING_1 ) */ HB_FUNC( QT_QDATETIME_FROMTIME_T ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->fromTime_t( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTime( 1 )->fromTime_t( hb_parni( 2 ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QDir.cpp b/harbour/contrib/hbqt/qtcore/QDir.cpp index 4a1b062571..0cfc8352ec 100644 --- a/harbour/contrib/hbqt/qtcore/QDir.cpp +++ b/harbour/contrib/hbqt/qtcore/QDir.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -85,32 +85,49 @@ * ~QDir () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QDir; + QT_G_FUNC( hbqt_gcRelease_QDir ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDir p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDir ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QDir * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QDir Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QDir * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QDir ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QDir Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QDir Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QDir Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QDir( void * pObj ) +void * hbqt_gcAllocate_QDir( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QDir; - HB_TRACE( HB_TR_DEBUG, ( " new_QDir %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QDir ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -120,7 +137,7 @@ HB_FUNC( QT_QDIR ) pObj = new QDir( hbqt_par_QString( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QDir( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QDir( pObj, true ) ); } /* * QString absoluteFilePath ( const QString & fileName ) const @@ -183,7 +200,7 @@ HB_FUNC( QT_QDIR_DIRNAME ) */ HB_FUNC( QT_QDIR_ENTRYLIST ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QDir( 1 )->entryList( *hbqt_par_QStringList( 2 ), ( HB_ISNUM( 3 ) ? ( QDir::Filters ) hb_parni( 3 ) : ( QDir::Filters ) QDir::NoFilter ), ( HB_ISNUM( 4 ) ? ( QDir::SortFlags ) hb_parni( 4 ) : ( QDir::SortFlags ) QDir::NoSort ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QDir( 1 )->entryList( *hbqt_par_QStringList( 2 ), ( HB_ISNUM( 3 ) ? ( QDir::Filters ) hb_parni( 3 ) : ( QDir::Filters ) QDir::NoFilter ), ( HB_ISNUM( 4 ) ? ( QDir::SortFlags ) hb_parni( 4 ) : ( QDir::SortFlags ) QDir::NoSort ) ) ), true ) ); } /* @@ -191,7 +208,7 @@ HB_FUNC( QT_QDIR_ENTRYLIST ) */ HB_FUNC( QT_QDIR_ENTRYLIST_1 ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QDir( 1 )->entryList( ( HB_ISNUM( 2 ) ? ( QDir::Filters ) hb_parni( 2 ) : ( QDir::Filters ) QDir::NoFilter ), ( HB_ISNUM( 3 ) ? ( QDir::SortFlags ) hb_parni( 3 ) : ( QDir::SortFlags ) QDir::NoSort ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QDir( 1 )->entryList( ( HB_ISNUM( 2 ) ? ( QDir::Filters ) hb_parni( 2 ) : ( QDir::Filters ) QDir::NoFilter ), ( HB_ISNUM( 3 ) ? ( QDir::SortFlags ) hb_parni( 3 ) : ( QDir::SortFlags ) QDir::NoSort ) ) ), true ) ); } /* @@ -287,7 +304,7 @@ HB_FUNC( QT_QDIR_MKPATH ) */ HB_FUNC( QT_QDIR_NAMEFILTERS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QDir( 1 )->nameFilters() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QDir( 1 )->nameFilters() ), true ) ); } /* @@ -407,7 +424,7 @@ HB_FUNC( QT_QDIR_CLEANPATH ) */ HB_FUNC( QT_QDIR_CURRENT ) { - hb_retptrGC( hbqt_gcAllocate_QDir( new QDir( hbqt_par_QDir( 1 )->current() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDir( new QDir( hbqt_par_QDir( 1 )->current() ), true ) ); } /* @@ -431,7 +448,7 @@ HB_FUNC( QT_QDIR_FROMNATIVESEPARATORS ) */ HB_FUNC( QT_QDIR_HOME ) { - hb_retptrGC( hbqt_gcAllocate_QDir( new QDir( hbqt_par_QDir( 1 )->home() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDir( new QDir( hbqt_par_QDir( 1 )->home() ), true ) ); } /* @@ -479,7 +496,7 @@ HB_FUNC( QT_QDIR_MATCH_1 ) */ HB_FUNC( QT_QDIR_ROOT ) { - hb_retptrGC( hbqt_gcAllocate_QDir( new QDir( hbqt_par_QDir( 1 )->root() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDir( new QDir( hbqt_par_QDir( 1 )->root() ), true ) ); } /* @@ -495,7 +512,7 @@ HB_FUNC( QT_QDIR_ROOTPATH ) */ HB_FUNC( QT_QDIR_SEARCHPATHS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QDir( 1 )->searchPaths( hbqt_par_QString( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QDir( 1 )->searchPaths( hbqt_par_QString( 2 ) ) ), true ) ); } /* @@ -519,7 +536,7 @@ HB_FUNC( QT_QDIR_SETSEARCHPATHS ) */ HB_FUNC( QT_QDIR_TEMP ) { - hb_retptrGC( hbqt_gcAllocate_QDir( new QDir( hbqt_par_QDir( 1 )->temp() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDir( new QDir( hbqt_par_QDir( 1 )->temp() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QEvent.cpp b/harbour/contrib/hbqt/qtcore/QEvent.cpp index b4efc2fa97..333b41c8d4 100644 --- a/harbour/contrib/hbqt/qtcore/QEvent.cpp +++ b/harbour/contrib/hbqt/qtcore/QEvent.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,32 +80,49 @@ * virtual ~QEvent () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QEvent; + QT_G_FUNC( hbqt_gcRelease_QEvent ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QEvent p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QEvent ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QEvent * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QEvent Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QEvent * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QEvent ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QEvent Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QEvent Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QEvent Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QEvent( void * pObj ) +void * hbqt_gcAllocate_QEvent( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QEvent; - HB_TRACE( HB_TR_DEBUG, ( " new_QEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QEvent ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -115,7 +132,7 @@ HB_FUNC( QT_QEVENT ) pObj = ( QEvent* ) new QEvent( ( QEvent::Type ) hb_parni( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QEvent( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QEvent( pObj, true ) ); } /* * void accept () diff --git a/harbour/contrib/hbqt/qtcore/QEventLoop.cpp b/harbour/contrib/hbqt/qtcore/QEventLoop.cpp index 1f4774d952..479eb177a1 100644 --- a/harbour/contrib/hbqt/qtcore/QEventLoop.cpp +++ b/harbour/contrib/hbqt/qtcore/QEventLoop.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -84,6 +84,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QEventLoop > pq; } QGC_POINTER_QEventLoop; @@ -92,48 +93,47 @@ QT_G_FUNC( hbqt_gcRelease_QEventLoop ) { QGC_POINTER_QEventLoop * p = ( QGC_POINTER_QEventLoop * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QEventLoop p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QEventLoop ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QEventLoop * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QEventLoop * ) p->ph )->~QEventLoop(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QEventLoop * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QEventLoop ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QEventLoop ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QEventLoop Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QEventLoop Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QEventLoop Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QEventLoop Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QEventLoop Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QEventLoop( void * pObj ) +void * hbqt_gcAllocate_QEventLoop( void * pObj, bool bNew ) { QGC_POINTER_QEventLoop * p = ( QGC_POINTER_QEventLoop * ) hb_gcAllocate( sizeof( QGC_POINTER_QEventLoop ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QEventLoop; - new( & p->pq ) QPointer< QEventLoop >( ( QEventLoop * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QEventLoop %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QEventLoop >( ( QEventLoop * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QEventLoop ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -143,7 +143,7 @@ HB_FUNC( QT_QEVENTLOOP ) pObj = new QEventLoop( hbqt_par_QObject( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QEventLoop( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QEventLoop( pObj, true ) ); } /* * int exec ( ProcessEventsFlags flags = AllEvents ) diff --git a/harbour/contrib/hbqt/qtcore/QFile.cpp b/harbour/contrib/hbqt/qtcore/QFile.cpp index a24a618cad..5845f0ed95 100644 --- a/harbour/contrib/hbqt/qtcore/QFile.cpp +++ b/harbour/contrib/hbqt/qtcore/QFile.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -89,6 +89,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QFile > pq; } QGC_POINTER_QFile; @@ -97,48 +98,47 @@ QT_G_FUNC( hbqt_gcRelease_QFile ) { QGC_POINTER_QFile * p = ( QGC_POINTER_QFile * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFile p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFile ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QFile * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QFile * ) p->ph )->~QFile(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QFile * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QFile ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QFile ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFile Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QFile Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QFile Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QFile Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QFile Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QFile( void * pObj ) +void * hbqt_gcAllocate_QFile( void * pObj, bool bNew ) { QGC_POINTER_QFile * p = ( QGC_POINTER_QFile * ) hb_gcAllocate( sizeof( QGC_POINTER_QFile ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QFile; - new( & p->pq ) QPointer< QFile >( ( QFile * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QFile %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QFile >( ( QFile * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QFile ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -151,7 +151,7 @@ HB_FUNC( QT_QFILE ) pObj = new QFile( hbqt_par_QString( 1 ) ) ; } - hb_retptrGC( hbqt_gcAllocate_QFile( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QFile( pObj, true ) ); } /* * virtual bool atEnd () const @@ -358,7 +358,7 @@ HB_FUNC( QT_QFILE_DECODENAME_1 ) */ HB_FUNC( QT_QFILE_ENCODENAME ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QFile( 1 )->encodeName( QFile::tr( hb_parc( 2 ) ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QFile( 1 )->encodeName( QFile::tr( hb_parc( 2 ) ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QFileInfo.cpp b/harbour/contrib/hbqt/qtcore/QFileInfo.cpp index 49d3036d0b..d4a55b567b 100644 --- a/harbour/contrib/hbqt/qtcore/QFileInfo.cpp +++ b/harbour/contrib/hbqt/qtcore/QFileInfo.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -85,32 +85,49 @@ * ~QFileInfo () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QFileInfo; + QT_G_FUNC( hbqt_gcRelease_QFileInfo ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFileInfo p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFileInfo ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QFileInfo * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QFileInfo Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QFileInfo * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QFileInfo ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QFileInfo Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QFileInfo Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QFileInfo Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QFileInfo( void * pObj ) +void * hbqt_gcAllocate_QFileInfo( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QFileInfo; - HB_TRACE( HB_TR_DEBUG, ( " new_QFileInfo %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QFileInfo ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -120,14 +137,14 @@ HB_FUNC( QT_QFILEINFO ) pObj = new QFileInfo() ; - hb_retptrGC( hbqt_gcAllocate_QFileInfo( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QFileInfo( pObj, true ) ); } /* * QDir absoluteDir () const */ HB_FUNC( QT_QFILEINFO_ABSOLUTEDIR ) { - hb_retptrGC( hbqt_gcAllocate_QDir( new QDir( hbqt_par_QFileInfo( 1 )->absoluteDir() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDir( new QDir( hbqt_par_QFileInfo( 1 )->absoluteDir() ), true ) ); } /* @@ -207,7 +224,7 @@ HB_FUNC( QT_QFILEINFO_COMPLETESUFFIX ) */ HB_FUNC( QT_QFILEINFO_CREATED ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QFileInfo( 1 )->created() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QFileInfo( 1 )->created() ), true ) ); } /* @@ -215,7 +232,7 @@ HB_FUNC( QT_QFILEINFO_CREATED ) */ HB_FUNC( QT_QFILEINFO_DIR ) { - hb_retptrGC( hbqt_gcAllocate_QDir( new QDir( hbqt_par_QFileInfo( 1 )->dir() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDir( new QDir( hbqt_par_QFileInfo( 1 )->dir() ), true ) ); } /* @@ -351,7 +368,7 @@ HB_FUNC( QT_QFILEINFO_ISWRITABLE ) */ HB_FUNC( QT_QFILEINFO_LASTMODIFIED ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QFileInfo( 1 )->lastModified() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QFileInfo( 1 )->lastModified() ), true ) ); } /* @@ -359,7 +376,7 @@ HB_FUNC( QT_QFILEINFO_LASTMODIFIED ) */ HB_FUNC( QT_QFILEINFO_LASTREAD ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QFileInfo( 1 )->lastRead() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QFileInfo( 1 )->lastRead() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QIODevice.cpp b/harbour/contrib/hbqt/qtcore/QIODevice.cpp index b224103362..61d634bc59 100644 --- a/harbour/contrib/hbqt/qtcore/QIODevice.cpp +++ b/harbour/contrib/hbqt/qtcore/QIODevice.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -82,11 +82,35 @@ * virtual ~QIODevice () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QIODevice > pq; +} QGC_POINTER_QIODevice; + QT_G_FUNC( hbqt_gcRelease_QIODevice ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QIODevice( void * pObj, bool bNew ) +{ + QGC_POINTER_QIODevice * p = ( QGC_POINTER_QIODevice * ) hb_gcAllocate( sizeof( QGC_POINTER_QIODevice ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QIODevice; + + if( bNew ) + { + new( & p->pq ) QPointer< QIODevice >( ( QIODevice * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QIODevice ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QIODEVICE ) { } @@ -215,7 +239,7 @@ HB_FUNC( QT_QIODEVICE_PEEK ) */ HB_FUNC( QT_QIODEVICE_PEEK_1 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QIODevice( 1 )->peek( hb_parnint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QIODevice( 1 )->peek( hb_parnint( 2 ) ) ), true ) ); } /* @@ -247,7 +271,7 @@ HB_FUNC( QT_QIODEVICE_READ ) */ HB_FUNC( QT_QIODEVICE_READ_1 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QIODevice( 1 )->read( hb_parnint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QIODevice( 1 )->read( hb_parnint( 2 ) ) ), true ) ); } /* @@ -255,7 +279,7 @@ HB_FUNC( QT_QIODEVICE_READ_1 ) */ HB_FUNC( QT_QIODEVICE_READALL ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QIODevice( 1 )->readAll() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QIODevice( 1 )->readAll() ), true ) ); } /* @@ -271,7 +295,7 @@ HB_FUNC( QT_QIODEVICE_READLINE ) */ HB_FUNC( QT_QIODEVICE_READLINE_1 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QIODevice( 1 )->readLine( hb_parnint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QIODevice( 1 )->readLine( hb_parnint( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QLatin1Char.cpp b/harbour/contrib/hbqt/qtcore/QLatin1Char.cpp index 08a10caa15..a58cb98f8d 100644 --- a/harbour/contrib/hbqt/qtcore/QLatin1Char.cpp +++ b/harbour/contrib/hbqt/qtcore/QLatin1Char.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -75,32 +75,49 @@ * QLatin1Char ( char c ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QLatin1Char; + QT_G_FUNC( hbqt_gcRelease_QLatin1Char ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLatin1Char p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLatin1Char ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QLatin1Char * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QLatin1Char Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QLatin1Char * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QLatin1Char ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QLatin1Char Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QLatin1Char Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QLatin1Char Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QLatin1Char( void * pObj ) +void * hbqt_gcAllocate_QLatin1Char( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QLatin1Char; - HB_TRACE( HB_TR_DEBUG, ( " new_QLatin1Char %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QLatin1Char ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -110,7 +127,7 @@ HB_FUNC( QT_QLATIN1CHAR ) pObj = ( QLatin1Char* ) new QLatin1Char( *hb_parcx( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QLatin1Char( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QLatin1Char( pObj, true ) ); } /* * char toLatin1 () const diff --git a/harbour/contrib/hbqt/qtcore/QLatin1String.cpp b/harbour/contrib/hbqt/qtcore/QLatin1String.cpp index cef6922072..0fba86069e 100644 --- a/harbour/contrib/hbqt/qtcore/QLatin1String.cpp +++ b/harbour/contrib/hbqt/qtcore/QLatin1String.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -75,32 +75,49 @@ * QLatin1String ( const char * str ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QLatin1String; + QT_G_FUNC( hbqt_gcRelease_QLatin1String ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLatin1String p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLatin1String ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QLatin1String * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QLatin1String Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QLatin1String * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QLatin1String ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QLatin1String Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QLatin1String Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QLatin1String Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QLatin1String( void * pObj ) +void * hbqt_gcAllocate_QLatin1String( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QLatin1String; - HB_TRACE( HB_TR_DEBUG, ( " new_QLatin1String %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QLatin1String ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -110,7 +127,7 @@ HB_FUNC( QT_QLATIN1STRING ) pObj = ( QLatin1String* ) new QLatin1String( hb_parcx( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QLatin1String( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QLatin1String( pObj, true ) ); } /* * const char * latin1 () const diff --git a/harbour/contrib/hbqt/qtcore/QLine.cpp b/harbour/contrib/hbqt/qtcore/QLine.cpp index 8c2baf2692..072cb978c7 100644 --- a/harbour/contrib/hbqt/qtcore/QLine.cpp +++ b/harbour/contrib/hbqt/qtcore/QLine.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -77,32 +77,49 @@ * QLine ( int x1, int y1, int x2, int y2 ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QLine; + QT_G_FUNC( hbqt_gcRelease_QLine ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLine p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLine ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QLine * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QLine Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QLine * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QLine ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QLine Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QLine Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QLine Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QLine( void * pObj ) +void * hbqt_gcAllocate_QLine( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QLine; - HB_TRACE( HB_TR_DEBUG, ( " new_QLine %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QLine ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -127,14 +144,14 @@ HB_FUNC( QT_QLINE ) pObj = ( QLine* ) new QLine() ; } - hb_retptrGC( hbqt_gcAllocate_QLine( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QLine( pObj, true ) ); } /* * QPoint p1 () const */ HB_FUNC( QT_QLINE_P1 ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QLine( 1 )->p1() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QLine( 1 )->p1() ), true ) ); } /* @@ -142,7 +159,7 @@ HB_FUNC( QT_QLINE_P1 ) */ HB_FUNC( QT_QLINE_P2 ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QLine( 1 )->p2() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QLine( 1 )->p2() ), true ) ); } /* @@ -254,7 +271,7 @@ HB_FUNC( QT_QLINE_TRANSLATE_1 ) */ HB_FUNC( QT_QLINE_TRANSLATED ) { - hb_retptrGC( hbqt_gcAllocate_QLine( new QLine( hbqt_par_QLine( 1 )->translated( *hbqt_par_QPoint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLine( new QLine( hbqt_par_QLine( 1 )->translated( *hbqt_par_QPoint( 2 ) ) ), true ) ); } /* @@ -262,7 +279,7 @@ HB_FUNC( QT_QLINE_TRANSLATED ) */ HB_FUNC( QT_QLINE_TRANSLATED_1 ) { - hb_retptrGC( hbqt_gcAllocate_QLine( new QLine( hbqt_par_QLine( 1 )->translated( hb_parni( 2 ), hb_parni( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLine( new QLine( hbqt_par_QLine( 1 )->translated( hb_parni( 2 ), hb_parni( 3 ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QLineF.cpp b/harbour/contrib/hbqt/qtcore/QLineF.cpp index c602abd317..6fa3ec8e8a 100644 --- a/harbour/contrib/hbqt/qtcore/QLineF.cpp +++ b/harbour/contrib/hbqt/qtcore/QLineF.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,32 +81,49 @@ * QLineF ( const QLine & line ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QLineF; + QT_G_FUNC( hbqt_gcRelease_QLineF ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLineF p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLineF ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QLineF * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QLineF Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QLineF * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QLineF ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QLineF Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QLineF Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QLineF Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QLineF( void * pObj ) +void * hbqt_gcAllocate_QLineF( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QLineF; - HB_TRACE( HB_TR_DEBUG, ( " new_QLineF %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QLineF ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -116,14 +133,14 @@ HB_FUNC( QT_QLINEF ) pObj = new QLineF() ; - hb_retptrGC( hbqt_gcAllocate_QLineF( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QLineF( pObj, true ) ); } /* * QPointF p1 () const */ HB_FUNC( QT_QLINEF_P1 ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QLineF( 1 )->p1() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QLineF( 1 )->p1() ), true ) ); } /* @@ -131,7 +148,7 @@ HB_FUNC( QT_QLINEF_P1 ) */ HB_FUNC( QT_QLINEF_P2 ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QLineF( 1 )->p2() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QLineF( 1 )->p2() ), true ) ); } /* @@ -227,7 +244,7 @@ HB_FUNC( QT_QLINEF_LENGTH ) */ HB_FUNC( QT_QLINEF_NORMALVECTOR ) { - hb_retptrGC( hbqt_gcAllocate_QLineF( new QLineF( hbqt_par_QLineF( 1 )->normalVector() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLineF( new QLineF( hbqt_par_QLineF( 1 )->normalVector() ), true ) ); } /* @@ -235,7 +252,7 @@ HB_FUNC( QT_QLINEF_NORMALVECTOR ) */ HB_FUNC( QT_QLINEF_POINTAT ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QLineF( 1 )->pointAt( hb_parnd( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QLineF( 1 )->pointAt( hb_parnd( 2 ) ) ), true ) ); } /* @@ -291,7 +308,7 @@ HB_FUNC( QT_QLINEF_SETPOINTS ) */ HB_FUNC( QT_QLINEF_TOLINE ) { - hb_retptrGC( hbqt_gcAllocate_QLine( new QLine( hbqt_par_QLineF( 1 )->toLine() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLine( new QLine( hbqt_par_QLineF( 1 )->toLine() ), true ) ); } /* @@ -315,7 +332,7 @@ HB_FUNC( QT_QLINEF_TRANSLATE_1 ) */ HB_FUNC( QT_QLINEF_TRANSLATED ) { - hb_retptrGC( hbqt_gcAllocate_QLineF( new QLineF( hbqt_par_QLineF( 1 )->translated( *hbqt_par_QPointF( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLineF( new QLineF( hbqt_par_QLineF( 1 )->translated( *hbqt_par_QPointF( 2 ) ) ), true ) ); } /* @@ -323,7 +340,7 @@ HB_FUNC( QT_QLINEF_TRANSLATED ) */ HB_FUNC( QT_QLINEF_TRANSLATED_1 ) { - hb_retptrGC( hbqt_gcAllocate_QLineF( new QLineF( hbqt_par_QLineF( 1 )->translated( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLineF( new QLineF( hbqt_par_QLineF( 1 )->translated( hb_parnd( 2 ), hb_parnd( 3 ) ) ), true ) ); } /* @@ -331,7 +348,7 @@ HB_FUNC( QT_QLINEF_TRANSLATED_1 ) */ HB_FUNC( QT_QLINEF_UNITVECTOR ) { - hb_retptrGC( hbqt_gcAllocate_QLineF( new QLineF( hbqt_par_QLineF( 1 )->unitVector() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLineF( new QLineF( hbqt_par_QLineF( 1 )->unitVector() ), true ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QList.cpp b/harbour/contrib/hbqt/qtcore/QList.cpp index 4fa5ed8a68..242449f62c 100644 --- a/harbour/contrib/hbqt/qtcore/QList.cpp +++ b/harbour/contrib/hbqt/qtcore/QList.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -103,32 +103,49 @@ * ~QList () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QList; + QT_G_FUNC( hbqt_gcRelease_QList ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QList p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QList ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QList< void * > * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QList Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QList< void * > * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QList ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QList Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QList Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QList Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QList( void * pObj ) +void * hbqt_gcAllocate_QList( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QList; - HB_TRACE( HB_TR_DEBUG, ( " new_QList %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QList ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -139,7 +156,7 @@ HB_FUNC( QT_QLIST ) QList* list = NULL; pObj = ( QList* ) list ; - hb_retptrGC( hbqt_gcAllocate_QList( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QList( pObj, true ) ); } /* * void append ( const T & value ) diff --git a/harbour/contrib/hbqt/qtcore/QLocale.cpp b/harbour/contrib/hbqt/qtcore/QLocale.cpp index 4093d6cd81..1c1f2c9f9a 100644 --- a/harbour/contrib/hbqt/qtcore/QLocale.cpp +++ b/harbour/contrib/hbqt/qtcore/QLocale.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -105,32 +105,49 @@ * QLocale ( const QLocale & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QLocale; + QT_G_FUNC( hbqt_gcRelease_QLocale ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLocale p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLocale ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QLocale * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QLocale Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QLocale * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QLocale ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QLocale Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QLocale Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QLocale Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QLocale( void * pObj ) +void * hbqt_gcAllocate_QLocale( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QLocale; - HB_TRACE( HB_TR_DEBUG, ( " new_QLocale %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QLocale ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -140,7 +157,7 @@ HB_FUNC( QT_QLOCALE ) pObj = new QLocale() ; - hb_retptrGC( hbqt_gcAllocate_QLocale( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QLocale( pObj, true ) ); } /* * QString amText () const @@ -267,7 +284,7 @@ HB_FUNC( QT_QLOCALE_TIMEFORMAT ) */ HB_FUNC( QT_QLOCALE_TODATE ) { - hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QLocale( 1 )->toDate( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( QLocale::FormatType ) hb_parni( 3 ) : ( QLocale::FormatType ) QLocale::LongFormat ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QLocale( 1 )->toDate( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( QLocale::FormatType ) hb_parni( 3 ) : ( QLocale::FormatType ) QLocale::LongFormat ) ) ), true ) ); } /* @@ -275,7 +292,7 @@ HB_FUNC( QT_QLOCALE_TODATE ) */ HB_FUNC( QT_QLOCALE_TODATE_1 ) { - hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QLocale( 1 )->toDate( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QLocale( 1 )->toDate( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ), true ) ); } /* @@ -283,7 +300,7 @@ HB_FUNC( QT_QLOCALE_TODATE_1 ) */ HB_FUNC( QT_QLOCALE_TODATETIME ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QLocale( 1 )->toDateTime( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( QLocale::FormatType ) hb_parni( 3 ) : ( QLocale::FormatType ) QLocale::LongFormat ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QLocale( 1 )->toDateTime( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( QLocale::FormatType ) hb_parni( 3 ) : ( QLocale::FormatType ) QLocale::LongFormat ) ) ), true ) ); } /* @@ -291,7 +308,7 @@ HB_FUNC( QT_QLOCALE_TODATETIME ) */ HB_FUNC( QT_QLOCALE_TODATETIME_1 ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QLocale( 1 )->toDateTime( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QLocale( 1 )->toDateTime( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ), true ) ); } /* @@ -471,7 +488,7 @@ HB_FUNC( QT_QLOCALE_TOSTRING_13 ) */ HB_FUNC( QT_QLOCALE_TOTIME ) { - hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QLocale( 1 )->toTime( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( QLocale::FormatType ) hb_parni( 3 ) : ( QLocale::FormatType ) QLocale::LongFormat ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QLocale( 1 )->toTime( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( QLocale::FormatType ) hb_parni( 3 ) : ( QLocale::FormatType ) QLocale::LongFormat ) ) ), true ) ); } /* @@ -479,7 +496,7 @@ HB_FUNC( QT_QLOCALE_TOTIME ) */ HB_FUNC( QT_QLOCALE_TOTIME_1 ) { - hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QLocale( 1 )->toTime( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QLocale( 1 )->toTime( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ), true ) ); } /* @@ -523,7 +540,7 @@ HB_FUNC( QT_QLOCALE_TOUSHORT ) */ HB_FUNC( QT_QLOCALE_C ) { - hb_retptrGC( hbqt_gcAllocate_QLocale( new QLocale( hbqt_par_QLocale( 1 )->c() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLocale( new QLocale( hbqt_par_QLocale( 1 )->c() ), true ) ); } /* @@ -555,7 +572,7 @@ HB_FUNC( QT_QLOCALE_SETDEFAULT ) */ HB_FUNC( QT_QLOCALE_SYSTEM ) { - hb_retptrGC( hbqt_gcAllocate_QLocale( new QLocale( hbqt_par_QLocale( 1 )->system() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLocale( new QLocale( hbqt_par_QLocale( 1 )->system() ), true ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QMimeData.cpp b/harbour/contrib/hbqt/qtcore/QMimeData.cpp index f708d419ab..b7e509890d 100644 --- a/harbour/contrib/hbqt/qtcore/QMimeData.cpp +++ b/harbour/contrib/hbqt/qtcore/QMimeData.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -89,6 +89,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QMimeData > pq; } QGC_POINTER_QMimeData; @@ -97,48 +98,47 @@ QT_G_FUNC( hbqt_gcRelease_QMimeData ) { QGC_POINTER_QMimeData * p = ( QGC_POINTER_QMimeData * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMimeData p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMimeData ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QMimeData * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QMimeData * ) p->ph )->~QMimeData(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QMimeData * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QMimeData ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QMimeData ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMimeData Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QMimeData Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QMimeData Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QMimeData Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QMimeData Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QMimeData( void * pObj ) +void * hbqt_gcAllocate_QMimeData( void * pObj, bool bNew ) { QGC_POINTER_QMimeData * p = ( QGC_POINTER_QMimeData * ) hb_gcAllocate( sizeof( QGC_POINTER_QMimeData ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QMimeData; - new( & p->pq ) QPointer< QMimeData >( ( QMimeData * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QMimeData %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QMimeData >( ( QMimeData * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QMimeData ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -148,7 +148,7 @@ HB_FUNC( QT_QMIMEDATA ) pObj = new QMimeData() ; - hb_retptrGC( hbqt_gcAllocate_QMimeData( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QMimeData( pObj, true ) ); } /* * void clear () @@ -163,7 +163,7 @@ HB_FUNC( QT_QMIMEDATA_CLEAR ) */ HB_FUNC( QT_QMIMEDATA_COLORDATA ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QMimeData( 1 )->colorData() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QMimeData( 1 )->colorData() ), true ) ); } /* @@ -171,7 +171,7 @@ HB_FUNC( QT_QMIMEDATA_COLORDATA ) */ HB_FUNC( QT_QMIMEDATA_DATA ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QMimeData( 1 )->data( QMimeData::tr( hb_parc( 2 ) ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QMimeData( 1 )->data( QMimeData::tr( hb_parc( 2 ) ) ) ), true ) ); } /* @@ -179,7 +179,7 @@ HB_FUNC( QT_QMIMEDATA_DATA ) */ HB_FUNC( QT_QMIMEDATA_FORMATS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QMimeData( 1 )->formats() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QMimeData( 1 )->formats() ), true ) ); } /* @@ -243,7 +243,7 @@ HB_FUNC( QT_QMIMEDATA_HTML ) */ HB_FUNC( QT_QMIMEDATA_IMAGEDATA ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QMimeData( 1 )->imageData() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QMimeData( 1 )->imageData() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QModelIndex.cpp b/harbour/contrib/hbqt/qtcore/QModelIndex.cpp index 333cb6ff63..4b2be4c1f1 100644 --- a/harbour/contrib/hbqt/qtcore/QModelIndex.cpp +++ b/harbour/contrib/hbqt/qtcore/QModelIndex.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -77,32 +77,49 @@ * ~QModelIndex () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QModelIndex; + QT_G_FUNC( hbqt_gcRelease_QModelIndex ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QModelIndex p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QModelIndex ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QModelIndex * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QModelIndex Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QModelIndex * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QModelIndex ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QModelIndex Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QModelIndex Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QModelIndex Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QModelIndex( void * pObj ) +void * hbqt_gcAllocate_QModelIndex( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QModelIndex; - HB_TRACE( HB_TR_DEBUG, ( " new_QModelIndex %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QModelIndex ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -112,14 +129,14 @@ HB_FUNC( QT_QMODELINDEX ) pObj = new QModelIndex() ; - hb_retptrGC( hbqt_gcAllocate_QModelIndex( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( pObj, true ) ); } /* * QModelIndex child ( int row, int column ) const */ HB_FUNC( QT_QMODELINDEX_CHILD ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QModelIndex( 1 )->child( hb_parni( 2 ), hb_parni( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QModelIndex( 1 )->child( hb_parni( 2 ), hb_parni( 3 ) ) ), true ) ); } /* @@ -135,7 +152,7 @@ HB_FUNC( QT_QMODELINDEX_COLUMN ) */ HB_FUNC( QT_QMODELINDEX_DATA ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QModelIndex( 1 )->data( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : Qt::DisplayRole ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QModelIndex( 1 )->data( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : Qt::DisplayRole ) ) ), true ) ); } /* @@ -183,7 +200,7 @@ HB_FUNC( QT_QMODELINDEX_MODEL ) */ HB_FUNC( QT_QMODELINDEX_PARENT ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QModelIndex( 1 )->parent() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QModelIndex( 1 )->parent() ), true ) ); } /* @@ -199,7 +216,7 @@ HB_FUNC( QT_QMODELINDEX_ROW ) */ HB_FUNC( QT_QMODELINDEX_SIBLING ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QModelIndex( 1 )->sibling( hb_parni( 2 ), hb_parni( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QModelIndex( 1 )->sibling( hb_parni( 2 ), hb_parni( 3 ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QObject.cpp b/harbour/contrib/hbqt/qtcore/QObject.cpp index 869ec45c1e..d1dbc2c815 100644 --- a/harbour/contrib/hbqt/qtcore/QObject.cpp +++ b/harbour/contrib/hbqt/qtcore/QObject.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -96,6 +96,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QObject > pq; } QGC_POINTER_QObject; @@ -104,48 +105,47 @@ QT_G_FUNC( hbqt_gcRelease_QObject ) { QGC_POINTER_QObject * p = ( QGC_POINTER_QObject * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QObject p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QObject ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QObject * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QObject * ) p->ph )->~QObject(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QObject * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QObject ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QObject ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QObject Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QObject Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QObject Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QObject Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QObject Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QObject( void * pObj ) +void * hbqt_gcAllocate_QObject( void * pObj, bool bNew ) { QGC_POINTER_QObject * p = ( QGC_POINTER_QObject * ) hb_gcAllocate( sizeof( QGC_POINTER_QObject ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QObject; - new( & p->pq ) QPointer< QObject >( ( QObject * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QObject %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QObject >( ( QObject * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QObject ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -155,7 +155,7 @@ HB_FUNC( QT_QOBJECT ) pObj = ( QObject* ) new QObject( hbqt_par_QObject( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QObject( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QObject( pObj, true ) ); } /* * bool blockSignals ( bool block ) @@ -282,7 +282,7 @@ HB_FUNC( QT_QOBJECT_OBJECTNAME ) */ HB_FUNC( QT_QOBJECT_PARENT ) { - hb_retptr( ( QObject* ) hbqt_par_QObject( 1 )->parent() ); + hb_retptrGC( hbqt_gcAllocate_QObject( hbqt_par_QObject( 1 )->parent(), false ) ); } /* @@ -290,7 +290,7 @@ HB_FUNC( QT_QOBJECT_PARENT ) */ HB_FUNC( QT_QOBJECT_PROPERTY ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QObject( 1 )->property( hbqt_par_char( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QObject( 1 )->property( hbqt_par_char( 2 ) ) ), true ) ); } /* @@ -346,7 +346,7 @@ HB_FUNC( QT_QOBJECT_STARTTIMER ) */ HB_FUNC( QT_QOBJECT_THREAD ) { - hb_retptr( ( QThread* ) hbqt_par_QObject( 1 )->thread() ); + hb_retptrGC( hbqt_gcAllocate_QThread( hbqt_par_QObject( 1 )->thread(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QPoint.cpp b/harbour/contrib/hbqt/qtcore/QPoint.cpp index 500aac4f98..0e5bd1249e 100644 --- a/harbour/contrib/hbqt/qtcore/QPoint.cpp +++ b/harbour/contrib/hbqt/qtcore/QPoint.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -77,32 +77,49 @@ * ~QPoint () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QPoint; + QT_G_FUNC( hbqt_gcRelease_QPoint ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPoint p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPoint ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QPoint * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QPoint Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QPoint * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPoint ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QPoint Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QPoint Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QPoint Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QPoint( void * pObj ) +void * hbqt_gcAllocate_QPoint( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QPoint; - HB_TRACE( HB_TR_DEBUG, ( " new_QPoint %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QPoint ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -123,7 +140,7 @@ HB_FUNC( QT_QPOINT ) pObj = ( QPoint* ) new QPoint() ; } - hb_retptrGC( hbqt_gcAllocate_QPoint( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( pObj, true ) ); } /* * bool isNull () const diff --git a/harbour/contrib/hbqt/qtcore/QPointF.cpp b/harbour/contrib/hbqt/qtcore/QPointF.cpp index 46a8bcf442..06c1330d40 100644 --- a/harbour/contrib/hbqt/qtcore/QPointF.cpp +++ b/harbour/contrib/hbqt/qtcore/QPointF.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -77,32 +77,49 @@ * QPointF ( qreal x, qreal y ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QPointF; + QT_G_FUNC( hbqt_gcRelease_QPointF ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPointF p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPointF ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QPointF * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QPointF Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QPointF * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPointF ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QPointF Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QPointF Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QPointF Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QPointF( void * pObj ) +void * hbqt_gcAllocate_QPointF( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QPointF; - HB_TRACE( HB_TR_DEBUG, ( " new_QPointF %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QPointF ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -123,7 +140,7 @@ HB_FUNC( QT_QPOINTF ) pObj = ( QPointF* ) new QPointF() ; } - hb_retptrGC( hbqt_gcAllocate_QPointF( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( pObj, true ) ); } /* * bool isNull () const @@ -170,7 +187,7 @@ HB_FUNC( QT_QPOINTF_SETY ) */ HB_FUNC( QT_QPOINTF_TOPOINT ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QPointF( 1 )->toPoint() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QPointF( 1 )->toPoint() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QProcess.cpp b/harbour/contrib/hbqt/qtcore/QProcess.cpp index b63a3b71c1..9a20b72b3e 100644 --- a/harbour/contrib/hbqt/qtcore/QProcess.cpp +++ b/harbour/contrib/hbqt/qtcore/QProcess.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -90,6 +90,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QProcess > pq; } QGC_POINTER_QProcess; @@ -98,48 +99,47 @@ QT_G_FUNC( hbqt_gcRelease_QProcess ) { QGC_POINTER_QProcess * p = ( QGC_POINTER_QProcess * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QProcess p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QProcess ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QProcess * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QProcess * ) p->ph )->~QProcess(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QProcess * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QProcess ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QProcess ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QProcess Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QProcess Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QProcess Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QProcess Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QProcess Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QProcess( void * pObj ) +void * hbqt_gcAllocate_QProcess( void * pObj, bool bNew ) { QGC_POINTER_QProcess * p = ( QGC_POINTER_QProcess * ) hb_gcAllocate( sizeof( QGC_POINTER_QProcess ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QProcess; - new( & p->pq ) QPointer< QProcess >( ( QProcess * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QProcess %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QProcess >( ( QProcess * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QProcess ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -156,7 +156,7 @@ HB_FUNC( QT_QPROCESS ) pObj = ( QProcess* ) new QProcess() ; } - hb_retptrGC( hbqt_gcAllocate_QProcess( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QProcess( pObj, true ) ); } /* * virtual void close () @@ -187,7 +187,7 @@ HB_FUNC( QT_QPROCESS_CLOSEWRITECHANNEL ) */ HB_FUNC( QT_QPROCESS_ENVIRONMENT ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QProcess( 1 )->environment() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QProcess( 1 )->environment() ), true ) ); } /* @@ -227,7 +227,7 @@ HB_FUNC( QT_QPROCESS_PROCESSCHANNELMODE ) */ HB_FUNC( QT_QPROCESS_READALLSTANDARDERROR ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QProcess( 1 )->readAllStandardError() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QProcess( 1 )->readAllStandardError() ), true ) ); } /* @@ -235,7 +235,7 @@ HB_FUNC( QT_QPROCESS_READALLSTANDARDERROR ) */ HB_FUNC( QT_QPROCESS_READALLSTANDARDOUTPUT ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QProcess( 1 )->readAllStandardOutput() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QProcess( 1 )->readAllStandardOutput() ), true ) ); } /* @@ -407,7 +407,7 @@ HB_FUNC( QT_QPROCESS_STARTDETACHED_2 ) */ HB_FUNC( QT_QPROCESS_SYSTEMENVIRONMENT ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QProcess( 1 )->systemEnvironment() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QProcess( 1 )->systemEnvironment() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QRect.cpp b/harbour/contrib/hbqt/qtcore/QRect.cpp index af3b4f8df5..a308cd01cb 100644 --- a/harbour/contrib/hbqt/qtcore/QRect.cpp +++ b/harbour/contrib/hbqt/qtcore/QRect.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,32 +79,49 @@ * ~QRect () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QRect; + QT_G_FUNC( hbqt_gcRelease_QRect ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QRect p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QRect ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QRect * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QRect Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QRect * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QRect ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QRect Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QRect Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QRect Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QRect( void * pObj ) +void * hbqt_gcAllocate_QRect( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QRect; - HB_TRACE( HB_TR_DEBUG, ( " new_QRect %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QRect ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -129,7 +146,7 @@ HB_FUNC( QT_QRECT ) pObj = ( QRect* ) new QRect() ; } - hb_retptrGC( hbqt_gcAllocate_QRect( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( pObj, true ) ); } /* * void adjust ( int dx1, int dy1, int dx2, int dy2 ) @@ -144,7 +161,7 @@ HB_FUNC( QT_QRECT_ADJUST ) */ HB_FUNC( QT_QRECT_ADJUSTED ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QRect( 1 )->adjusted( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QRect( 1 )->adjusted( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) ) ), true ) ); } /* @@ -160,7 +177,7 @@ HB_FUNC( QT_QRECT_BOTTOM ) */ HB_FUNC( QT_QRECT_BOTTOMLEFT ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QRect( 1 )->bottomLeft() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QRect( 1 )->bottomLeft() ), true ) ); } /* @@ -168,7 +185,7 @@ HB_FUNC( QT_QRECT_BOTTOMLEFT ) */ HB_FUNC( QT_QRECT_BOTTOMRIGHT ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QRect( 1 )->bottomRight() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QRect( 1 )->bottomRight() ), true ) ); } /* @@ -176,7 +193,7 @@ HB_FUNC( QT_QRECT_BOTTOMRIGHT ) */ HB_FUNC( QT_QRECT_CENTER ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QRect( 1 )->center() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QRect( 1 )->center() ), true ) ); } /* @@ -260,7 +277,7 @@ HB_FUNC( QT_QRECT_HEIGHT ) */ HB_FUNC( QT_QRECT_INTERSECTED ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QRect( 1 )->intersected( *hbqt_par_QRect( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QRect( 1 )->intersected( *hbqt_par_QRect( 2 ) ) ), true ) ); } /* @@ -396,7 +413,7 @@ HB_FUNC( QT_QRECT_MOVETOPRIGHT ) */ HB_FUNC( QT_QRECT_NORMALIZED ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QRect( 1 )->normalized() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QRect( 1 )->normalized() ), true ) ); } /* @@ -532,7 +549,7 @@ HB_FUNC( QT_QRECT_SETY ) */ HB_FUNC( QT_QRECT_SIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QRect( 1 )->size() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QRect( 1 )->size() ), true ) ); } /* @@ -548,7 +565,7 @@ HB_FUNC( QT_QRECT_TOP ) */ HB_FUNC( QT_QRECT_TOPLEFT ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QRect( 1 )->topLeft() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QRect( 1 )->topLeft() ), true ) ); } /* @@ -556,7 +573,7 @@ HB_FUNC( QT_QRECT_TOPLEFT ) */ HB_FUNC( QT_QRECT_TOPRIGHT ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QRect( 1 )->topRight() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QRect( 1 )->topRight() ), true ) ); } /* @@ -580,7 +597,7 @@ HB_FUNC( QT_QRECT_TRANSLATE_1 ) */ HB_FUNC( QT_QRECT_TRANSLATED ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QRect( 1 )->translated( hb_parni( 2 ), hb_parni( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QRect( 1 )->translated( hb_parni( 2 ), hb_parni( 3 ) ) ), true ) ); } /* @@ -588,7 +605,7 @@ HB_FUNC( QT_QRECT_TRANSLATED ) */ HB_FUNC( QT_QRECT_TRANSLATED_1 ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QRect( 1 )->translated( *hbqt_par_QPoint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QRect( 1 )->translated( *hbqt_par_QPoint( 2 ) ) ), true ) ); } /* @@ -596,7 +613,7 @@ HB_FUNC( QT_QRECT_TRANSLATED_1 ) */ HB_FUNC( QT_QRECT_UNITED ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QRect( 1 )->united( *hbqt_par_QRect( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QRect( 1 )->united( *hbqt_par_QRect( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QRectF.cpp b/harbour/contrib/hbqt/qtcore/QRectF.cpp index 41ef82b04c..d1b8b6c08b 100644 --- a/harbour/contrib/hbqt/qtcore/QRectF.cpp +++ b/harbour/contrib/hbqt/qtcore/QRectF.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,32 +80,49 @@ * ~QRectF () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QRectF; + QT_G_FUNC( hbqt_gcRelease_QRectF ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QRectF p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QRectF ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QRectF * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QRectF Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QRectF * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QRectF ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QRectF Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QRectF Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QRectF Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QRectF( void * pObj ) +void * hbqt_gcAllocate_QRectF( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QRectF; - HB_TRACE( HB_TR_DEBUG, ( " new_QRectF %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QRectF ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -130,7 +147,7 @@ HB_FUNC( QT_QRECTF ) pObj = ( QRectF* ) new QRectF() ; } - hb_retptrGC( hbqt_gcAllocate_QRectF( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( pObj, true ) ); } /* * void adjust ( qreal dx1, qreal dy1, qreal dx2, qreal dy2 ) @@ -145,7 +162,7 @@ HB_FUNC( QT_QRECTF_ADJUST ) */ HB_FUNC( QT_QRECTF_ADJUSTED ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QRectF( 1 )->adjusted( hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QRectF( 1 )->adjusted( hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ) ) ), true ) ); } /* @@ -161,7 +178,7 @@ HB_FUNC( QT_QRECTF_BOTTOM ) */ HB_FUNC( QT_QRECTF_BOTTOMLEFT ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QRectF( 1 )->bottomLeft() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QRectF( 1 )->bottomLeft() ), true ) ); } /* @@ -169,7 +186,7 @@ HB_FUNC( QT_QRECTF_BOTTOMLEFT ) */ HB_FUNC( QT_QRECTF_BOTTOMRIGHT ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QRectF( 1 )->bottomRight() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QRectF( 1 )->bottomRight() ), true ) ); } /* @@ -177,7 +194,7 @@ HB_FUNC( QT_QRECTF_BOTTOMRIGHT ) */ HB_FUNC( QT_QRECTF_CENTER ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QRectF( 1 )->center() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QRectF( 1 )->center() ), true ) ); } /* @@ -253,7 +270,7 @@ HB_FUNC( QT_QRECTF_HEIGHT ) */ HB_FUNC( QT_QRECTF_INTERSECTED ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QRectF( 1 )->intersected( *hbqt_par_QRectF( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QRectF( 1 )->intersected( *hbqt_par_QRectF( 2 ) ) ), true ) ); } /* @@ -389,7 +406,7 @@ HB_FUNC( QT_QRECTF_MOVETOPRIGHT ) */ HB_FUNC( QT_QRECTF_NORMALIZED ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QRectF( 1 )->normalized() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QRectF( 1 )->normalized() ), true ) ); } /* @@ -525,7 +542,7 @@ HB_FUNC( QT_QRECTF_SETY ) */ HB_FUNC( QT_QRECTF_SIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSizeF( new QSizeF( hbqt_par_QRectF( 1 )->size() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSizeF( new QSizeF( hbqt_par_QRectF( 1 )->size() ), true ) ); } /* @@ -533,7 +550,7 @@ HB_FUNC( QT_QRECTF_SIZE ) */ HB_FUNC( QT_QRECTF_TOALIGNEDRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QRectF( 1 )->toAlignedRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QRectF( 1 )->toAlignedRect() ), true ) ); } /* @@ -541,7 +558,7 @@ HB_FUNC( QT_QRECTF_TOALIGNEDRECT ) */ HB_FUNC( QT_QRECTF_TORECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QRectF( 1 )->toRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QRectF( 1 )->toRect() ), true ) ); } /* @@ -557,7 +574,7 @@ HB_FUNC( QT_QRECTF_TOP ) */ HB_FUNC( QT_QRECTF_TOPLEFT ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QRectF( 1 )->topLeft() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QRectF( 1 )->topLeft() ), true ) ); } /* @@ -565,7 +582,7 @@ HB_FUNC( QT_QRECTF_TOPLEFT ) */ HB_FUNC( QT_QRECTF_TOPRIGHT ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QRectF( 1 )->topRight() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QRectF( 1 )->topRight() ), true ) ); } /* @@ -589,7 +606,7 @@ HB_FUNC( QT_QRECTF_TRANSLATE_1 ) */ HB_FUNC( QT_QRECTF_TRANSLATED ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QRectF( 1 )->translated( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QRectF( 1 )->translated( hb_parnd( 2 ), hb_parnd( 3 ) ) ), true ) ); } /* @@ -597,7 +614,7 @@ HB_FUNC( QT_QRECTF_TRANSLATED ) */ HB_FUNC( QT_QRECTF_TRANSLATED_1 ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QRectF( 1 )->translated( *hbqt_par_QPointF( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QRectF( 1 )->translated( *hbqt_par_QPointF( 2 ) ) ), true ) ); } /* @@ -605,7 +622,7 @@ HB_FUNC( QT_QRECTF_TRANSLATED_1 ) */ HB_FUNC( QT_QRECTF_UNITED ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QRectF( 1 )->united( *hbqt_par_QRectF( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QRectF( 1 )->united( *hbqt_par_QRectF( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QRegExp.cpp b/harbour/contrib/hbqt/qtcore/QRegExp.cpp index 7ac522e1b1..52611b42e1 100644 --- a/harbour/contrib/hbqt/qtcore/QRegExp.cpp +++ b/harbour/contrib/hbqt/qtcore/QRegExp.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -82,32 +82,49 @@ * ~QRegExp () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QRegExp; + QT_G_FUNC( hbqt_gcRelease_QRegExp ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QRegExp p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QRegExp ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QRegExp * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QRegExp Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QRegExp * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QRegExp ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QRegExp Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QRegExp Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QRegExp Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QRegExp( void * pObj ) +void * hbqt_gcAllocate_QRegExp( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QRegExp; - HB_TRACE( HB_TR_DEBUG, ( " new_QRegExp %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QRegExp ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -117,7 +134,7 @@ HB_FUNC( QT_QREGEXP ) pObj = new QRegExp() ; - hb_retptrGC( hbqt_gcAllocate_QRegExp( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QRegExp( pObj, true ) ); } /* * QString cap ( int nth = 0 ) const @@ -132,7 +149,7 @@ HB_FUNC( QT_QREGEXP_CAP ) */ HB_FUNC( QT_QREGEXP_CAPTUREDTEXTS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QRegExp( 1 )->capturedTexts() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QRegExp( 1 )->capturedTexts() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QResource.cpp b/harbour/contrib/hbqt/qtcore/QResource.cpp index 79b6ff036c..9ed75207c1 100644 --- a/harbour/contrib/hbqt/qtcore/QResource.cpp +++ b/harbour/contrib/hbqt/qtcore/QResource.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -76,32 +76,49 @@ * ~QResource () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QResource; + QT_G_FUNC( hbqt_gcRelease_QResource ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QResource p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QResource ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QResource * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QResource Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QResource * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QResource ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QResource Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QResource Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QResource Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QResource( void * pObj ) +void * hbqt_gcAllocate_QResource( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QResource; - HB_TRACE( HB_TR_DEBUG, ( " new_QResource %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QResource ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -111,7 +128,7 @@ HB_FUNC( QT_QRESOURCE ) pObj = ( QResource* ) new QResource() ; - hb_retptrGC( hbqt_gcAllocate_QResource( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QResource( pObj, true ) ); } /* * QString absoluteFilePath () const @@ -158,7 +175,7 @@ HB_FUNC( QT_QRESOURCE_ISVALID ) */ HB_FUNC( QT_QRESOURCE_LOCALE ) { - hb_retptrGC( hbqt_gcAllocate_QLocale( new QLocale( hbqt_par_QResource( 1 )->locale() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLocale( new QLocale( hbqt_par_QResource( 1 )->locale() ), true ) ); } /* @@ -198,7 +215,7 @@ HB_FUNC( QT_QRESOURCE_REGISTERRESOURCE ) */ HB_FUNC( QT_QRESOURCE_SEARCHPATHS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QResource( 1 )->searchPaths() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QResource( 1 )->searchPaths() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QSettings.cpp b/harbour/contrib/hbqt/qtcore/QSettings.cpp index 47a4e41c9a..0b1907e488 100644 --- a/harbour/contrib/hbqt/qtcore/QSettings.cpp +++ b/harbour/contrib/hbqt/qtcore/QSettings.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -89,6 +89,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QSettings > pq; } QGC_POINTER_QSettings; @@ -97,48 +98,47 @@ QT_G_FUNC( hbqt_gcRelease_QSettings ) { QGC_POINTER_QSettings * p = ( QGC_POINTER_QSettings * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSettings p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSettings ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QSettings * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QSettings * ) p->ph )->~QSettings(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QSettings * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QSettings ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QSettings ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSettings Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QSettings Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QSettings Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QSettings Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QSettings Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QSettings( void * pObj ) +void * hbqt_gcAllocate_QSettings( void * pObj, bool bNew ) { QGC_POINTER_QSettings * p = ( QGC_POINTER_QSettings * ) hb_gcAllocate( sizeof( QGC_POINTER_QSettings ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QSettings; - new( & p->pq ) QPointer< QSettings >( ( QSettings * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QSettings %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QSettings >( ( QSettings * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QSettings ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -159,14 +159,14 @@ HB_FUNC( QT_QSETTINGS ) pObj = new QSettings() ; } - hb_retptrGC( hbqt_gcAllocate_QSettings( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QSettings( pObj, true ) ); } /* * QStringList allKeys () const */ HB_FUNC( QT_QSETTINGS_ALLKEYS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QSettings( 1 )->allKeys() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QSettings( 1 )->allKeys() ), true ) ); } /* @@ -206,7 +206,7 @@ HB_FUNC( QT_QSETTINGS_BEGINWRITEARRAY ) */ HB_FUNC( QT_QSETTINGS_CHILDGROUPS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QSettings( 1 )->childGroups() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QSettings( 1 )->childGroups() ), true ) ); } /* @@ -214,7 +214,7 @@ HB_FUNC( QT_QSETTINGS_CHILDGROUPS ) */ HB_FUNC( QT_QSETTINGS_CHILDKEYS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QSettings( 1 )->childKeys() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QSettings( 1 )->childKeys() ), true ) ); } /* @@ -286,7 +286,7 @@ HB_FUNC( QT_QSETTINGS_GROUP ) */ HB_FUNC( QT_QSETTINGS_INICODEC ) { - hb_retptr( ( QTextCodec* ) hbqt_par_QSettings( 1 )->iniCodec() ); + hb_retptrGC( hbqt_gcAllocate_QTextCodec( hbqt_par_QSettings( 1 )->iniCodec(), false ) ); } /* @@ -382,7 +382,7 @@ HB_FUNC( QT_QSETTINGS_SYNC ) */ HB_FUNC( QT_QSETTINGS_VALUE ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QSettings( 1 )->value( QSettings::tr( hb_parc( 2 ) ), ( HB_ISPOINTER( 3 ) ? *hbqt_par_QVariant( 3 ) : QVariant() ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QSettings( 1 )->value( QSettings::tr( hb_parc( 2 ) ), ( HB_ISPOINTER( 3 ) ? *hbqt_par_QVariant( 3 ) : QVariant() ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QSignalMapper.cpp b/harbour/contrib/hbqt/qtcore/QSignalMapper.cpp index 2c76de4a86..54010c7bce 100644 --- a/harbour/contrib/hbqt/qtcore/QSignalMapper.cpp +++ b/harbour/contrib/hbqt/qtcore/QSignalMapper.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QSignalMapper > pq; } QGC_POINTER_QSignalMapper; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QSignalMapper ) { QGC_POINTER_QSignalMapper * p = ( QGC_POINTER_QSignalMapper * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSignalMapper p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSignalMapper ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QSignalMapper * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QSignalMapper * ) p->ph )->~QSignalMapper(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QSignalMapper * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QSignalMapper ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QSignalMapper ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSignalMapper Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QSignalMapper Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QSignalMapper Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QSignalMapper Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QSignalMapper Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QSignalMapper( void * pObj ) +void * hbqt_gcAllocate_QSignalMapper( void * pObj, bool bNew ) { QGC_POINTER_QSignalMapper * p = ( QGC_POINTER_QSignalMapper * ) hb_gcAllocate( sizeof( QGC_POINTER_QSignalMapper ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QSignalMapper; - new( & p->pq ) QPointer< QSignalMapper >( ( QSignalMapper * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QSignalMapper %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QSignalMapper >( ( QSignalMapper * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QSignalMapper ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -138,14 +138,14 @@ HB_FUNC( QT_QSIGNALMAPPER ) pObj = new QSignalMapper( hbqt_par_QObject( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QSignalMapper( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QSignalMapper( pObj, true ) ); } /* * QObject * mapping ( int id ) const */ HB_FUNC( QT_QSIGNALMAPPER_MAPPING ) { - hb_retptr( ( QObject* ) hbqt_par_QSignalMapper( 1 )->mapping( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QObject( hbqt_par_QSignalMapper( 1 )->mapping( hb_parni( 2 ) ), false ) ); } /* @@ -153,7 +153,7 @@ HB_FUNC( QT_QSIGNALMAPPER_MAPPING ) */ HB_FUNC( QT_QSIGNALMAPPER_MAPPING_1 ) { - hb_retptr( ( QObject* ) hbqt_par_QSignalMapper( 1 )->mapping( QSignalMapper::tr( hb_parc( 2 ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QObject( hbqt_par_QSignalMapper( 1 )->mapping( QSignalMapper::tr( hb_parc( 2 ) ) ), false ) ); } /* @@ -161,7 +161,7 @@ HB_FUNC( QT_QSIGNALMAPPER_MAPPING_1 ) */ HB_FUNC( QT_QSIGNALMAPPER_MAPPING_2 ) { - hb_retptr( ( QObject* ) hbqt_par_QSignalMapper( 1 )->mapping( hbqt_par_QWidget( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QObject( hbqt_par_QSignalMapper( 1 )->mapping( hbqt_par_QWidget( 2 ) ), false ) ); } /* @@ -169,7 +169,7 @@ HB_FUNC( QT_QSIGNALMAPPER_MAPPING_2 ) */ HB_FUNC( QT_QSIGNALMAPPER_MAPPING_3 ) { - hb_retptr( ( QObject* ) hbqt_par_QSignalMapper( 1 )->mapping( hbqt_par_QObject( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QObject( hbqt_par_QSignalMapper( 1 )->mapping( hbqt_par_QObject( 2 ) ), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QSize.cpp b/harbour/contrib/hbqt/qtcore/QSize.cpp index cba25502c5..35052b31c8 100644 --- a/harbour/contrib/hbqt/qtcore/QSize.cpp +++ b/harbour/contrib/hbqt/qtcore/QSize.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -77,32 +77,49 @@ * ~QSize () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QSize; + QT_G_FUNC( hbqt_gcRelease_QSize ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSize p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSize ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QSize * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QSize Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QSize * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QSize ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QSize Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QSize Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QSize Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QSize( void * pObj ) +void * hbqt_gcAllocate_QSize( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QSize; - HB_TRACE( HB_TR_DEBUG, ( " new_QSize %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QSize ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -123,7 +140,7 @@ HB_FUNC( QT_QSIZE ) pObj = ( QSize* ) new QSize() ; } - hb_retptrGC( hbqt_gcAllocate_QSize( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( pObj, true ) ); } /* * int height () const @@ -226,7 +243,7 @@ HB_FUNC( QT_QSIZE_WIDTH ) */ HB_FUNC( QT_QSIZE_BOUNDEDTO ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QSize( 1 )->boundedTo( *hbqt_par_QSize( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QSize( 1 )->boundedTo( *hbqt_par_QSize( 2 ) ) ), true ) ); } /* @@ -234,7 +251,7 @@ HB_FUNC( QT_QSIZE_BOUNDEDTO ) */ HB_FUNC( QT_QSIZE_EXPANDEDTO ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QSize( 1 )->expandedTo( *hbqt_par_QSize( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QSize( 1 )->expandedTo( *hbqt_par_QSize( 2 ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QSizeF.cpp b/harbour/contrib/hbqt/qtcore/QSizeF.cpp index 767698fc1f..0a09332c16 100644 --- a/harbour/contrib/hbqt/qtcore/QSizeF.cpp +++ b/harbour/contrib/hbqt/qtcore/QSizeF.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -78,32 +78,49 @@ * ~QSizeF () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QSizeF; + QT_G_FUNC( hbqt_gcRelease_QSizeF ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSizeF p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSizeF ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QSizeF * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QSizeF Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QSizeF * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QSizeF ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QSizeF Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QSizeF Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QSizeF Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QSizeF( void * pObj ) +void * hbqt_gcAllocate_QSizeF( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QSizeF; - HB_TRACE( HB_TR_DEBUG, ( " new_QSizeF %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QSizeF ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -120,14 +137,14 @@ HB_FUNC( QT_QSIZEF ) pObj = ( QSizeF* ) new QSizeF() ; } - hb_retptrGC( hbqt_gcAllocate_QSizeF( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QSizeF( pObj, true ) ); } /* * QSizeF boundedTo ( const QSizeF & otherSize ) const */ HB_FUNC( QT_QSIZEF_BOUNDEDTO ) { - hb_retptrGC( hbqt_gcAllocate_QSizeF( new QSizeF( hbqt_par_QSizeF( 1 )->boundedTo( *hbqt_par_QSizeF( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSizeF( new QSizeF( hbqt_par_QSizeF( 1 )->boundedTo( *hbqt_par_QSizeF( 2 ) ) ), true ) ); } /* @@ -135,7 +152,7 @@ HB_FUNC( QT_QSIZEF_BOUNDEDTO ) */ HB_FUNC( QT_QSIZEF_EXPANDEDTO ) { - hb_retptrGC( hbqt_gcAllocate_QSizeF( new QSizeF( hbqt_par_QSizeF( 1 )->expandedTo( *hbqt_par_QSizeF( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSizeF( new QSizeF( hbqt_par_QSizeF( 1 )->expandedTo( *hbqt_par_QSizeF( 2 ) ) ), true ) ); } /* @@ -223,7 +240,7 @@ HB_FUNC( QT_QSIZEF_SETWIDTH ) */ HB_FUNC( QT_QSIZEF_TOSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QSizeF( 1 )->toSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QSizeF( 1 )->toSize() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QStringList.cpp b/harbour/contrib/hbqt/qtcore/QStringList.cpp index 7158a92b9a..0eff186a4d 100644 --- a/harbour/contrib/hbqt/qtcore/QStringList.cpp +++ b/harbour/contrib/hbqt/qtcore/QStringList.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -96,32 +96,49 @@ * QStringList ( const QList & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStringList; + QT_G_FUNC( hbqt_gcRelease_QStringList ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStringList p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStringList ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStringList * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStringList Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStringList * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStringList ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStringList Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStringList Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStringList Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStringList( void * pObj ) +void * hbqt_gcAllocate_QStringList( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStringList; - HB_TRACE( HB_TR_DEBUG, ( " new_QStringList %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStringList ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -131,7 +148,7 @@ HB_FUNC( QT_QSTRINGLIST ) pObj = ( QStringList* ) new QStringList() ; - hb_retptrGC( hbqt_gcAllocate_QStringList( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( pObj, true ) ); } /* * void append ( const QString & value ) @@ -146,7 +163,7 @@ HB_FUNC( QT_QSTRINGLIST_APPEND ) */ HB_FUNC( QT_QSTRINGLIST_FILTER ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QStringList( 1 )->filter( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::CaseSensitivity ) hb_parni( 3 ) : ( Qt::CaseSensitivity ) Qt::CaseSensitive ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QStringList( 1 )->filter( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::CaseSensitivity ) hb_parni( 3 ) : ( Qt::CaseSensitivity ) Qt::CaseSensitive ) ) ), true ) ); } /* @@ -154,7 +171,7 @@ HB_FUNC( QT_QSTRINGLIST_FILTER ) */ HB_FUNC( QT_QSTRINGLIST_FILTER_1 ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QStringList( 1 )->filter( *hbqt_par_QRegExp( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QStringList( 1 )->filter( *hbqt_par_QRegExp( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QTextBoundaryFinder.cpp b/harbour/contrib/hbqt/qtcore/QTextBoundaryFinder.cpp index 81f6ecbbe2..f7ff897e0e 100644 --- a/harbour/contrib/hbqt/qtcore/QTextBoundaryFinder.cpp +++ b/harbour/contrib/hbqt/qtcore/QTextBoundaryFinder.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -85,32 +85,49 @@ * ~QTextBoundaryFinder () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextBoundaryFinder; + QT_G_FUNC( hbqt_gcRelease_QTextBoundaryFinder ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextBoundaryFinder p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextBoundaryFinder ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextBoundaryFinder * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextBoundaryFinder Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextBoundaryFinder * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextBoundaryFinder ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextBoundaryFinder Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextBoundaryFinder Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextBoundaryFinder Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextBoundaryFinder( void * pObj ) +void * hbqt_gcAllocate_QTextBoundaryFinder( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextBoundaryFinder; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextBoundaryFinder %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextBoundaryFinder ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -120,7 +137,7 @@ HB_FUNC( QT_QTEXTBOUNDARYFINDER ) pObj = ( QTextBoundaryFinder* ) new QTextBoundaryFinder() ; - hb_retptrGC( hbqt_gcAllocate_QTextBoundaryFinder( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextBoundaryFinder( pObj, true ) ); } /* * BoundaryReasons boundaryReasons () const diff --git a/harbour/contrib/hbqt/qtcore/QTextCodec.cpp b/harbour/contrib/hbqt/qtcore/QTextCodec.cpp index cbfb42e009..98e85ecee5 100644 --- a/harbour/contrib/hbqt/qtcore/QTextCodec.cpp +++ b/harbour/contrib/hbqt/qtcore/QTextCodec.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -95,11 +95,33 @@ * */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextCodec; + QT_G_FUNC( hbqt_gcRelease_QTextCodec ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QTextCodec( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QTextCodec; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextCodec ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QTEXTCODEC ) { } @@ -124,7 +146,7 @@ HB_FUNC( QT_QTEXTCODEC_CANENCODE_1 ) */ HB_FUNC( QT_QTEXTCODEC_FROMUNICODE ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QTextCodec( 1 )->fromUnicode( hbqt_par_QString( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QTextCodec( 1 )->fromUnicode( hbqt_par_QString( 2 ) ) ), true ) ); } /* @@ -132,7 +154,7 @@ HB_FUNC( QT_QTEXTCODEC_FROMUNICODE ) */ HB_FUNC( QT_QTEXTCODEC_MAKEDECODER ) { - hb_retptr( ( QTextDecoder* ) hbqt_par_QTextCodec( 1 )->makeDecoder() ); + hb_retptrGC( hbqt_gcAllocate_QTextDecoder( hbqt_par_QTextCodec( 1 )->makeDecoder(), false ) ); } /* @@ -140,7 +162,7 @@ HB_FUNC( QT_QTEXTCODEC_MAKEDECODER ) */ HB_FUNC( QT_QTEXTCODEC_MAKEENCODER ) { - hb_retptr( ( QTextEncoder* ) hbqt_par_QTextCodec( 1 )->makeEncoder() ); + hb_retptrGC( hbqt_gcAllocate_QTextEncoder( hbqt_par_QTextCodec( 1 )->makeEncoder(), false ) ); } /* @@ -156,7 +178,7 @@ HB_FUNC( QT_QTEXTCODEC_MIBENUM ) */ HB_FUNC( QT_QTEXTCODEC_NAME ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QTextCodec( 1 )->name() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QTextCodec( 1 )->name() ), true ) ); } /* @@ -180,7 +202,7 @@ HB_FUNC( QT_QTEXTCODEC_TOUNICODE_1 ) */ HB_FUNC( QT_QTEXTCODEC_CODECFORCSTRINGS ) { - hb_retptr( ( QTextCodec* ) hbqt_par_QTextCodec( 1 )->codecForCStrings() ); + hb_retptrGC( hbqt_gcAllocate_QTextCodec( hbqt_par_QTextCodec( 1 )->codecForCStrings(), false ) ); } /* @@ -188,7 +210,7 @@ HB_FUNC( QT_QTEXTCODEC_CODECFORCSTRINGS ) */ HB_FUNC( QT_QTEXTCODEC_CODECFORHTML ) { - hb_retptr( ( QTextCodec* ) hbqt_par_QTextCodec( 1 )->codecForHtml( *hbqt_par_QByteArray( 2 ), hbqt_par_QTextCodec( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCodec( hbqt_par_QTextCodec( 1 )->codecForHtml( *hbqt_par_QByteArray( 2 ), hbqt_par_QTextCodec( 3 ) ), false ) ); } /* @@ -196,7 +218,7 @@ HB_FUNC( QT_QTEXTCODEC_CODECFORHTML ) */ HB_FUNC( QT_QTEXTCODEC_CODECFORHTML_1 ) { - hb_retptr( ( QTextCodec* ) hbqt_par_QTextCodec( 1 )->codecForHtml( *hbqt_par_QByteArray( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCodec( hbqt_par_QTextCodec( 1 )->codecForHtml( *hbqt_par_QByteArray( 2 ) ), false ) ); } /* @@ -204,7 +226,7 @@ HB_FUNC( QT_QTEXTCODEC_CODECFORHTML_1 ) */ HB_FUNC( QT_QTEXTCODEC_CODECFORLOCALE ) { - hb_retptr( ( QTextCodec* ) hbqt_par_QTextCodec( 1 )->codecForLocale() ); + hb_retptrGC( hbqt_gcAllocate_QTextCodec( hbqt_par_QTextCodec( 1 )->codecForLocale(), false ) ); } /* @@ -212,7 +234,7 @@ HB_FUNC( QT_QTEXTCODEC_CODECFORLOCALE ) */ HB_FUNC( QT_QTEXTCODEC_CODECFORMIB ) { - hb_retptr( ( QTextCodec* ) hbqt_par_QTextCodec( 1 )->codecForMib( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCodec( hbqt_par_QTextCodec( 1 )->codecForMib( hb_parni( 2 ) ), false ) ); } /* @@ -220,7 +242,7 @@ HB_FUNC( QT_QTEXTCODEC_CODECFORMIB ) */ HB_FUNC( QT_QTEXTCODEC_CODECFORNAME ) { - hb_retptr( ( QTextCodec* ) hbqt_par_QTextCodec( 1 )->codecForName( *hbqt_par_QByteArray( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCodec( hbqt_par_QTextCodec( 1 )->codecForName( *hbqt_par_QByteArray( 2 ) ), false ) ); } /* @@ -228,7 +250,7 @@ HB_FUNC( QT_QTEXTCODEC_CODECFORNAME ) */ HB_FUNC( QT_QTEXTCODEC_CODECFORNAME_1 ) { - hb_retptr( ( QTextCodec* ) hbqt_par_QTextCodec( 1 )->codecForName( hbqt_par_char( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCodec( hbqt_par_QTextCodec( 1 )->codecForName( hbqt_par_char( 2 ) ), false ) ); } /* @@ -236,7 +258,7 @@ HB_FUNC( QT_QTEXTCODEC_CODECFORNAME_1 ) */ HB_FUNC( QT_QTEXTCODEC_CODECFORTR ) { - hb_retptr( ( QTextCodec* ) hbqt_par_QTextCodec( 1 )->codecForTr() ); + hb_retptrGC( hbqt_gcAllocate_QTextCodec( hbqt_par_QTextCodec( 1 )->codecForTr(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QTextDecoder.cpp b/harbour/contrib/hbqt/qtcore/QTextDecoder.cpp index 51c1350918..22964bb7ba 100644 --- a/harbour/contrib/hbqt/qtcore/QTextDecoder.cpp +++ b/harbour/contrib/hbqt/qtcore/QTextDecoder.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -76,32 +76,49 @@ * ~QTextDecoder () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextDecoder; + QT_G_FUNC( hbqt_gcRelease_QTextDecoder ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextDecoder p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextDecoder ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextDecoder * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextDecoder Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextDecoder * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextDecoder ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextDecoder Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextDecoder Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextDecoder Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextDecoder( void * pObj ) +void * hbqt_gcAllocate_QTextDecoder( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextDecoder; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextDecoder %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextDecoder ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -111,7 +128,7 @@ HB_FUNC( QT_QTEXTDECODER ) pObj = ( QTextDecoder* ) new QTextDecoder( hbqt_par_QTextCodec( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QTextDecoder( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextDecoder( pObj, true ) ); } /* * QString toUnicode ( const char * chars, int len ) diff --git a/harbour/contrib/hbqt/qtcore/QTextEncoder.cpp b/harbour/contrib/hbqt/qtcore/QTextEncoder.cpp index d75e96fe63..637993767f 100644 --- a/harbour/contrib/hbqt/qtcore/QTextEncoder.cpp +++ b/harbour/contrib/hbqt/qtcore/QTextEncoder.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -76,32 +76,49 @@ * ~QTextEncoder () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextEncoder; + QT_G_FUNC( hbqt_gcRelease_QTextEncoder ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextEncoder p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextEncoder ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextEncoder * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextEncoder Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextEncoder * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextEncoder ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextEncoder Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextEncoder Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextEncoder Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextEncoder( void * pObj ) +void * hbqt_gcAllocate_QTextEncoder( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextEncoder; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextEncoder %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextEncoder ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -111,14 +128,14 @@ HB_FUNC( QT_QTEXTENCODER ) pObj = ( QTextEncoder* ) new QTextEncoder( hbqt_par_QTextCodec( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QTextEncoder( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextEncoder( pObj, true ) ); } /* * QByteArray fromUnicode ( const QString & str ) */ HB_FUNC( QT_QTEXTENCODER_FROMUNICODE ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QTextEncoder( 1 )->fromUnicode( hbqt_par_QString( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QTextEncoder( 1 )->fromUnicode( hbqt_par_QString( 2 ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QTextStream.cpp b/harbour/contrib/hbqt/qtcore/QTextStream.cpp index 5a8e896f3a..6af5c46e21 100644 --- a/harbour/contrib/hbqt/qtcore/QTextStream.cpp +++ b/harbour/contrib/hbqt/qtcore/QTextStream.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -96,32 +96,49 @@ HB_FUNC( QT_QTEXTSTREAM_PADCHAR ) } +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextStream; + QT_G_FUNC( hbqt_gcRelease_QTextStream ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextStream p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextStream ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextStream * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextStream Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextStream * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextStream ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextStream Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextStream Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextStream Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextStream( void * pObj ) +void * hbqt_gcAllocate_QTextStream( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextStream; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextStream %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextStream ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -131,7 +148,7 @@ HB_FUNC( QT_QTEXTSTREAM ) pObj = new QTextStream( hb_parcx( 1 ), ( QIODevice::OpenMode ) ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : QIODevice::ReadWrite ) ) ; - hb_retptrGC( hbqt_gcAllocate_QTextStream( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextStream( pObj, true ) ); } /* * bool atEnd () const @@ -154,7 +171,7 @@ HB_FUNC( QT_QTEXTSTREAM_AUTODETECTUNICODE ) */ HB_FUNC( QT_QTEXTSTREAM_CODEC ) { - hb_retptr( ( QTextCodec* ) hbqt_par_QTextStream( 1 )->codec() ); + hb_retptrGC( hbqt_gcAllocate_QTextCodec( hbqt_par_QTextStream( 1 )->codec(), false ) ); } /* @@ -162,7 +179,7 @@ HB_FUNC( QT_QTEXTSTREAM_CODEC ) */ HB_FUNC( QT_QTEXTSTREAM_DEVICE ) { - hb_retptr( ( QIODevice* ) hbqt_par_QTextStream( 1 )->device() ); + hb_retptrGC( hbqt_gcAllocate_QIODevice( hbqt_par_QTextStream( 1 )->device(), false ) ); } /* @@ -210,7 +227,7 @@ HB_FUNC( QT_QTEXTSTREAM_INTEGERBASE ) */ HB_FUNC( QT_QTEXTSTREAM_LOCALE ) { - hb_retptrGC( hbqt_gcAllocate_QLocale( new QLocale( hbqt_par_QTextStream( 1 )->locale() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLocale( new QLocale( hbqt_par_QTextStream( 1 )->locale() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QThread.cpp b/harbour/contrib/hbqt/qtcore/QThread.cpp index 6116102bee..475603594b 100644 --- a/harbour/contrib/hbqt/qtcore/QThread.cpp +++ b/harbour/contrib/hbqt/qtcore/QThread.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -82,6 +82,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QThread > pq; } QGC_POINTER_QThread; @@ -90,48 +91,47 @@ QT_G_FUNC( hbqt_gcRelease_QThread ) { QGC_POINTER_QThread * p = ( QGC_POINTER_QThread * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QThread p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QThread ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QThread * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QThread * ) p->ph )->~QThread(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QThread * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QThread ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QThread ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QThread Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QThread Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QThread Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QThread Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QThread Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QThread( void * pObj ) +void * hbqt_gcAllocate_QThread( void * pObj, bool bNew ) { QGC_POINTER_QThread * p = ( QGC_POINTER_QThread * ) hb_gcAllocate( sizeof( QGC_POINTER_QThread ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QThread; - new( & p->pq ) QPointer< QThread >( ( QThread * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QThread %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QThread >( ( QThread * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QThread ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -141,7 +141,7 @@ HB_FUNC( QT_QTHREAD ) pObj = new QThread() ; - hb_retptrGC( hbqt_gcAllocate_QThread( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QThread( pObj, true ) ); } /* * void exit ( int returnCode = 0 ) @@ -212,7 +212,7 @@ HB_FUNC( QT_QTHREAD_WAIT ) */ HB_FUNC( QT_QTHREAD_CURRENTTHREAD ) { - hb_retptr( ( QThread* ) hbqt_par_QThread( 1 )->currentThread() ); + hb_retptrGC( hbqt_gcAllocate_QThread( hbqt_par_QThread( 1 )->currentThread(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QTime.cpp b/harbour/contrib/hbqt/qtcore/QTime.cpp index 003803fd5f..349539232a 100644 --- a/harbour/contrib/hbqt/qtcore/QTime.cpp +++ b/harbour/contrib/hbqt/qtcore/QTime.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -75,32 +75,49 @@ * QTime ( int h, int m, int s = 0, int ms = 0 ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTime; + QT_G_FUNC( hbqt_gcRelease_QTime ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTime p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTime ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTime * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTime Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTime * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTime ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTime Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTime Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTime Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTime( void * pObj ) +void * hbqt_gcAllocate_QTime( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTime; - HB_TRACE( HB_TR_DEBUG, ( " new_QTime %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTime ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -110,14 +127,14 @@ HB_FUNC( QT_QTIME ) pObj = new QTime() ; - hb_retptrGC( hbqt_gcAllocate_QTime( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTime( pObj, true ) ); } /* * QTime addMSecs ( int ms ) const */ HB_FUNC( QT_QTIME_ADDMSECS ) { - hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QTime( 1 )->addMSecs( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QTime( 1 )->addMSecs( hb_parni( 2 ) ) ), true ) ); } /* @@ -125,7 +142,7 @@ HB_FUNC( QT_QTIME_ADDMSECS ) */ HB_FUNC( QT_QTIME_ADDSECS ) { - hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QTime( 1 )->addSecs( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QTime( 1 )->addSecs( hb_parni( 2 ) ) ), true ) ); } /* @@ -245,7 +262,7 @@ HB_FUNC( QT_QTIME_TOSTRING_1 ) */ HB_FUNC( QT_QTIME_CURRENTTIME ) { - hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QTime( 1 )->currentTime() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QTime( 1 )->currentTime() ), true ) ); } /* @@ -253,7 +270,7 @@ HB_FUNC( QT_QTIME_CURRENTTIME ) */ HB_FUNC( QT_QTIME_FROMSTRING ) { - hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QTime( 1 )->fromString( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::DateFormat ) hb_parni( 3 ) : ( Qt::DateFormat ) Qt::TextDate ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QTime( 1 )->fromString( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::DateFormat ) hb_parni( 3 ) : ( Qt::DateFormat ) Qt::TextDate ) ) ), true ) ); } /* @@ -261,7 +278,7 @@ HB_FUNC( QT_QTIME_FROMSTRING ) */ HB_FUNC( QT_QTIME_FROMSTRING_1 ) { - hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QTime( 1 )->fromString( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QTime( 1 )->fromString( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/QTimer.cpp b/harbour/contrib/hbqt/qtcore/QTimer.cpp index 63b5d6be71..db877ebaf0 100644 --- a/harbour/contrib/hbqt/qtcore/QTimer.cpp +++ b/harbour/contrib/hbqt/qtcore/QTimer.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QTimer > pq; } QGC_POINTER_QTimer; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QTimer ) { QGC_POINTER_QTimer * p = ( QGC_POINTER_QTimer * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTimer p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTimer ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QTimer * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QTimer * ) p->ph )->~QTimer(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QTimer * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTimer ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QTimer ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTimer Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QTimer Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTimer Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTimer Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTimer Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTimer( void * pObj ) +void * hbqt_gcAllocate_QTimer( void * pObj, bool bNew ) { QGC_POINTER_QTimer * p = ( QGC_POINTER_QTimer * ) hb_gcAllocate( sizeof( QGC_POINTER_QTimer ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTimer; - new( & p->pq ) QPointer< QTimer >( ( QTimer * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QTimer %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QTimer >( ( QTimer * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QTimer ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -138,7 +138,7 @@ HB_FUNC( QT_QTIMER ) pObj = new QTimer( hbqt_par_QObject( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QTimer( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTimer( pObj, true ) ); } /* * int interval () const diff --git a/harbour/contrib/hbqt/qtcore/QTranslator.cpp b/harbour/contrib/hbqt/qtcore/QTranslator.cpp index 42cfbbe202..60a9e62ce9 100644 --- a/harbour/contrib/hbqt/qtcore/QTranslator.cpp +++ b/harbour/contrib/hbqt/qtcore/QTranslator.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -78,6 +78,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QTranslator > pq; } QGC_POINTER_QTranslator; @@ -86,48 +87,47 @@ QT_G_FUNC( hbqt_gcRelease_QTranslator ) { QGC_POINTER_QTranslator * p = ( QGC_POINTER_QTranslator * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTranslator p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTranslator ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QTranslator * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QTranslator * ) p->ph )->~QTranslator(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QTranslator * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTranslator ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QTranslator ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTranslator Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QTranslator Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTranslator Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTranslator Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTranslator Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTranslator( void * pObj ) +void * hbqt_gcAllocate_QTranslator( void * pObj, bool bNew ) { QGC_POINTER_QTranslator * p = ( QGC_POINTER_QTranslator * ) hb_gcAllocate( sizeof( QGC_POINTER_QTranslator ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTranslator; - new( & p->pq ) QPointer< QTranslator >( ( QTranslator * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QTranslator %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QTranslator >( ( QTranslator * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QTranslator ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -137,7 +137,7 @@ HB_FUNC( QT_QTRANSLATOR ) pObj = new QTranslator() ; - hb_retptrGC( hbqt_gcAllocate_QTranslator( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTranslator( pObj, true ) ); } /* * virtual bool isEmpty () const diff --git a/harbour/contrib/hbqt/qtcore/QUiLoader.cpp b/harbour/contrib/hbqt/qtcore/QUiLoader.cpp index 53c2b82955..1ee7b427f8 100644 --- a/harbour/contrib/hbqt/qtcore/QUiLoader.cpp +++ b/harbour/contrib/hbqt/qtcore/QUiLoader.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,6 +80,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QUiLoader > pq; } QGC_POINTER_QUiLoader; @@ -88,48 +89,47 @@ QT_G_FUNC( hbqt_gcRelease_QUiLoader ) { QGC_POINTER_QUiLoader * p = ( QGC_POINTER_QUiLoader * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QUiLoader p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QUiLoader ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QUiLoader * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QUiLoader * ) p->ph )->~QUiLoader(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QUiLoader * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QUiLoader ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QUiLoader ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QUiLoader Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QUiLoader Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QUiLoader Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QUiLoader Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QUiLoader Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QUiLoader( void * pObj ) +void * hbqt_gcAllocate_QUiLoader( void * pObj, bool bNew ) { QGC_POINTER_QUiLoader * p = ( QGC_POINTER_QUiLoader * ) hb_gcAllocate( sizeof( QGC_POINTER_QUiLoader ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QUiLoader; - new( & p->pq ) QPointer< QUiLoader >( ( QUiLoader * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QUiLoader %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QUiLoader >( ( QUiLoader * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QUiLoader ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -146,7 +146,7 @@ HB_FUNC( QT_QUILOADER ) pObj = new QUiLoader() ; } - hb_retptrGC( hbqt_gcAllocate_QUiLoader( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QUiLoader( pObj, true ) ); } /* * void addPluginPath ( const QString & path ) @@ -161,7 +161,7 @@ HB_FUNC( QT_QUILOADER_ADDPLUGINPATH ) */ HB_FUNC( QT_QUILOADER_AVAILABLELAYOUTS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QUiLoader( 1 )->availableLayouts() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QUiLoader( 1 )->availableLayouts() ), true ) ); } /* @@ -169,7 +169,7 @@ HB_FUNC( QT_QUILOADER_AVAILABLELAYOUTS ) */ HB_FUNC( QT_QUILOADER_AVAILABLEWIDGETS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QUiLoader( 1 )->availableWidgets() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QUiLoader( 1 )->availableWidgets() ), true ) ); } /* @@ -185,7 +185,7 @@ HB_FUNC( QT_QUILOADER_CLEARPLUGINPATHS ) */ HB_FUNC( QT_QUILOADER_CREATEACTION ) { - hb_retptr( ( QAction* ) hbqt_par_QUiLoader( 1 )->createAction( hbqt_par_QObject( 2 ), QUiLoader::tr( hb_parc( 3 ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QUiLoader( 1 )->createAction( hbqt_par_QObject( 2 ), QUiLoader::tr( hb_parc( 3 ) ) ), false ) ); } /* @@ -193,7 +193,7 @@ HB_FUNC( QT_QUILOADER_CREATEACTION ) */ HB_FUNC( QT_QUILOADER_CREATEACTIONGROUP ) { - hb_retptr( ( QActionGroup* ) hbqt_par_QUiLoader( 1 )->createActionGroup( hbqt_par_QObject( 2 ), QUiLoader::tr( hb_parc( 3 ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QActionGroup( hbqt_par_QUiLoader( 1 )->createActionGroup( hbqt_par_QObject( 2 ), QUiLoader::tr( hb_parc( 3 ) ) ), false ) ); } /* @@ -201,7 +201,7 @@ HB_FUNC( QT_QUILOADER_CREATEACTIONGROUP ) */ HB_FUNC( QT_QUILOADER_CREATELAYOUT ) { - hb_retptr( ( QLayout* ) hbqt_par_QUiLoader( 1 )->createLayout( QUiLoader::tr( hb_parc( 2 ) ), hbqt_par_QObject( 3 ), QUiLoader::tr( hb_parc( 4 ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLayout( hbqt_par_QUiLoader( 1 )->createLayout( QUiLoader::tr( hb_parc( 2 ) ), hbqt_par_QObject( 3 ), QUiLoader::tr( hb_parc( 4 ) ) ), false ) ); } /* @@ -209,7 +209,7 @@ HB_FUNC( QT_QUILOADER_CREATELAYOUT ) */ HB_FUNC( QT_QUILOADER_CREATEWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QUiLoader( 1 )->createWidget( QUiLoader::tr( hb_parc( 2 ) ), hbqt_par_QWidget( 3 ), QUiLoader::tr( hb_parc( 4 ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QUiLoader( 1 )->createWidget( QUiLoader::tr( hb_parc( 2 ) ), hbqt_par_QWidget( 3 ), QUiLoader::tr( hb_parc( 4 ) ) ), false ) ); } /* @@ -225,7 +225,7 @@ HB_FUNC( QT_QUILOADER_ISLANGUAGECHANGEENABLED ) */ HB_FUNC( QT_QUILOADER_LOAD ) { - hb_retptr( ( QWidget* ) hbqt_par_QUiLoader( 1 )->load( hbqt_par_QIODevice( 2 ), hbqt_par_QWidget( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QUiLoader( 1 )->load( hbqt_par_QIODevice( 2 ), hbqt_par_QWidget( 3 ) ), false ) ); } /* @@ -233,7 +233,7 @@ HB_FUNC( QT_QUILOADER_LOAD ) */ HB_FUNC( QT_QUILOADER_PLUGINPATHS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QUiLoader( 1 )->pluginPaths() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QUiLoader( 1 )->pluginPaths() ), true ) ); } /* @@ -257,7 +257,7 @@ HB_FUNC( QT_QUILOADER_SETWORKINGDIRECTORY ) */ HB_FUNC( QT_QUILOADER_WORKINGDIRECTORY ) { - hb_retptrGC( hbqt_gcAllocate_QDir( new QDir( hbqt_par_QUiLoader( 1 )->workingDirectory() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDir( new QDir( hbqt_par_QUiLoader( 1 )->workingDirectory() ), true ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QUrl.cpp b/harbour/contrib/hbqt/qtcore/QUrl.cpp index cbc201acce..0b664b50e7 100644 --- a/harbour/contrib/hbqt/qtcore/QUrl.cpp +++ b/harbour/contrib/hbqt/qtcore/QUrl.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -110,32 +110,49 @@ HB_FUNC( QT_QURL_SETQUERYDELIMITERS ) hbqt_par_QUrl( 1 )->setQueryDelimiters( ( char ) hb_parni( 2 ), ( char ) hb_parni( 3 ) ); } +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QUrl; + QT_G_FUNC( hbqt_gcRelease_QUrl ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QUrl p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QUrl ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QUrl * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QUrl Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QUrl * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QUrl ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QUrl Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QUrl Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QUrl Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QUrl( void * pObj ) +void * hbqt_gcAllocate_QUrl( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QUrl; - HB_TRACE( HB_TR_DEBUG, ( " new_QUrl %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QUrl ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -145,7 +162,7 @@ HB_FUNC( QT_QURL ) pObj = new QUrl( hbqt_par_QString( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QUrl( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QUrl( pObj, true ) ); } /* * void addEncodedQueryItem ( const QByteArray & key, const QByteArray & value ) @@ -168,7 +185,7 @@ HB_FUNC( QT_QURL_ADDQUERYITEM ) */ HB_FUNC( QT_QURL_ALLQUERYITEMVALUES ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QUrl( 1 )->allQueryItemValues( hbqt_par_QString( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QUrl( 1 )->allQueryItemValues( hbqt_par_QString( 2 ) ) ), true ) ); } /* @@ -192,7 +209,7 @@ HB_FUNC( QT_QURL_CLEAR ) */ HB_FUNC( QT_QURL_ENCODEDFRAGMENT ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedFragment() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedFragment() ), true ) ); } /* @@ -200,7 +217,7 @@ HB_FUNC( QT_QURL_ENCODEDFRAGMENT ) */ HB_FUNC( QT_QURL_ENCODEDHOST ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedHost() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedHost() ), true ) ); } /* @@ -208,7 +225,7 @@ HB_FUNC( QT_QURL_ENCODEDHOST ) */ HB_FUNC( QT_QURL_ENCODEDPASSWORD ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedPassword() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedPassword() ), true ) ); } /* @@ -216,7 +233,7 @@ HB_FUNC( QT_QURL_ENCODEDPASSWORD ) */ HB_FUNC( QT_QURL_ENCODEDPATH ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedPath() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedPath() ), true ) ); } /* @@ -224,7 +241,7 @@ HB_FUNC( QT_QURL_ENCODEDPATH ) */ HB_FUNC( QT_QURL_ENCODEDQUERY ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedQuery() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedQuery() ), true ) ); } /* @@ -232,7 +249,7 @@ HB_FUNC( QT_QURL_ENCODEDQUERY ) */ HB_FUNC( QT_QURL_ENCODEDQUERYITEMVALUE ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedQueryItemValue( *hbqt_par_QByteArray( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedQueryItemValue( *hbqt_par_QByteArray( 2 ) ) ), true ) ); } /* @@ -240,7 +257,7 @@ HB_FUNC( QT_QURL_ENCODEDQUERYITEMVALUE ) */ HB_FUNC( QT_QURL_ENCODEDUSERNAME ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedUserName() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->encodedUserName() ), true ) ); } /* @@ -424,7 +441,7 @@ HB_FUNC( QT_QURL_REMOVEQUERYITEM ) */ HB_FUNC( QT_QURL_RESOLVED ) { - hb_retptrGC( hbqt_gcAllocate_QUrl( new QUrl( hbqt_par_QUrl( 1 )->resolved( *hbqt_par_QUrl( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QUrl( new QUrl( hbqt_par_QUrl( 1 )->resolved( *hbqt_par_QUrl( 2 ) ) ), true ) ); } /* @@ -592,7 +609,7 @@ HB_FUNC( QT_QURL_SETUSERNAME ) */ HB_FUNC( QT_QURL_TOENCODED ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->toEncoded( ( HB_ISNUM( 2 ) ? ( QUrl::FormattingOptions ) hb_parni( 2 ) : ( QUrl::FormattingOptions ) QUrl::None ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->toEncoded( ( HB_ISNUM( 2 ) ? ( QUrl::FormattingOptions ) hb_parni( 2 ) : ( QUrl::FormattingOptions ) QUrl::None ) ) ), true ) ); } /* @@ -640,7 +657,7 @@ HB_FUNC( QT_QURL_FROMACE ) */ HB_FUNC( QT_QURL_FROMENCODED ) { - hb_retptrGC( hbqt_gcAllocate_QUrl( new QUrl( hbqt_par_QUrl( 1 )->fromEncoded( *hbqt_par_QByteArray( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QUrl( new QUrl( hbqt_par_QUrl( 1 )->fromEncoded( *hbqt_par_QByteArray( 2 ) ) ), true ) ); } /* @@ -648,7 +665,7 @@ HB_FUNC( QT_QURL_FROMENCODED ) */ HB_FUNC( QT_QURL_FROMENCODED_1 ) { - hb_retptrGC( hbqt_gcAllocate_QUrl( new QUrl( hbqt_par_QUrl( 1 )->fromEncoded( *hbqt_par_QByteArray( 2 ), ( QUrl::ParsingMode ) hb_parni( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QUrl( new QUrl( hbqt_par_QUrl( 1 )->fromEncoded( *hbqt_par_QByteArray( 2 ), ( QUrl::ParsingMode ) hb_parni( 3 ) ) ), true ) ); } /* @@ -656,7 +673,7 @@ HB_FUNC( QT_QURL_FROMENCODED_1 ) */ HB_FUNC( QT_QURL_FROMLOCALFILE ) { - hb_retptrGC( hbqt_gcAllocate_QUrl( new QUrl( hbqt_par_QUrl( 1 )->fromLocalFile( hbqt_par_QString( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QUrl( new QUrl( hbqt_par_QUrl( 1 )->fromLocalFile( hbqt_par_QString( 2 ) ) ), true ) ); } /* @@ -672,7 +689,7 @@ HB_FUNC( QT_QURL_FROMPERCENTENCODING ) */ HB_FUNC( QT_QURL_IDNWHITELIST ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QUrl( 1 )->idnWhitelist() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QUrl( 1 )->idnWhitelist() ), true ) ); } /* @@ -688,7 +705,7 @@ HB_FUNC( QT_QURL_SETIDNWHITELIST ) */ HB_FUNC( QT_QURL_TOACE ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->toAce( hbqt_par_QString( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->toAce( hbqt_par_QString( 2 ) ) ), true ) ); } /* @@ -696,7 +713,7 @@ HB_FUNC( QT_QURL_TOACE ) */ HB_FUNC( QT_QURL_TOPERCENTENCODING ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->toPercentEncoding( hbqt_par_QString( 2 ), ( HB_ISPOINTER( 3 ) ? *hbqt_par_QByteArray( 3 ) : QByteArray() ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QByteArray( 4 ) : QByteArray() ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QUrl( 1 )->toPercentEncoding( hbqt_par_QString( 2 ), ( HB_ISPOINTER( 3 ) ? *hbqt_par_QByteArray( 3 ) : QByteArray() ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QByteArray( 4 ) : QByteArray() ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtcore/QVariant.cpp b/harbour/contrib/hbqt/qtcore/QVariant.cpp index 315ce39e2a..4ff19e8bd4 100644 --- a/harbour/contrib/hbqt/qtcore/QVariant.cpp +++ b/harbour/contrib/hbqt/qtcore/QVariant.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -139,32 +139,49 @@ QVariant ( const QRegExp & regExp ) ~QVariant () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QVariant; + QT_G_FUNC( hbqt_gcRelease_QVariant ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QVariant p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QVariant ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QVariant * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QVariant Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QVariant * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QVariant ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QVariant Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QVariant Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QVariant Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QVariant( void * pObj ) +void * hbqt_gcAllocate_QVariant( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QVariant; - HB_TRACE( HB_TR_DEBUG, ( " new_QVariant %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QVariant ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -174,7 +191,7 @@ HB_FUNC( QT_QVARIANT ) pObj = ( QVariant* ) new QVariant() ; - hb_retptrGC( hbqt_gcAllocate_QVariant( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( pObj, true ) ); } /* * bool canConvert ( Type t ) const @@ -237,7 +254,7 @@ HB_FUNC( QT_QVARIANT_SETVALUE ) */ HB_FUNC( QT_QVARIANT_TOBITARRAY ) { - hb_retptrGC( hbqt_gcAllocate_QBitArray( new QBitArray( hbqt_par_QVariant( 1 )->toBitArray() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBitArray( new QBitArray( hbqt_par_QVariant( 1 )->toBitArray() ), true ) ); } /* @@ -253,7 +270,7 @@ HB_FUNC( QT_QVARIANT_TOBOOL ) */ HB_FUNC( QT_QVARIANT_TOBYTEARRAY ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QVariant( 1 )->toByteArray() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QVariant( 1 )->toByteArray() ), true ) ); } /* @@ -261,7 +278,7 @@ HB_FUNC( QT_QVARIANT_TOBYTEARRAY ) */ HB_FUNC( QT_QVARIANT_TODATE ) { - hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QVariant( 1 )->toDate() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QVariant( 1 )->toDate() ), true ) ); } /* @@ -269,7 +286,7 @@ HB_FUNC( QT_QVARIANT_TODATE ) */ HB_FUNC( QT_QVARIANT_TODATETIME ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QVariant( 1 )->toDateTime() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QVariant( 1 )->toDateTime() ), true ) ); } /* @@ -301,7 +318,7 @@ HB_FUNC( QT_QVARIANT_TOINT ) */ HB_FUNC( QT_QVARIANT_TOLINE ) { - hb_retptrGC( hbqt_gcAllocate_QLine( new QLine( hbqt_par_QVariant( 1 )->toLine() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLine( new QLine( hbqt_par_QVariant( 1 )->toLine() ), true ) ); } /* @@ -309,7 +326,7 @@ HB_FUNC( QT_QVARIANT_TOLINE ) */ HB_FUNC( QT_QVARIANT_TOLINEF ) { - hb_retptrGC( hbqt_gcAllocate_QLineF( new QLineF( hbqt_par_QVariant( 1 )->toLineF() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLineF( new QLineF( hbqt_par_QVariant( 1 )->toLineF() ), true ) ); } /* @@ -317,7 +334,7 @@ HB_FUNC( QT_QVARIANT_TOLINEF ) */ HB_FUNC( QT_QVARIANT_TOLOCALE ) { - hb_retptrGC( hbqt_gcAllocate_QLocale( new QLocale( hbqt_par_QVariant( 1 )->toLocale() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLocale( new QLocale( hbqt_par_QVariant( 1 )->toLocale() ), true ) ); } /* @@ -337,7 +354,7 @@ HB_FUNC( QT_QVARIANT_TOLONGLONG ) */ HB_FUNC( QT_QVARIANT_TOPOINT ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QVariant( 1 )->toPoint() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QVariant( 1 )->toPoint() ), true ) ); } /* @@ -345,7 +362,7 @@ HB_FUNC( QT_QVARIANT_TOPOINT ) */ HB_FUNC( QT_QVARIANT_TOPOINTF ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QVariant( 1 )->toPointF() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QVariant( 1 )->toPointF() ), true ) ); } /* @@ -353,7 +370,7 @@ HB_FUNC( QT_QVARIANT_TOPOINTF ) */ HB_FUNC( QT_QVARIANT_TORECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QVariant( 1 )->toRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QVariant( 1 )->toRect() ), true ) ); } /* @@ -361,7 +378,7 @@ HB_FUNC( QT_QVARIANT_TORECT ) */ HB_FUNC( QT_QVARIANT_TORECTF ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QVariant( 1 )->toRectF() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QVariant( 1 )->toRectF() ), true ) ); } /* @@ -369,7 +386,7 @@ HB_FUNC( QT_QVARIANT_TORECTF ) */ HB_FUNC( QT_QVARIANT_TOREGEXP ) { - hb_retptrGC( hbqt_gcAllocate_QRegExp( new QRegExp( hbqt_par_QVariant( 1 )->toRegExp() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRegExp( new QRegExp( hbqt_par_QVariant( 1 )->toRegExp() ), true ) ); } /* @@ -377,7 +394,7 @@ HB_FUNC( QT_QVARIANT_TOREGEXP ) */ HB_FUNC( QT_QVARIANT_TOSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QVariant( 1 )->toSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QVariant( 1 )->toSize() ), true ) ); } /* @@ -385,7 +402,7 @@ HB_FUNC( QT_QVARIANT_TOSIZE ) */ HB_FUNC( QT_QVARIANT_TOSIZEF ) { - hb_retptrGC( hbqt_gcAllocate_QSizeF( new QSizeF( hbqt_par_QVariant( 1 )->toSizeF() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSizeF( new QSizeF( hbqt_par_QVariant( 1 )->toSizeF() ), true ) ); } /* @@ -401,7 +418,7 @@ HB_FUNC( QT_QVARIANT_TOSTRING ) */ HB_FUNC( QT_QVARIANT_TOSTRINGLIST ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QVariant( 1 )->toStringList() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QVariant( 1 )->toStringList() ), true ) ); } /* @@ -409,7 +426,7 @@ HB_FUNC( QT_QVARIANT_TOSTRINGLIST ) */ HB_FUNC( QT_QVARIANT_TOTIME ) { - hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QVariant( 1 )->toTime() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QVariant( 1 )->toTime() ), true ) ); } /* @@ -441,7 +458,7 @@ HB_FUNC( QT_QVARIANT_TOULONGLONG ) */ HB_FUNC( QT_QVARIANT_TOURL ) { - hb_retptrGC( hbqt_gcAllocate_QUrl( new QUrl( hbqt_par_QVariant( 1 )->toUrl() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QUrl( new QUrl( hbqt_par_QVariant( 1 )->toUrl() ), true ) ); } /* @@ -465,7 +482,7 @@ HB_FUNC( QT_QVARIANT_USERTYPE ) */ HB_FUNC( QT_QVARIANT_FROMVALUE ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QVariant( 1 )->fromValue( hb_param( 2, HB_IT_ANY ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QVariant( 1 )->fromValue( hb_param( 2, HB_IT_ANY ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtcore/TQAbstractItemModel.prg b/harbour/contrib/hbqt/qtcore/TQAbstractItemModel.prg index 1ab6e4c13b..f44663dbae 100644 --- a/harbour/contrib/hbqt/qtcore/TQAbstractItemModel.prg +++ b/harbour/contrib/hbqt/qtcore/TQAbstractItemModel.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQAbstractListModel.prg b/harbour/contrib/hbqt/qtcore/TQAbstractListModel.prg index 0ba6c99e22..40c0faa342 100644 --- a/harbour/contrib/hbqt/qtcore/TQAbstractListModel.prg +++ b/harbour/contrib/hbqt/qtcore/TQAbstractListModel.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQAbstractTableModel.prg b/harbour/contrib/hbqt/qtcore/TQAbstractTableModel.prg index c1f5662e24..c33a7c65c2 100644 --- a/harbour/contrib/hbqt/qtcore/TQAbstractTableModel.prg +++ b/harbour/contrib/hbqt/qtcore/TQAbstractTableModel.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQBitArray.prg b/harbour/contrib/hbqt/qtcore/TQBitArray.prg index 5b78a4a16a..d319af5a18 100644 --- a/harbour/contrib/hbqt/qtcore/TQBitArray.prg +++ b/harbour/contrib/hbqt/qtcore/TQBitArray.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQByteArray.prg b/harbour/contrib/hbqt/qtcore/TQByteArray.prg index f82044138d..1d8d51264f 100644 --- a/harbour/contrib/hbqt/qtcore/TQByteArray.prg +++ b/harbour/contrib/hbqt/qtcore/TQByteArray.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQCoreApplication.prg b/harbour/contrib/hbqt/qtcore/TQCoreApplication.prg index 39b3c5a908..87ac9dd089 100644 --- a/harbour/contrib/hbqt/qtcore/TQCoreApplication.prg +++ b/harbour/contrib/hbqt/qtcore/TQCoreApplication.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQDataStream.prg b/harbour/contrib/hbqt/qtcore/TQDataStream.prg index c7a2bf2f0c..d539fd6d3d 100644 --- a/harbour/contrib/hbqt/qtcore/TQDataStream.prg +++ b/harbour/contrib/hbqt/qtcore/TQDataStream.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQDate.prg b/harbour/contrib/hbqt/qtcore/TQDate.prg index 85b1a95593..c2bcae6013 100644 --- a/harbour/contrib/hbqt/qtcore/TQDate.prg +++ b/harbour/contrib/hbqt/qtcore/TQDate.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQDateTime.prg b/harbour/contrib/hbqt/qtcore/TQDateTime.prg index 7145fa3da6..337831927d 100644 --- a/harbour/contrib/hbqt/qtcore/TQDateTime.prg +++ b/harbour/contrib/hbqt/qtcore/TQDateTime.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQDir.prg b/harbour/contrib/hbqt/qtcore/TQDir.prg index 1afad43c8c..20aa4751bd 100644 --- a/harbour/contrib/hbqt/qtcore/TQDir.prg +++ b/harbour/contrib/hbqt/qtcore/TQDir.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQEvent.prg b/harbour/contrib/hbqt/qtcore/TQEvent.prg index c9d9b8a78c..4d2422b891 100644 --- a/harbour/contrib/hbqt/qtcore/TQEvent.prg +++ b/harbour/contrib/hbqt/qtcore/TQEvent.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQEventLoop.prg b/harbour/contrib/hbqt/qtcore/TQEventLoop.prg index 8aa8d0a653..b9d31fb4bc 100644 --- a/harbour/contrib/hbqt/qtcore/TQEventLoop.prg +++ b/harbour/contrib/hbqt/qtcore/TQEventLoop.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQFile.prg b/harbour/contrib/hbqt/qtcore/TQFile.prg index 598800231d..48eed85b61 100644 --- a/harbour/contrib/hbqt/qtcore/TQFile.prg +++ b/harbour/contrib/hbqt/qtcore/TQFile.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQFileInfo.prg b/harbour/contrib/hbqt/qtcore/TQFileInfo.prg index a571ca1491..a10030dbcf 100644 --- a/harbour/contrib/hbqt/qtcore/TQFileInfo.prg +++ b/harbour/contrib/hbqt/qtcore/TQFileInfo.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQIODevice.prg b/harbour/contrib/hbqt/qtcore/TQIODevice.prg index d9ec43717a..f0bb333ef9 100644 --- a/harbour/contrib/hbqt/qtcore/TQIODevice.prg +++ b/harbour/contrib/hbqt/qtcore/TQIODevice.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQLatin1Char.prg b/harbour/contrib/hbqt/qtcore/TQLatin1Char.prg index d504898213..e938013e4b 100644 --- a/harbour/contrib/hbqt/qtcore/TQLatin1Char.prg +++ b/harbour/contrib/hbqt/qtcore/TQLatin1Char.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQLatin1String.prg b/harbour/contrib/hbqt/qtcore/TQLatin1String.prg index 807c14f12f..d920412b04 100644 --- a/harbour/contrib/hbqt/qtcore/TQLatin1String.prg +++ b/harbour/contrib/hbqt/qtcore/TQLatin1String.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQLine.prg b/harbour/contrib/hbqt/qtcore/TQLine.prg index a611e247ba..f0f44ad43e 100644 --- a/harbour/contrib/hbqt/qtcore/TQLine.prg +++ b/harbour/contrib/hbqt/qtcore/TQLine.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQLineF.prg b/harbour/contrib/hbqt/qtcore/TQLineF.prg index 99d913495d..31b3d9d2b2 100644 --- a/harbour/contrib/hbqt/qtcore/TQLineF.prg +++ b/harbour/contrib/hbqt/qtcore/TQLineF.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQList.prg b/harbour/contrib/hbqt/qtcore/TQList.prg index 80ff591486..34cc65fb9c 100644 --- a/harbour/contrib/hbqt/qtcore/TQList.prg +++ b/harbour/contrib/hbqt/qtcore/TQList.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQLocale.prg b/harbour/contrib/hbqt/qtcore/TQLocale.prg index bd12e257c3..55da982b9e 100644 --- a/harbour/contrib/hbqt/qtcore/TQLocale.prg +++ b/harbour/contrib/hbqt/qtcore/TQLocale.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQMimeData.prg b/harbour/contrib/hbqt/qtcore/TQMimeData.prg index e60d7f14c0..1c8ad9d2d0 100644 --- a/harbour/contrib/hbqt/qtcore/TQMimeData.prg +++ b/harbour/contrib/hbqt/qtcore/TQMimeData.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQModelIndex.prg b/harbour/contrib/hbqt/qtcore/TQModelIndex.prg index 6916ea40c3..7ceb8f2789 100644 --- a/harbour/contrib/hbqt/qtcore/TQModelIndex.prg +++ b/harbour/contrib/hbqt/qtcore/TQModelIndex.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQObject.prg b/harbour/contrib/hbqt/qtcore/TQObject.prg index c0bb4847ee..da28cda426 100644 --- a/harbour/contrib/hbqt/qtcore/TQObject.prg +++ b/harbour/contrib/hbqt/qtcore/TQObject.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQPoint.prg b/harbour/contrib/hbqt/qtcore/TQPoint.prg index 95d6678069..58a985b662 100644 --- a/harbour/contrib/hbqt/qtcore/TQPoint.prg +++ b/harbour/contrib/hbqt/qtcore/TQPoint.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQPointF.prg b/harbour/contrib/hbqt/qtcore/TQPointF.prg index 50bcf3723e..275978d4c3 100644 --- a/harbour/contrib/hbqt/qtcore/TQPointF.prg +++ b/harbour/contrib/hbqt/qtcore/TQPointF.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQProcess.prg b/harbour/contrib/hbqt/qtcore/TQProcess.prg index d6c9c32573..64ba26480c 100644 --- a/harbour/contrib/hbqt/qtcore/TQProcess.prg +++ b/harbour/contrib/hbqt/qtcore/TQProcess.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQRect.prg b/harbour/contrib/hbqt/qtcore/TQRect.prg index c18413f4ff..dbf5f530ed 100644 --- a/harbour/contrib/hbqt/qtcore/TQRect.prg +++ b/harbour/contrib/hbqt/qtcore/TQRect.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQRectF.prg b/harbour/contrib/hbqt/qtcore/TQRectF.prg index 387c5b59ec..84e53c0677 100644 --- a/harbour/contrib/hbqt/qtcore/TQRectF.prg +++ b/harbour/contrib/hbqt/qtcore/TQRectF.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQRegExp.prg b/harbour/contrib/hbqt/qtcore/TQRegExp.prg index 583d9ef357..eaa58a27f7 100644 --- a/harbour/contrib/hbqt/qtcore/TQRegExp.prg +++ b/harbour/contrib/hbqt/qtcore/TQRegExp.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQResource.prg b/harbour/contrib/hbqt/qtcore/TQResource.prg index 126709fbc4..51e546da9d 100644 --- a/harbour/contrib/hbqt/qtcore/TQResource.prg +++ b/harbour/contrib/hbqt/qtcore/TQResource.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQSettings.prg b/harbour/contrib/hbqt/qtcore/TQSettings.prg index 7c5f314793..18a4613e04 100644 --- a/harbour/contrib/hbqt/qtcore/TQSettings.prg +++ b/harbour/contrib/hbqt/qtcore/TQSettings.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQSignalMapper.prg b/harbour/contrib/hbqt/qtcore/TQSignalMapper.prg index 2d9a278370..bb60343728 100644 --- a/harbour/contrib/hbqt/qtcore/TQSignalMapper.prg +++ b/harbour/contrib/hbqt/qtcore/TQSignalMapper.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQSize.prg b/harbour/contrib/hbqt/qtcore/TQSize.prg index 56f926386e..7e26b8441c 100644 --- a/harbour/contrib/hbqt/qtcore/TQSize.prg +++ b/harbour/contrib/hbqt/qtcore/TQSize.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQSizeF.prg b/harbour/contrib/hbqt/qtcore/TQSizeF.prg index 5b51b6ad9d..70a5663351 100644 --- a/harbour/contrib/hbqt/qtcore/TQSizeF.prg +++ b/harbour/contrib/hbqt/qtcore/TQSizeF.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQStringList.prg b/harbour/contrib/hbqt/qtcore/TQStringList.prg index be43b8c92a..6c54098aa9 100644 --- a/harbour/contrib/hbqt/qtcore/TQStringList.prg +++ b/harbour/contrib/hbqt/qtcore/TQStringList.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQTextBoundaryFinder.prg b/harbour/contrib/hbqt/qtcore/TQTextBoundaryFinder.prg index eb9db7f3ff..a60d3129b6 100644 --- a/harbour/contrib/hbqt/qtcore/TQTextBoundaryFinder.prg +++ b/harbour/contrib/hbqt/qtcore/TQTextBoundaryFinder.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQTextCodec.prg b/harbour/contrib/hbqt/qtcore/TQTextCodec.prg index 26408b252b..72e3fed6e0 100644 --- a/harbour/contrib/hbqt/qtcore/TQTextCodec.prg +++ b/harbour/contrib/hbqt/qtcore/TQTextCodec.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQTextDecoder.prg b/harbour/contrib/hbqt/qtcore/TQTextDecoder.prg index e14db397d6..32dad991b4 100644 --- a/harbour/contrib/hbqt/qtcore/TQTextDecoder.prg +++ b/harbour/contrib/hbqt/qtcore/TQTextDecoder.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQTextEncoder.prg b/harbour/contrib/hbqt/qtcore/TQTextEncoder.prg index b71285777f..d0d135c7ec 100644 --- a/harbour/contrib/hbqt/qtcore/TQTextEncoder.prg +++ b/harbour/contrib/hbqt/qtcore/TQTextEncoder.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQTextStream.prg b/harbour/contrib/hbqt/qtcore/TQTextStream.prg index 1190e00aa3..1cea5a813d 100644 --- a/harbour/contrib/hbqt/qtcore/TQTextStream.prg +++ b/harbour/contrib/hbqt/qtcore/TQTextStream.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQThread.prg b/harbour/contrib/hbqt/qtcore/TQThread.prg index 68b1ebb6fb..eae9af8f5d 100644 --- a/harbour/contrib/hbqt/qtcore/TQThread.prg +++ b/harbour/contrib/hbqt/qtcore/TQThread.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQTime.prg b/harbour/contrib/hbqt/qtcore/TQTime.prg index 4c796056e7..ddcf34101a 100644 --- a/harbour/contrib/hbqt/qtcore/TQTime.prg +++ b/harbour/contrib/hbqt/qtcore/TQTime.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQTimer.prg b/harbour/contrib/hbqt/qtcore/TQTimer.prg index b9f1cf544a..d6d38b8fed 100644 --- a/harbour/contrib/hbqt/qtcore/TQTimer.prg +++ b/harbour/contrib/hbqt/qtcore/TQTimer.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQTranslator.prg b/harbour/contrib/hbqt/qtcore/TQTranslator.prg index 16f39d23ef..1f69557b2e 100644 --- a/harbour/contrib/hbqt/qtcore/TQTranslator.prg +++ b/harbour/contrib/hbqt/qtcore/TQTranslator.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQUiLoader.prg b/harbour/contrib/hbqt/qtcore/TQUiLoader.prg index a98223463f..155a326298 100644 --- a/harbour/contrib/hbqt/qtcore/TQUiLoader.prg +++ b/harbour/contrib/hbqt/qtcore/TQUiLoader.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQUrl.prg b/harbour/contrib/hbqt/qtcore/TQUrl.prg index fd7b558d59..7ac665bc9c 100644 --- a/harbour/contrib/hbqt/qtcore/TQUrl.prg +++ b/harbour/contrib/hbqt/qtcore/TQUrl.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtcore/TQVariant.prg b/harbour/contrib/hbqt/qtcore/TQVariant.prg index ba1ba8049c..4f47e2ec49 100644 --- a/harbour/contrib/hbqt/qtcore/TQVariant.prg +++ b/harbour/contrib/hbqt/qtcore/TQVariant.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/HBQTextBlockUserData.cpp b/harbour/contrib/hbqt/qtgui/HBQTextBlockUserData.cpp new file mode 100644 index 0000000000..1785a4e99b --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/HBQTextBlockUserData.cpp @@ -0,0 +1,144 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009-2010 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ + +#include "hbapi.h" +#include "../hbqt.h" + +/*----------------------------------------------------------------------*/ +#if QT_VERSION >= 0x040500 +/*----------------------------------------------------------------------*/ + +#include + +#include +#include "../hbqt_hbqsyntaxhighlighter.h" + +/* + * HBQTextBlockUserData() + * ~HBQTextBlockUserData() + */ + +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_HBQTextBlockUserData; + +QT_G_FUNC( hbqt_gcRelease_HBQTextBlockUserData ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + + if( p && p->bNew ) + { + if( p->ph ) + { + delete ( ( HBQTextBlockUserData * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_HBQTextBlockUserData ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_HBQTextBlockUserData Object already deleted!" ) ); + } + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_HBQTextBlockUserData Object not created with - new" ) ); + p->ph = NULL; + } +} + +void * hbqt_gcAllocate_HBQTextBlockUserData( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_HBQTextBlockUserData; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_HBQTextBlockUserData ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + +HB_FUNC( QT_HBQTEXTBLOCKUSERDATA ) +{ + void * pObj = NULL; + + pObj = new HBQTextBlockUserData() ; + + hb_retptrGC( hbqt_gcAllocate_HBQTextBlockUserData( pObj, true ) ); +} +/* + * void setData( int state ) + */ +HB_FUNC( QT_HBQTEXTBLOCKUSERDATA_SETDATA ) +{ + hbqt_par_HBQTextBlockUserData( 1 )->setData( hb_parni( 2 ) ); +} + + +/*----------------------------------------------------------------------*/ +#endif /* #if QT_VERSION >= 0x040500 */ +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QAbstractButton.cpp b/harbour/contrib/hbqt/qtgui/QAbstractButton.cpp index 6213d54208..2106cdacf2 100644 --- a/harbour/contrib/hbqt/qtgui/QAbstractButton.cpp +++ b/harbour/contrib/hbqt/qtgui/QAbstractButton.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -76,11 +76,35 @@ * ~QAbstractButton () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QAbstractButton > pq; +} QGC_POINTER_QAbstractButton; + QT_G_FUNC( hbqt_gcRelease_QAbstractButton ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QAbstractButton( void * pObj, bool bNew ) +{ + QGC_POINTER_QAbstractButton * p = ( QGC_POINTER_QAbstractButton * ) hb_gcAllocate( sizeof( QGC_POINTER_QAbstractButton ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QAbstractButton; + + if( bNew ) + { + new( & p->pq ) QPointer< QAbstractButton >( ( QAbstractButton * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QAbstractButton ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QABSTRACTBUTTON ) { } @@ -121,7 +145,7 @@ HB_FUNC( QT_QABSTRACTBUTTON_AUTOREPEATINTERVAL ) */ HB_FUNC( QT_QABSTRACTBUTTON_GROUP ) { - hb_retptr( ( QButtonGroup* ) hbqt_par_QAbstractButton( 1 )->group() ); + hb_retptrGC( hbqt_gcAllocate_QButtonGroup( hbqt_par_QAbstractButton( 1 )->group(), false ) ); } /* @@ -129,7 +153,7 @@ HB_FUNC( QT_QABSTRACTBUTTON_GROUP ) */ HB_FUNC( QT_QABSTRACTBUTTON_ICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QAbstractButton( 1 )->icon() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QAbstractButton( 1 )->icon() ), true ) ); } /* @@ -137,7 +161,7 @@ HB_FUNC( QT_QABSTRACTBUTTON_ICON ) */ HB_FUNC( QT_QABSTRACTBUTTON_ICONSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QAbstractButton( 1 )->iconSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QAbstractButton( 1 )->iconSize() ), true ) ); } /* @@ -241,7 +265,7 @@ HB_FUNC( QT_QABSTRACTBUTTON_SETTEXT ) */ HB_FUNC( QT_QABSTRACTBUTTON_SHORTCUT ) { - hb_retptrGC( hbqt_gcAllocate_QKeySequence( new QKeySequence( hbqt_par_QAbstractButton( 1 )->shortcut() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QKeySequence( new QKeySequence( hbqt_par_QAbstractButton( 1 )->shortcut() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QAbstractItemDelegate.cpp b/harbour/contrib/hbqt/qtgui/QAbstractItemDelegate.cpp index 662088edbb..e601581dc4 100644 --- a/harbour/contrib/hbqt/qtgui/QAbstractItemDelegate.cpp +++ b/harbour/contrib/hbqt/qtgui/QAbstractItemDelegate.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,11 +79,35 @@ * virtual ~QAbstractItemDelegate () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QAbstractItemDelegate > pq; +} QGC_POINTER_QAbstractItemDelegate; + QT_G_FUNC( hbqt_gcRelease_QAbstractItemDelegate ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QAbstractItemDelegate( void * pObj, bool bNew ) +{ + QGC_POINTER_QAbstractItemDelegate * p = ( QGC_POINTER_QAbstractItemDelegate * ) hb_gcAllocate( sizeof( QGC_POINTER_QAbstractItemDelegate ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QAbstractItemDelegate; + + if( bNew ) + { + new( & p->pq ) QPointer< QAbstractItemDelegate >( ( QAbstractItemDelegate * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QAbstractItemDelegate ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QABSTRACTITEMDELEGATE ) { } @@ -92,7 +116,7 @@ HB_FUNC( QT_QABSTRACTITEMDELEGATE ) */ HB_FUNC( QT_QABSTRACTITEMDELEGATE_CREATEEDITOR ) { - hb_retptr( ( QWidget* ) hbqt_par_QAbstractItemDelegate( 1 )->createEditor( hbqt_par_QWidget( 2 ), *hbqt_par_QStyleOptionViewItem( 3 ), *hbqt_par_QModelIndex( 4 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QAbstractItemDelegate( 1 )->createEditor( hbqt_par_QWidget( 2 ), *hbqt_par_QStyleOptionViewItem( 3 ), *hbqt_par_QModelIndex( 4 ) ), false ) ); } /* @@ -132,7 +156,7 @@ HB_FUNC( QT_QABSTRACTITEMDELEGATE_SETMODELDATA ) */ HB_FUNC( QT_QABSTRACTITEMDELEGATE_SIZEHINT ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QAbstractItemDelegate( 1 )->sizeHint( *hbqt_par_QStyleOptionViewItem( 2 ), *hbqt_par_QModelIndex( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QAbstractItemDelegate( 1 )->sizeHint( *hbqt_par_QStyleOptionViewItem( 2 ), *hbqt_par_QModelIndex( 3 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QAbstractItemView.cpp b/harbour/contrib/hbqt/qtgui/QAbstractItemView.cpp index 8b8b8d9dfd..e2290be241 100644 --- a/harbour/contrib/hbqt/qtgui/QAbstractItemView.cpp +++ b/harbour/contrib/hbqt/qtgui/QAbstractItemView.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -86,11 +86,35 @@ * ~QAbstractItemView () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QAbstractItemView > pq; +} QGC_POINTER_QAbstractItemView; + QT_G_FUNC( hbqt_gcRelease_QAbstractItemView ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QAbstractItemView( void * pObj, bool bNew ) +{ + QGC_POINTER_QAbstractItemView * p = ( QGC_POINTER_QAbstractItemView * ) hb_gcAllocate( sizeof( QGC_POINTER_QAbstractItemView ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QAbstractItemView; + + if( bNew ) + { + new( & p->pq ) QPointer< QAbstractItemView >( ( QAbstractItemView * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QAbstractItemView ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QABSTRACTITEMVIEW ) { } @@ -123,7 +147,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_CLOSEPERSISTENTEDITOR ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_CURRENTINDEX ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemView( 1 )->currentIndex() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemView( 1 )->currentIndex() ), true ) ); } /* @@ -179,7 +203,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_HORIZONTALSCROLLMODE ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_ICONSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QAbstractItemView( 1 )->iconSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QAbstractItemView( 1 )->iconSize() ), true ) ); } /* @@ -187,7 +211,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_ICONSIZE ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_INDEXAT ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemView( 1 )->indexAt( *hbqt_par_QPoint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemView( 1 )->indexAt( *hbqt_par_QPoint( 2 ) ) ), true ) ); } /* @@ -195,7 +219,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_INDEXAT ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_INDEXWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QAbstractItemView( 1 )->indexWidget( *hbqt_par_QModelIndex( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QAbstractItemView( 1 )->indexWidget( *hbqt_par_QModelIndex( 2 ) ), false ) ); } /* @@ -203,7 +227,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_INDEXWIDGET ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_ITEMDELEGATE ) { - hb_retptr( ( QAbstractItemDelegate* ) hbqt_par_QAbstractItemView( 1 )->itemDelegate() ); + hb_retptrGC( hbqt_gcAllocate_QAbstractItemDelegate( hbqt_par_QAbstractItemView( 1 )->itemDelegate(), false ) ); } /* @@ -211,7 +235,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_ITEMDELEGATE ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_ITEMDELEGATE_1 ) { - hb_retptr( ( QAbstractItemDelegate* ) hbqt_par_QAbstractItemView( 1 )->itemDelegate( *hbqt_par_QModelIndex( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAbstractItemDelegate( hbqt_par_QAbstractItemView( 1 )->itemDelegate( *hbqt_par_QModelIndex( 2 ) ), false ) ); } /* @@ -219,7 +243,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_ITEMDELEGATE_1 ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_ITEMDELEGATEFORCOLUMN ) { - hb_retptr( ( QAbstractItemDelegate* ) hbqt_par_QAbstractItemView( 1 )->itemDelegateForColumn( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAbstractItemDelegate( hbqt_par_QAbstractItemView( 1 )->itemDelegateForColumn( hb_parni( 2 ) ), false ) ); } /* @@ -227,7 +251,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_ITEMDELEGATEFORCOLUMN ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_ITEMDELEGATEFORROW ) { - hb_retptr( ( QAbstractItemDelegate* ) hbqt_par_QAbstractItemView( 1 )->itemDelegateForRow( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAbstractItemDelegate( hbqt_par_QAbstractItemView( 1 )->itemDelegateForRow( hb_parni( 2 ) ), false ) ); } /* @@ -243,7 +267,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_KEYBOARDSEARCH ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_MODEL ) { - hb_retptr( ( QAbstractItemModel* ) hbqt_par_QAbstractItemView( 1 )->model() ); + hb_retptrGC( hbqt_gcAllocate_QAbstractItemModel( hbqt_par_QAbstractItemView( 1 )->model(), false ) ); } /* @@ -259,7 +283,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_OPENPERSISTENTEDITOR ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_ROOTINDEX ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemView( 1 )->rootIndex() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractItemView( 1 )->rootIndex() ), true ) ); } /* @@ -291,7 +315,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_SELECTIONMODE ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_SELECTIONMODEL ) { - hb_retptr( ( QItemSelectionModel* ) hbqt_par_QAbstractItemView( 1 )->selectionModel() ); + hb_retptrGC( hbqt_gcAllocate_QItemSelectionModel( hbqt_par_QAbstractItemView( 1 )->selectionModel(), false ) ); } /* @@ -483,7 +507,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_SIZEHINTFORCOLUMN ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_SIZEHINTFORINDEX ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QAbstractItemView( 1 )->sizeHintForIndex( *hbqt_par_QModelIndex( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QAbstractItemView( 1 )->sizeHintForIndex( *hbqt_par_QModelIndex( 2 ) ) ), true ) ); } /* @@ -523,7 +547,7 @@ HB_FUNC( QT_QABSTRACTITEMVIEW_VERTICALSCROLLMODE ) */ HB_FUNC( QT_QABSTRACTITEMVIEW_VISUALRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QAbstractItemView( 1 )->visualRect( *hbqt_par_QModelIndex( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QAbstractItemView( 1 )->visualRect( *hbqt_par_QModelIndex( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QAbstractPrintDialog.cpp b/harbour/contrib/hbqt/qtgui/QAbstractPrintDialog.cpp index ba6347cdee..556c25e224 100644 --- a/harbour/contrib/hbqt/qtgui/QAbstractPrintDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QAbstractPrintDialog.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -90,11 +90,35 @@ * QAbstractPrintDialog ( QPrinter * printer, QWidget * parent = 0 ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QAbstractPrintDialog > pq; +} QGC_POINTER_QAbstractPrintDialog; + QT_G_FUNC( hbqt_gcRelease_QAbstractPrintDialog ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QAbstractPrintDialog( void * pObj, bool bNew ) +{ + QGC_POINTER_QAbstractPrintDialog * p = ( QGC_POINTER_QAbstractPrintDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QAbstractPrintDialog ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QAbstractPrintDialog; + + if( bNew ) + { + new( & p->pq ) QPointer< QAbstractPrintDialog >( ( QAbstractPrintDialog * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QAbstractPrintDialog ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QABSTRACTPRINTDIALOG ) { } @@ -143,7 +167,7 @@ HB_FUNC( QT_QABSTRACTPRINTDIALOG_PRINTRANGE ) */ HB_FUNC( QT_QABSTRACTPRINTDIALOG_PRINTER ) { - hb_retptr( ( QPrinter* ) hbqt_par_QAbstractPrintDialog( 1 )->printer() ); + hb_retptrGC( hbqt_gcAllocate_QPrinter( hbqt_par_QAbstractPrintDialog( 1 )->printer(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QAbstractProxyModel.cpp b/harbour/contrib/hbqt/qtgui/QAbstractProxyModel.cpp index 8f2fad2f4e..6fd91671c8 100644 --- a/harbour/contrib/hbqt/qtgui/QAbstractProxyModel.cpp +++ b/harbour/contrib/hbqt/qtgui/QAbstractProxyModel.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -75,11 +75,35 @@ * ~QAbstractProxyModel () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QAbstractProxyModel > pq; +} QGC_POINTER_QAbstractProxyModel; + QT_G_FUNC( hbqt_gcRelease_QAbstractProxyModel ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QAbstractProxyModel( void * pObj, bool bNew ) +{ + QGC_POINTER_QAbstractProxyModel * p = ( QGC_POINTER_QAbstractProxyModel * ) hb_gcAllocate( sizeof( QGC_POINTER_QAbstractProxyModel ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QAbstractProxyModel; + + if( bNew ) + { + new( & p->pq ) QPointer< QAbstractProxyModel >( ( QAbstractProxyModel * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QAbstractProxyModel ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QABSTRACTPROXYMODEL ) { } @@ -88,7 +112,7 @@ HB_FUNC( QT_QABSTRACTPROXYMODEL ) */ HB_FUNC( QT_QABSTRACTPROXYMODEL_MAPFROMSOURCE ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractProxyModel( 1 )->mapFromSource( *hbqt_par_QModelIndex( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractProxyModel( 1 )->mapFromSource( *hbqt_par_QModelIndex( 2 ) ) ), true ) ); } /* @@ -96,7 +120,7 @@ HB_FUNC( QT_QABSTRACTPROXYMODEL_MAPFROMSOURCE ) */ HB_FUNC( QT_QABSTRACTPROXYMODEL_MAPSELECTIONFROMSOURCE ) { - hb_retptrGC( hbqt_gcAllocate_QItemSelection( new QItemSelection( hbqt_par_QAbstractProxyModel( 1 )->mapSelectionFromSource( *hbqt_par_QItemSelection( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QItemSelection( new QItemSelection( hbqt_par_QAbstractProxyModel( 1 )->mapSelectionFromSource( *hbqt_par_QItemSelection( 2 ) ) ), true ) ); } /* @@ -104,7 +128,7 @@ HB_FUNC( QT_QABSTRACTPROXYMODEL_MAPSELECTIONFROMSOURCE ) */ HB_FUNC( QT_QABSTRACTPROXYMODEL_MAPSELECTIONTOSOURCE ) { - hb_retptrGC( hbqt_gcAllocate_QItemSelection( new QItemSelection( hbqt_par_QAbstractProxyModel( 1 )->mapSelectionToSource( *hbqt_par_QItemSelection( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QItemSelection( new QItemSelection( hbqt_par_QAbstractProxyModel( 1 )->mapSelectionToSource( *hbqt_par_QItemSelection( 2 ) ) ), true ) ); } /* @@ -112,7 +136,7 @@ HB_FUNC( QT_QABSTRACTPROXYMODEL_MAPSELECTIONTOSOURCE ) */ HB_FUNC( QT_QABSTRACTPROXYMODEL_MAPTOSOURCE ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractProxyModel( 1 )->mapToSource( *hbqt_par_QModelIndex( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QAbstractProxyModel( 1 )->mapToSource( *hbqt_par_QModelIndex( 2 ) ) ), true ) ); } /* @@ -128,7 +152,7 @@ HB_FUNC( QT_QABSTRACTPROXYMODEL_SETSOURCEMODEL ) */ HB_FUNC( QT_QABSTRACTPROXYMODEL_SOURCEMODEL ) { - hb_retptr( ( QAbstractItemModel* ) hbqt_par_QAbstractProxyModel( 1 )->sourceModel() ); + hb_retptrGC( hbqt_gcAllocate_QAbstractItemModel( hbqt_par_QAbstractProxyModel( 1 )->sourceModel(), false ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QAbstractScrollArea.cpp b/harbour/contrib/hbqt/qtgui/QAbstractScrollArea.cpp index 09f498b00a..b738116933 100644 --- a/harbour/contrib/hbqt/qtgui/QAbstractScrollArea.cpp +++ b/harbour/contrib/hbqt/qtgui/QAbstractScrollArea.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -76,11 +76,35 @@ * ~QAbstractScrollArea () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QAbstractScrollArea > pq; +} QGC_POINTER_QAbstractScrollArea; + QT_G_FUNC( hbqt_gcRelease_QAbstractScrollArea ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QAbstractScrollArea( void * pObj, bool bNew ) +{ + QGC_POINTER_QAbstractScrollArea * p = ( QGC_POINTER_QAbstractScrollArea * ) hb_gcAllocate( sizeof( QGC_POINTER_QAbstractScrollArea ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QAbstractScrollArea; + + if( bNew ) + { + new( & p->pq ) QPointer< QAbstractScrollArea >( ( QAbstractScrollArea * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QAbstractScrollArea ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QABSTRACTSCROLLAREA ) { } @@ -97,7 +121,7 @@ HB_FUNC( QT_QABSTRACTSCROLLAREA_ADDSCROLLBARWIDGET ) */ HB_FUNC( QT_QABSTRACTSCROLLAREA_CORNERWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QAbstractScrollArea( 1 )->cornerWidget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QAbstractScrollArea( 1 )->cornerWidget(), false ) ); } /* @@ -105,7 +129,7 @@ HB_FUNC( QT_QABSTRACTSCROLLAREA_CORNERWIDGET ) */ HB_FUNC( QT_QABSTRACTSCROLLAREA_HORIZONTALSCROLLBAR ) { - hb_retptr( ( QScrollBar* ) hbqt_par_QAbstractScrollArea( 1 )->horizontalScrollBar() ); + hb_retptrGC( hbqt_gcAllocate_QScrollBar( hbqt_par_QAbstractScrollArea( 1 )->horizontalScrollBar(), false ) ); } /* @@ -121,7 +145,7 @@ HB_FUNC( QT_QABSTRACTSCROLLAREA_HORIZONTALSCROLLBARPOLICY ) */ HB_FUNC( QT_QABSTRACTSCROLLAREA_MAXIMUMVIEWPORTSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QAbstractScrollArea( 1 )->maximumViewportSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QAbstractScrollArea( 1 )->maximumViewportSize() ), true ) ); } /* @@ -177,7 +201,7 @@ HB_FUNC( QT_QABSTRACTSCROLLAREA_SETVIEWPORT ) */ HB_FUNC( QT_QABSTRACTSCROLLAREA_VERTICALSCROLLBAR ) { - hb_retptr( ( QScrollBar* ) hbqt_par_QAbstractScrollArea( 1 )->verticalScrollBar() ); + hb_retptrGC( hbqt_gcAllocate_QScrollBar( hbqt_par_QAbstractScrollArea( 1 )->verticalScrollBar(), false ) ); } /* @@ -193,7 +217,7 @@ HB_FUNC( QT_QABSTRACTSCROLLAREA_VERTICALSCROLLBARPOLICY ) */ HB_FUNC( QT_QABSTRACTSCROLLAREA_VIEWPORT ) { - hb_retptr( ( QWidget* ) hbqt_par_QAbstractScrollArea( 1 )->viewport() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QAbstractScrollArea( 1 )->viewport(), false ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QAbstractSlider.cpp b/harbour/contrib/hbqt/qtgui/QAbstractSlider.cpp index 130a7a29ed..2353029d66 100644 --- a/harbour/contrib/hbqt/qtgui/QAbstractSlider.cpp +++ b/harbour/contrib/hbqt/qtgui/QAbstractSlider.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,11 +80,35 @@ * ~QAbstractSlider () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QAbstractSlider > pq; +} QGC_POINTER_QAbstractSlider; + QT_G_FUNC( hbqt_gcRelease_QAbstractSlider ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QAbstractSlider( void * pObj, bool bNew ) +{ + QGC_POINTER_QAbstractSlider * p = ( QGC_POINTER_QAbstractSlider * ) hb_gcAllocate( sizeof( QGC_POINTER_QAbstractSlider ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QAbstractSlider; + + if( bNew ) + { + new( & p->pq ) QPointer< QAbstractSlider >( ( QAbstractSlider * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QAbstractSlider ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QABSTRACTSLIDER ) { } diff --git a/harbour/contrib/hbqt/qtgui/QAbstractSpinBox.cpp b/harbour/contrib/hbqt/qtgui/QAbstractSpinBox.cpp index fd885c3954..f981a5d0d6 100644 --- a/harbour/contrib/hbqt/qtgui/QAbstractSpinBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QAbstractSpinBox.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -83,11 +83,35 @@ * ~QAbstractSpinBox () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QAbstractSpinBox > pq; +} QGC_POINTER_QAbstractSpinBox; + QT_G_FUNC( hbqt_gcRelease_QAbstractSpinBox ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QAbstractSpinBox( void * pObj, bool bNew ) +{ + QGC_POINTER_QAbstractSpinBox * p = ( QGC_POINTER_QAbstractSpinBox * ) hb_gcAllocate( sizeof( QGC_POINTER_QAbstractSpinBox ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QAbstractSpinBox; + + if( bNew ) + { + new( & p->pq ) QPointer< QAbstractSpinBox >( ( QAbstractSpinBox * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QAbstractSpinBox ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QABSTRACTSPINBOX ) { } diff --git a/harbour/contrib/hbqt/qtgui/QAbstractTextDocumentLayout.cpp b/harbour/contrib/hbqt/qtgui/QAbstractTextDocumentLayout.cpp index 8baad558e2..9421b8ed9a 100644 --- a/harbour/contrib/hbqt/qtgui/QAbstractTextDocumentLayout.cpp +++ b/harbour/contrib/hbqt/qtgui/QAbstractTextDocumentLayout.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -75,11 +75,35 @@ * */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QAbstractTextDocumentLayout > pq; +} QGC_POINTER_QAbstractTextDocumentLayout; + QT_G_FUNC( hbqt_gcRelease_QAbstractTextDocumentLayout ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QAbstractTextDocumentLayout( void * pObj, bool bNew ) +{ + QGC_POINTER_QAbstractTextDocumentLayout * p = ( QGC_POINTER_QAbstractTextDocumentLayout * ) hb_gcAllocate( sizeof( QGC_POINTER_QAbstractTextDocumentLayout ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QAbstractTextDocumentLayout; + + if( bNew ) + { + new( & p->pq ) QPointer< QAbstractTextDocumentLayout >( ( QAbstractTextDocumentLayout * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QAbstractTextDocumentLayoutph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT ) { } @@ -96,7 +120,7 @@ HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT_ANCHORAT ) */ HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT_BLOCKBOUNDINGRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QAbstractTextDocumentLayout( 1 )->blockBoundingRect( *hbqt_par_QTextBlock( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QAbstractTextDocumentLayout( 1 )->blockBoundingRect( *hbqt_par_QTextBlock( 2 ) ) ), true ) ); } /* @@ -104,7 +128,7 @@ HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT_BLOCKBOUNDINGRECT ) */ HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT_DOCUMENT ) { - hb_retptr( ( QTextDocument* ) hbqt_par_QAbstractTextDocumentLayout( 1 )->document() ); + hb_retptrGC( hbqt_gcAllocate_QTextDocument( hbqt_par_QAbstractTextDocumentLayout( 1 )->document(), false ) ); } /* @@ -112,7 +136,7 @@ HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT_DOCUMENT ) */ HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT_DOCUMENTSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSizeF( new QSizeF( hbqt_par_QAbstractTextDocumentLayout( 1 )->documentSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSizeF( new QSizeF( hbqt_par_QAbstractTextDocumentLayout( 1 )->documentSize() ), true ) ); } /* @@ -120,15 +144,7 @@ HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT_DOCUMENTSIZE ) */ HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT_FRAMEBOUNDINGRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QAbstractTextDocumentLayout( 1 )->frameBoundingRect( hbqt_par_QTextFrame( 2 ) ) ) ) ); -} - -/* - * QTextObjectInterface * handlerForObject ( int objectType ) const - */ -HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT_HANDLERFOROBJECT ) -{ - hb_retptr( ( QTextObjectInterface* ) hbqt_par_QAbstractTextDocumentLayout( 1 )->handlerForObject( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QAbstractTextDocumentLayout( 1 )->frameBoundingRect( hbqt_par_QTextFrame( 2 ) ) ), true ) ); } /* @@ -152,7 +168,7 @@ HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT_PAGECOUNT ) */ HB_FUNC( QT_QABSTRACTTEXTDOCUMENTLAYOUT_PAINTDEVICE ) { - hb_retptr( ( QPaintDevice* ) hbqt_par_QAbstractTextDocumentLayout( 1 )->paintDevice() ); + hb_retptrGC( hbqt_gcAllocate_QPaintDevice( hbqt_par_QAbstractTextDocumentLayout( 1 )->paintDevice(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QAction.cpp b/harbour/contrib/hbqt/qtgui/QAction.cpp index 71ce0ed9b3..4978ee6df1 100644 --- a/harbour/contrib/hbqt/qtgui/QAction.cpp +++ b/harbour/contrib/hbqt/qtgui/QAction.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -98,6 +98,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QAction > pq; } QGC_POINTER_QAction; @@ -106,48 +107,47 @@ QT_G_FUNC( hbqt_gcRelease_QAction ) { QGC_POINTER_QAction * p = ( QGC_POINTER_QAction * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QAction p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QAction ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QAction * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QAction * ) p->ph )->~QAction(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QAction * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QAction ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QAction ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QAction Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QAction Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QAction Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QAction Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QAction Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QAction( void * pObj ) +void * hbqt_gcAllocate_QAction( void * pObj, bool bNew ) { QGC_POINTER_QAction * p = ( QGC_POINTER_QAction * ) hb_gcAllocate( sizeof( QGC_POINTER_QAction ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QAction; - new( & p->pq ) QPointer< QAction >( ( QAction * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QAction %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QAction >( ( QAction * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QAction ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -162,14 +162,14 @@ HB_FUNC( QT_QACTION ) else if( HB_ISPOINTER( 3 ) ) pObj = new QAction( *hbqt_par_QIcon( 1 ), hbqt_par_QString( 2 ), hbqt_par_QObject( 3 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QAction( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( pObj, true ) ); } /* * QActionGroup * actionGroup () const */ HB_FUNC( QT_QACTION_ACTIONGROUP ) { - hb_retptr( ( QActionGroup* ) hbqt_par_QAction( 1 )->actionGroup() ); + hb_retptrGC( hbqt_gcAllocate_QActionGroup( hbqt_par_QAction( 1 )->actionGroup(), false ) ); } /* @@ -193,7 +193,7 @@ HB_FUNC( QT_QACTION_AUTOREPEAT ) */ HB_FUNC( QT_QACTION_DATA ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QAction( 1 )->data() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QAction( 1 )->data() ), true ) ); } /* @@ -201,7 +201,7 @@ HB_FUNC( QT_QACTION_DATA ) */ HB_FUNC( QT_QACTION_FONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QAction( 1 )->font() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QAction( 1 )->font() ), true ) ); } /* @@ -209,7 +209,7 @@ HB_FUNC( QT_QACTION_FONT ) */ HB_FUNC( QT_QACTION_ICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QAction( 1 )->icon() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QAction( 1 )->icon() ), true ) ); } /* @@ -273,7 +273,7 @@ HB_FUNC( QT_QACTION_ISVISIBLE ) */ HB_FUNC( QT_QACTION_MENU ) { - hb_retptr( ( QMenu* ) hbqt_par_QAction( 1 )->menu() ); + hb_retptrGC( hbqt_gcAllocate_QMenu( hbqt_par_QAction( 1 )->menu(), false ) ); } /* @@ -289,7 +289,7 @@ HB_FUNC( QT_QACTION_MENUROLE ) */ HB_FUNC( QT_QACTION_PARENTWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QAction( 1 )->parentWidget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QAction( 1 )->parentWidget(), false ) ); } /* @@ -441,7 +441,7 @@ HB_FUNC( QT_QACTION_SETWHATSTHIS ) */ HB_FUNC( QT_QACTION_SHORTCUT ) { - hb_retptrGC( hbqt_gcAllocate_QKeySequence( new QKeySequence( hbqt_par_QAction( 1 )->shortcut() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QKeySequence( new QKeySequence( hbqt_par_QAction( 1 )->shortcut() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QActionGroup.cpp b/harbour/contrib/hbqt/qtgui/QActionGroup.cpp index df00796153..e70475496d 100644 --- a/harbour/contrib/hbqt/qtgui/QActionGroup.cpp +++ b/harbour/contrib/hbqt/qtgui/QActionGroup.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -87,6 +87,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QActionGroup > pq; } QGC_POINTER_QActionGroup; @@ -95,48 +96,47 @@ QT_G_FUNC( hbqt_gcRelease_QActionGroup ) { QGC_POINTER_QActionGroup * p = ( QGC_POINTER_QActionGroup * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QActionGroup p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QActionGroup ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QActionGroup * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QActionGroup * ) p->ph )->~QActionGroup(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QActionGroup * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QActionGroup ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QActionGroup ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QActionGroup Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QActionGroup Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QActionGroup Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QActionGroup Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QActionGroup Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QActionGroup( void * pObj ) +void * hbqt_gcAllocate_QActionGroup( void * pObj, bool bNew ) { QGC_POINTER_QActionGroup * p = ( QGC_POINTER_QActionGroup * ) hb_gcAllocate( sizeof( QGC_POINTER_QActionGroup ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QActionGroup; - new( & p->pq ) QPointer< QActionGroup >( ( QActionGroup * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QActionGroup %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QActionGroup >( ( QActionGroup * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QActionGroup ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -149,14 +149,14 @@ HB_FUNC( QT_QACTIONGROUP ) pObj = new QActionGroup( hbqt_par_QObject( 1 ) ) ; } - hb_retptrGC( hbqt_gcAllocate_QActionGroup( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QActionGroup( pObj, true ) ); } /* * QAction * addAction ( QAction * action ) */ HB_FUNC( QT_QACTIONGROUP_ADDACTION ) { - hb_retptr( ( QAction* ) hbqt_par_QActionGroup( 1 )->addAction( hbqt_par_QAction( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QActionGroup( 1 )->addAction( hbqt_par_QAction( 2 ) ), false ) ); } /* @@ -164,7 +164,7 @@ HB_FUNC( QT_QACTIONGROUP_ADDACTION ) */ HB_FUNC( QT_QACTIONGROUP_ADDACTION_1 ) { - hb_retptr( ( QAction* ) hbqt_par_QActionGroup( 1 )->addAction( QActionGroup::tr( hb_parc( 2 ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QActionGroup( 1 )->addAction( QActionGroup::tr( hb_parc( 2 ) ) ), false ) ); } /* @@ -172,7 +172,7 @@ HB_FUNC( QT_QACTIONGROUP_ADDACTION_1 ) */ HB_FUNC( QT_QACTIONGROUP_ADDACTION_2 ) { - hb_retptr( ( QAction* ) hbqt_par_QActionGroup( 1 )->addAction( QIcon( hbqt_par_QString( 2 ) ), QActionGroup::tr( hb_parc( 3 ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QActionGroup( 1 )->addAction( QIcon( hbqt_par_QString( 2 ) ), QActionGroup::tr( hb_parc( 3 ) ) ), false ) ); } /* @@ -180,7 +180,7 @@ HB_FUNC( QT_QACTIONGROUP_ADDACTION_2 ) */ HB_FUNC( QT_QACTIONGROUP_CHECKEDACTION ) { - hb_retptr( ( QAction* ) hbqt_par_QActionGroup( 1 )->checkedAction() ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QActionGroup( 1 )->checkedAction(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QApplication.cpp b/harbour/contrib/hbqt/qtgui/QApplication.cpp index 20af55df93..a922305ce4 100644 --- a/harbour/contrib/hbqt/qtgui/QApplication.cpp +++ b/harbour/contrib/hbqt/qtgui/QApplication.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -111,6 +111,13 @@ HB_FUNC( HB_QT ) {;} static void hbqt_Exit( void * cargo ) { HB_SYMBOL_UNUSED( cargo ); + + HB_TRACE( HB_TR_ALWAYS, ( "hbqt_exit 0 %p", s_app ) ); + + s_app->quit(); + s_app = NULL; + + HB_TRACE( HB_TR_ALWAYS, ( "hbqt_exit 1 %p", s_app ) ); } static void hbqt_Init( void * cargo ) @@ -153,6 +160,7 @@ HB_FUNC( QT_QAPPLICATION_QUIT ) typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QApplication > pq; } QGC_POINTER_QApplication; @@ -161,48 +169,47 @@ QT_G_FUNC( hbqt_gcRelease_QApplication ) { QGC_POINTER_QApplication * p = ( QGC_POINTER_QApplication * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QApplication p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QApplication ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QApplication * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QApplication * ) p->ph )->~QApplication(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QApplication * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QApplication ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QApplication ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QApplication Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QApplication Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QApplication Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QApplication Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QApplication Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QApplication( void * pObj ) +void * hbqt_gcAllocate_QApplication( void * pObj, bool bNew ) { QGC_POINTER_QApplication * p = ( QGC_POINTER_QApplication * ) hb_gcAllocate( sizeof( QGC_POINTER_QApplication ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QApplication; - new( & p->pq ) QPointer< QApplication >( ( QApplication * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QApplication %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QApplication >( ( QApplication * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QApplication ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -212,7 +219,7 @@ HB_FUNC( QT_QAPPLICATION ) pObj = ( QApplication * ) s_app ; - hb_retptrGC( hbqt_gcAllocate_QApplication( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QApplication( pObj, true ) ); } /* * virtual void commitData ( QSessionManager & manager ) @@ -227,7 +234,7 @@ HB_FUNC( QT_QAPPLICATION_COMMITDATA ) */ HB_FUNC( QT_QAPPLICATION_INPUTCONTEXT ) { - hb_retptr( ( QInputContext* ) hbqt_par_QApplication( 1 )->inputContext() ); + hb_retptrGC( hbqt_gcAllocate_QInputContext( hbqt_par_QApplication( 1 )->inputContext(), false ) ); } /* @@ -283,7 +290,7 @@ HB_FUNC( QT_QAPPLICATION_STYLESHEET ) */ HB_FUNC( QT_QAPPLICATION_ACTIVEMODALWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QApplication( 1 )->activeModalWidget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QApplication( 1 )->activeModalWidget(), false ) ); } /* @@ -291,7 +298,7 @@ HB_FUNC( QT_QAPPLICATION_ACTIVEMODALWIDGET ) */ HB_FUNC( QT_QAPPLICATION_ACTIVEPOPUPWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QApplication( 1 )->activePopupWidget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QApplication( 1 )->activePopupWidget(), false ) ); } /* @@ -299,7 +306,7 @@ HB_FUNC( QT_QAPPLICATION_ACTIVEPOPUPWIDGET ) */ HB_FUNC( QT_QAPPLICATION_ACTIVEWINDOW ) { - hb_retptr( ( QWidget* ) hbqt_par_QApplication( 1 )->activeWindow() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QApplication( 1 )->activeWindow(), false ) ); } /* @@ -331,7 +338,7 @@ HB_FUNC( QT_QAPPLICATION_CHANGEOVERRIDECURSOR ) */ HB_FUNC( QT_QAPPLICATION_CLIPBOARD ) { - hb_retptr( ( QClipboard* ) hbqt_par_QApplication( 1 )->clipboard() ); + hb_retptrGC( hbqt_gcAllocate_QClipboard( hbqt_par_QApplication( 1 )->clipboard(), false ) ); } /* @@ -355,7 +362,7 @@ HB_FUNC( QT_QAPPLICATION_CURSORFLASHTIME ) */ HB_FUNC( QT_QAPPLICATION_DESKTOP ) { - hb_retptr( ( QDesktopWidget* ) hbqt_par_QApplication( 1 )->desktop() ); + hb_retptrGC( hbqt_gcAllocate_QDesktopWidget( hbqt_par_QApplication( 1 )->desktop(), false ) ); } /* @@ -387,7 +394,7 @@ HB_FUNC( QT_QAPPLICATION_EXEC ) */ HB_FUNC( QT_QAPPLICATION_FOCUSWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QApplication( 1 )->focusWidget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QApplication( 1 )->focusWidget(), false ) ); } /* @@ -395,7 +402,7 @@ HB_FUNC( QT_QAPPLICATION_FOCUSWIDGET ) */ HB_FUNC( QT_QAPPLICATION_FONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QApplication( 1 )->font() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QApplication( 1 )->font() ), true ) ); } /* @@ -403,7 +410,7 @@ HB_FUNC( QT_QAPPLICATION_FONT ) */ HB_FUNC( QT_QAPPLICATION_FONT_1 ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QApplication( 1 )->font( hbqt_par_QWidget( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QApplication( 1 )->font( hbqt_par_QWidget( 2 ) ) ), true ) ); } /* @@ -411,7 +418,7 @@ HB_FUNC( QT_QAPPLICATION_FONT_1 ) */ HB_FUNC( QT_QAPPLICATION_FONT_2 ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QApplication( 1 )->font( hbqt_par_char( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QApplication( 1 )->font( hbqt_par_char( 2 ) ) ), true ) ); } /* @@ -419,7 +426,7 @@ HB_FUNC( QT_QAPPLICATION_FONT_2 ) */ HB_FUNC( QT_QAPPLICATION_FONTMETRICS ) { - hb_retptrGC( hbqt_gcAllocate_QFontMetrics( new QFontMetrics( hbqt_par_QApplication( 1 )->fontMetrics() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFontMetrics( new QFontMetrics( hbqt_par_QApplication( 1 )->fontMetrics() ), true ) ); } /* @@ -427,7 +434,7 @@ HB_FUNC( QT_QAPPLICATION_FONTMETRICS ) */ HB_FUNC( QT_QAPPLICATION_GLOBALSTRUT ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QApplication( 1 )->globalStrut() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QApplication( 1 )->globalStrut() ), true ) ); } /* @@ -475,7 +482,7 @@ HB_FUNC( QT_QAPPLICATION_KEYBOARDINPUTINTERVAL ) */ HB_FUNC( QT_QAPPLICATION_KEYBOARDINPUTLOCALE ) { - hb_retptrGC( hbqt_gcAllocate_QLocale( new QLocale( hbqt_par_QApplication( 1 )->keyboardInputLocale() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLocale( new QLocale( hbqt_par_QApplication( 1 )->keyboardInputLocale() ), true ) ); } /* @@ -507,7 +514,7 @@ HB_FUNC( QT_QAPPLICATION_MOUSEBUTTONS ) */ HB_FUNC( QT_QAPPLICATION_OVERRIDECURSOR ) { - hb_retptr( ( QCursor* ) hbqt_par_QApplication( 1 )->overrideCursor() ); + hb_retptrGC( hbqt_gcAllocate_QCursor( hbqt_par_QApplication( 1 )->overrideCursor(), false ) ); } /* @@ -515,7 +522,7 @@ HB_FUNC( QT_QAPPLICATION_OVERRIDECURSOR ) */ HB_FUNC( QT_QAPPLICATION_PALETTE ) { - hb_retptrGC( hbqt_gcAllocate_QPalette( new QPalette( hbqt_par_QApplication( 1 )->palette() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPalette( new QPalette( hbqt_par_QApplication( 1 )->palette() ), true ) ); } /* @@ -523,7 +530,7 @@ HB_FUNC( QT_QAPPLICATION_PALETTE ) */ HB_FUNC( QT_QAPPLICATION_PALETTE_1 ) { - hb_retptrGC( hbqt_gcAllocate_QPalette( new QPalette( hbqt_par_QApplication( 1 )->palette( hbqt_par_QWidget( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPalette( new QPalette( hbqt_par_QApplication( 1 )->palette( hbqt_par_QWidget( 2 ) ) ), true ) ); } /* @@ -531,7 +538,7 @@ HB_FUNC( QT_QAPPLICATION_PALETTE_1 ) */ HB_FUNC( QT_QAPPLICATION_PALETTE_2 ) { - hb_retptrGC( hbqt_gcAllocate_QPalette( new QPalette( hbqt_par_QApplication( 1 )->palette( hbqt_par_char( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPalette( new QPalette( hbqt_par_QApplication( 1 )->palette( hbqt_par_char( 2 ) ) ), true ) ); } /* @@ -691,7 +698,7 @@ HB_FUNC( QT_QAPPLICATION_SETSTYLE ) */ HB_FUNC( QT_QAPPLICATION_SETSTYLE_1 ) { - hb_retptr( ( QStyle* ) hbqt_par_QApplication( 1 )->setStyle( QApplication::tr( hb_parc( 2 ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStyle( hbqt_par_QApplication( 1 )->setStyle( QApplication::tr( hb_parc( 2 ) ) ), false ) ); } /* @@ -731,7 +738,7 @@ HB_FUNC( QT_QAPPLICATION_STARTDRAGTIME ) */ HB_FUNC( QT_QAPPLICATION_STYLE ) { - hb_retptr( ( QStyle* ) hbqt_par_QApplication( 1 )->style() ); + hb_retptrGC( hbqt_gcAllocate_QStyle( hbqt_par_QApplication( 1 )->style(), false ) ); } /* @@ -747,7 +754,7 @@ HB_FUNC( QT_QAPPLICATION_SYNCX ) */ HB_FUNC( QT_QAPPLICATION_TOPLEVELAT ) { - hb_retptr( ( QWidget* ) hbqt_par_QApplication( 1 )->topLevelAt( *hbqt_par_QPoint( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QApplication( 1 )->topLevelAt( *hbqt_par_QPoint( 2 ) ), false ) ); } /* @@ -755,7 +762,7 @@ HB_FUNC( QT_QAPPLICATION_TOPLEVELAT ) */ HB_FUNC( QT_QAPPLICATION_TOPLEVELAT_1 ) { - hb_retptr( ( QWidget* ) hbqt_par_QApplication( 1 )->topLevelAt( hb_parni( 2 ), hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QApplication( 1 )->topLevelAt( hb_parni( 2 ), hb_parni( 3 ) ), false ) ); } /* @@ -779,7 +786,7 @@ HB_FUNC( QT_QAPPLICATION_WHEELSCROLLLINES ) */ HB_FUNC( QT_QAPPLICATION_WIDGETAT ) { - hb_retptr( ( QWidget* ) hbqt_par_QApplication( 1 )->widgetAt( *hbqt_par_QPoint( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QApplication( 1 )->widgetAt( *hbqt_par_QPoint( 2 ) ), false ) ); } /* @@ -787,7 +794,7 @@ HB_FUNC( QT_QAPPLICATION_WIDGETAT ) */ HB_FUNC( QT_QAPPLICATION_WIDGETAT_1 ) { - hb_retptr( ( QWidget* ) hbqt_par_QApplication( 1 )->widgetAt( hb_parni( 2 ), hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QApplication( 1 )->widgetAt( hb_parni( 2 ), hb_parni( 3 ) ), false ) ); } /* @@ -795,7 +802,7 @@ HB_FUNC( QT_QAPPLICATION_WIDGETAT_1 ) */ HB_FUNC( QT_QAPPLICATION_WINDOWICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QApplication( 1 )->windowIcon() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QApplication( 1 )->windowIcon() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QBitmap.cpp b/harbour/contrib/hbqt/qtgui/QBitmap.cpp index 15849c798c..ebf7d4cf62 100644 --- a/harbour/contrib/hbqt/qtgui/QBitmap.cpp +++ b/harbour/contrib/hbqt/qtgui/QBitmap.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,32 +80,49 @@ * ~QBitmap () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QBitmap; + QT_G_FUNC( hbqt_gcRelease_QBitmap ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QBitmap p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QBitmap ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QBitmap * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QBitmap Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QBitmap * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QBitmap ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QBitmap Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QBitmap Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QBitmap Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QBitmap( void * pObj ) +void * hbqt_gcAllocate_QBitmap( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QBitmap; - HB_TRACE( HB_TR_DEBUG, ( " new_QBitmap %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QBitmap ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -149,7 +166,7 @@ HB_FUNC( QT_QBITMAP ) pObj = ( QBitmap* ) new QBitmap() ; } - hb_retptrGC( hbqt_gcAllocate_QBitmap( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QBitmap( pObj, true ) ); } /* * void clear () @@ -164,7 +181,7 @@ HB_FUNC( QT_QBITMAP_CLEAR ) */ HB_FUNC( QT_QBITMAP_TRANSFORMED ) { - hb_retptrGC( hbqt_gcAllocate_QBitmap( new QBitmap( hbqt_par_QBitmap( 1 )->transformed( *hbqt_par_QTransform( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBitmap( new QBitmap( hbqt_par_QBitmap( 1 )->transformed( *hbqt_par_QTransform( 2 ) ) ), true ) ); } /* @@ -172,7 +189,7 @@ HB_FUNC( QT_QBITMAP_TRANSFORMED ) */ HB_FUNC( QT_QBITMAP_TRANSFORMED_1 ) { - hb_retptrGC( hbqt_gcAllocate_QBitmap( new QBitmap( hbqt_par_QBitmap( 1 )->transformed( *hbqt_par_QMatrix( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBitmap( new QBitmap( hbqt_par_QBitmap( 1 )->transformed( *hbqt_par_QMatrix( 2 ) ) ), true ) ); } /* @@ -180,7 +197,7 @@ HB_FUNC( QT_QBITMAP_TRANSFORMED_1 ) */ HB_FUNC( QT_QBITMAP_FROMIMAGE ) { - hb_retptrGC( hbqt_gcAllocate_QBitmap( new QBitmap( hbqt_par_QBitmap( 1 )->fromImage( *hbqt_par_QImage( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::ImageConversionFlags ) hb_parni( 3 ) : ( Qt::ImageConversionFlags ) Qt::AutoColor ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBitmap( new QBitmap( hbqt_par_QBitmap( 1 )->fromImage( *hbqt_par_QImage( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::ImageConversionFlags ) hb_parni( 3 ) : ( Qt::ImageConversionFlags ) Qt::AutoColor ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QBoxLayout.cpp b/harbour/contrib/hbqt/qtgui/QBoxLayout.cpp index f264f9e3b6..648bd60bc1 100644 --- a/harbour/contrib/hbqt/qtgui/QBoxLayout.cpp +++ b/harbour/contrib/hbqt/qtgui/QBoxLayout.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -83,6 +83,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QBoxLayout > pq; } QGC_POINTER_QBoxLayout; @@ -91,48 +92,47 @@ QT_G_FUNC( hbqt_gcRelease_QBoxLayout ) { QGC_POINTER_QBoxLayout * p = ( QGC_POINTER_QBoxLayout * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QBoxLayout p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QBoxLayout ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QBoxLayout * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QBoxLayout * ) p->ph )->~QBoxLayout(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QBoxLayout * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QBoxLayout ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QBoxLayout ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QBoxLayout Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QBoxLayout Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QBoxLayout Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QBoxLayout Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QBoxLayout Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QBoxLayout( void * pObj ) +void * hbqt_gcAllocate_QBoxLayout( void * pObj, bool bNew ) { QGC_POINTER_QBoxLayout * p = ( QGC_POINTER_QBoxLayout * ) hb_gcAllocate( sizeof( QGC_POINTER_QBoxLayout ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QBoxLayout; - new( & p->pq ) QPointer< QBoxLayout >( ( QBoxLayout * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QBoxLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QBoxLayout >( ( QBoxLayout * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QBoxLayout ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -142,7 +142,7 @@ HB_FUNC( QT_QBOXLAYOUT ) pObj = ( QBoxLayout* ) new QBoxLayout( ( QBoxLayout::Direction ) hb_parni( 1 ), hbqt_par_QWidget( 2 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QBoxLayout( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QBoxLayout( pObj, true ) ); } /* * void addLayout ( QLayout * layout, int stretch = 0 ) diff --git a/harbour/contrib/hbqt/qtgui/QBrush.cpp b/harbour/contrib/hbqt/qtgui/QBrush.cpp index d08bcd8d0d..fd768f9ba8 100644 --- a/harbour/contrib/hbqt/qtgui/QBrush.cpp +++ b/harbour/contrib/hbqt/qtgui/QBrush.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -85,32 +85,49 @@ * ~QBrush () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QBrush; + QT_G_FUNC( hbqt_gcRelease_QBrush ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QBrush p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QBrush ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QBrush * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QBrush Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QBrush * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QBrush ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QBrush Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QBrush Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QBrush Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QBrush( void * pObj ) +void * hbqt_gcAllocate_QBrush( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QBrush; - HB_TRACE( HB_TR_DEBUG, ( " new_QBrush %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QBrush ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -172,14 +189,14 @@ HB_FUNC( QT_QBRUSH ) pObj = ( QBrush* ) new QBrush() ; } - hb_retptrGC( hbqt_gcAllocate_QBrush( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( pObj, true ) ); } /* * const QColor & color () const */ HB_FUNC( QT_QBRUSH_COLOR ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QBrush( 1 )->color() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QBrush( 1 )->color() ), true ) ); } /* @@ -195,7 +212,7 @@ HB_FUNC( QT_QBRUSH_ISOPAQUE ) */ HB_FUNC( QT_QBRUSH_MATRIX ) { - hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QBrush( 1 )->matrix() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QBrush( 1 )->matrix() ), true ) ); } /* @@ -267,7 +284,7 @@ HB_FUNC( QT_QBRUSH_STYLE ) */ HB_FUNC( QT_QBRUSH_TEXTURE ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QBrush( 1 )->texture() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QBrush( 1 )->texture() ), true ) ); } /* @@ -275,7 +292,7 @@ HB_FUNC( QT_QBRUSH_TEXTURE ) */ HB_FUNC( QT_QBRUSH_TEXTUREIMAGE ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QBrush( 1 )->textureImage() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QBrush( 1 )->textureImage() ), true ) ); } /* @@ -283,7 +300,7 @@ HB_FUNC( QT_QBRUSH_TEXTUREIMAGE ) */ HB_FUNC( QT_QBRUSH_TRANSFORM ) { - hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QBrush( 1 )->transform() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QBrush( 1 )->transform() ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QButtonGroup.cpp b/harbour/contrib/hbqt/qtgui/QButtonGroup.cpp index e68529e99f..04e8535044 100644 --- a/harbour/contrib/hbqt/qtgui/QButtonGroup.cpp +++ b/harbour/contrib/hbqt/qtgui/QButtonGroup.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -88,6 +88,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QButtonGroup > pq; } QGC_POINTER_QButtonGroup; @@ -96,48 +97,47 @@ QT_G_FUNC( hbqt_gcRelease_QButtonGroup ) { QGC_POINTER_QButtonGroup * p = ( QGC_POINTER_QButtonGroup * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QButtonGroup p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QButtonGroup ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QButtonGroup * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QButtonGroup * ) p->ph )->~QButtonGroup(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QButtonGroup * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QButtonGroup ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QButtonGroup ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QButtonGroup Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QButtonGroup Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QButtonGroup Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QButtonGroup Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QButtonGroup Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QButtonGroup( void * pObj ) +void * hbqt_gcAllocate_QButtonGroup( void * pObj, bool bNew ) { QGC_POINTER_QButtonGroup * p = ( QGC_POINTER_QButtonGroup * ) hb_gcAllocate( sizeof( QGC_POINTER_QButtonGroup ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QButtonGroup; - new( & p->pq ) QPointer< QButtonGroup >( ( QButtonGroup * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QButtonGroup %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QButtonGroup >( ( QButtonGroup * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QButtonGroup ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -154,7 +154,7 @@ HB_FUNC( QT_QBUTTONGROUP ) pObj = ( QButtonGroup* ) new QButtonGroup() ; } - hb_retptrGC( hbqt_gcAllocate_QButtonGroup( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QButtonGroup( pObj, true ) ); } /* * void addButton ( QAbstractButton * button ) @@ -177,7 +177,7 @@ HB_FUNC( QT_QBUTTONGROUP_ADDBUTTON_1 ) */ HB_FUNC( QT_QBUTTONGROUP_BUTTON ) { - hb_retptr( ( QAbstractButton* ) hbqt_par_QButtonGroup( 1 )->button( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAbstractButton( hbqt_par_QButtonGroup( 1 )->button( hb_parni( 2 ) ), false ) ); } /* @@ -185,7 +185,7 @@ HB_FUNC( QT_QBUTTONGROUP_BUTTON ) */ HB_FUNC( QT_QBUTTONGROUP_CHECKEDBUTTON ) { - hb_retptr( ( QAbstractButton* ) hbqt_par_QButtonGroup( 1 )->checkedButton() ); + hb_retptrGC( hbqt_gcAllocate_QAbstractButton( hbqt_par_QButtonGroup( 1 )->checkedButton(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QCalendarWidget.cpp b/harbour/contrib/hbqt/qtgui/QCalendarWidget.cpp index 9b94a4454f..0c4be321cf 100644 --- a/harbour/contrib/hbqt/qtgui/QCalendarWidget.cpp +++ b/harbour/contrib/hbqt/qtgui/QCalendarWidget.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -94,6 +94,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QCalendarWidget > pq; } QGC_POINTER_QCalendarWidget; @@ -102,48 +103,47 @@ QT_G_FUNC( hbqt_gcRelease_QCalendarWidget ) { QGC_POINTER_QCalendarWidget * p = ( QGC_POINTER_QCalendarWidget * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QCalendarWidget p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QCalendarWidget ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QCalendarWidget * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QCalendarWidget * ) p->ph )->~QCalendarWidget(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QCalendarWidget * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QCalendarWidget ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QCalendarWidget ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QCalendarWidget Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QCalendarWidget Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QCalendarWidget Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QCalendarWidget Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QCalendarWidget Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QCalendarWidget( void * pObj ) +void * hbqt_gcAllocate_QCalendarWidget( void * pObj, bool bNew ) { QGC_POINTER_QCalendarWidget * p = ( QGC_POINTER_QCalendarWidget * ) hb_gcAllocate( sizeof( QGC_POINTER_QCalendarWidget ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QCalendarWidget; - new( & p->pq ) QPointer< QCalendarWidget >( ( QCalendarWidget * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QCalendarWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QCalendarWidget >( ( QCalendarWidget * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QCalendarWidget ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -153,7 +153,7 @@ HB_FUNC( QT_QCALENDARWIDGET ) pObj = ( QCalendarWidget* ) new QCalendarWidget( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QCalendarWidget( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QCalendarWidget( pObj, true ) ); } /* * int dateEditAcceptDelay () const @@ -168,7 +168,7 @@ HB_FUNC( QT_QCALENDARWIDGET_DATEEDITACCEPTDELAY ) */ HB_FUNC( QT_QCALENDARWIDGET_DATETEXTFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QCalendarWidget( 1 )->dateTextFormat( *hbqt_par_QDate( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QCalendarWidget( 1 )->dateTextFormat( *hbqt_par_QDate( 2 ) ) ), true ) ); } /* @@ -184,7 +184,7 @@ HB_FUNC( QT_QCALENDARWIDGET_FIRSTDAYOFWEEK ) */ HB_FUNC( QT_QCALENDARWIDGET_HEADERTEXTFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QCalendarWidget( 1 )->headerTextFormat() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QCalendarWidget( 1 )->headerTextFormat() ), true ) ); } /* @@ -224,7 +224,7 @@ HB_FUNC( QT_QCALENDARWIDGET_ISNAVIGATIONBARVISIBLE ) */ HB_FUNC( QT_QCALENDARWIDGET_MAXIMUMDATE ) { - hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QCalendarWidget( 1 )->maximumDate() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QCalendarWidget( 1 )->maximumDate() ), true ) ); } /* @@ -232,7 +232,7 @@ HB_FUNC( QT_QCALENDARWIDGET_MAXIMUMDATE ) */ HB_FUNC( QT_QCALENDARWIDGET_MINIMUMDATE ) { - hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QCalendarWidget( 1 )->minimumDate() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QCalendarWidget( 1 )->minimumDate() ), true ) ); } /* @@ -248,7 +248,7 @@ HB_FUNC( QT_QCALENDARWIDGET_MONTHSHOWN ) */ HB_FUNC( QT_QCALENDARWIDGET_SELECTEDDATE ) { - hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QCalendarWidget( 1 )->selectedDate() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QCalendarWidget( 1 )->selectedDate() ), true ) ); } /* @@ -360,7 +360,7 @@ HB_FUNC( QT_QCALENDARWIDGET_VERTICALHEADERFORMAT ) */ HB_FUNC( QT_QCALENDARWIDGET_WEEKDAYTEXTFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QCalendarWidget( 1 )->weekdayTextFormat( ( Qt::DayOfWeek ) hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QCalendarWidget( 1 )->weekdayTextFormat( ( Qt::DayOfWeek ) hb_parni( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QCheckBox.cpp b/harbour/contrib/hbqt/qtgui/QCheckBox.cpp index 2007c7d703..2ec6904a32 100644 --- a/harbour/contrib/hbqt/qtgui/QCheckBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QCheckBox.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QCheckBox > pq; } QGC_POINTER_QCheckBox; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QCheckBox ) { QGC_POINTER_QCheckBox * p = ( QGC_POINTER_QCheckBox * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QCheckBox p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QCheckBox ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QCheckBox * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QCheckBox * ) p->ph )->~QCheckBox(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QCheckBox * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QCheckBox ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QCheckBox ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QCheckBox Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QCheckBox Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QCheckBox Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QCheckBox Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QCheckBox Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QCheckBox( void * pObj ) +void * hbqt_gcAllocate_QCheckBox( void * pObj, bool bNew ) { QGC_POINTER_QCheckBox * p = ( QGC_POINTER_QCheckBox * ) hb_gcAllocate( sizeof( QGC_POINTER_QCheckBox ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QCheckBox; - new( & p->pq ) QPointer< QCheckBox >( ( QCheckBox * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QCheckBox %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QCheckBox >( ( QCheckBox * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QCheckBox ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -145,7 +145,7 @@ HB_FUNC( QT_QCHECKBOX ) pObj = ( QCheckBox* ) new QCheckBox( hbqt_par_QWidget( 1 ) ) ; } - hb_retptrGC( hbqt_gcAllocate_QCheckBox( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QCheckBox( pObj, true ) ); } /* * Qt::CheckState checkState () const diff --git a/harbour/contrib/hbqt/qtgui/QClipboard.cpp b/harbour/contrib/hbqt/qtgui/QClipboard.cpp index bef815e3e6..6c2ec5daee 100644 --- a/harbour/contrib/hbqt/qtgui/QClipboard.cpp +++ b/harbour/contrib/hbqt/qtgui/QClipboard.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -75,17 +75,42 @@ #include #include #include +#include /* * * */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QClipboard > pq; +} QGC_POINTER_QClipboard; + QT_G_FUNC( hbqt_gcRelease_QClipboard ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QClipboard( void * pObj, bool bNew ) +{ + QGC_POINTER_QClipboard * p = ( QGC_POINTER_QClipboard * ) hb_gcAllocate( sizeof( QGC_POINTER_QClipboard ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QClipboard; + + if( bNew ) + { + new( & p->pq ) QPointer< QClipboard >( ( QClipboard * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QClipboard ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QCLIPBOARD ) { void * pObj = NULL; @@ -107,15 +132,7 @@ HB_FUNC( QT_QCLIPBOARD_CLEAR ) */ HB_FUNC( QT_QCLIPBOARD_IMAGE ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QClipboard( 1 )->image( ( HB_ISNUM( 2 ) ? ( QClipboard::Mode ) hb_parni( 2 ) : ( QClipboard::Mode ) QClipboard::Clipboard ) ) ) ) ); -} - -/* - * const QMimeData * mimeData ( Mode mode = Clipboard ) const - */ -HB_FUNC( QT_QCLIPBOARD_MIMEDATA ) -{ - hb_retptr( ( QMimeData* ) hbqt_par_QClipboard( 1 )->mimeData( ( HB_ISNUM( 2 ) ? ( QClipboard::Mode ) hb_parni( 2 ) : ( QClipboard::Mode ) QClipboard::Clipboard ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QClipboard( 1 )->image( ( HB_ISNUM( 2 ) ? ( QClipboard::Mode ) hb_parni( 2 ) : ( QClipboard::Mode ) QClipboard::Clipboard ) ) ), true ) ); } /* @@ -147,7 +164,7 @@ HB_FUNC( QT_QCLIPBOARD_OWNSSELECTION ) */ HB_FUNC( QT_QCLIPBOARD_PIXMAP ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QClipboard( 1 )->pixmap( ( HB_ISNUM( 2 ) ? ( QClipboard::Mode ) hb_parni( 2 ) : ( QClipboard::Mode ) QClipboard::Clipboard ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QClipboard( 1 )->pixmap( ( HB_ISNUM( 2 ) ? ( QClipboard::Mode ) hb_parni( 2 ) : ( QClipboard::Mode ) QClipboard::Clipboard ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QColor.cpp b/harbour/contrib/hbqt/qtgui/QColor.cpp index d08ccf0507..c0fe1e30c3 100644 --- a/harbour/contrib/hbqt/qtgui/QColor.cpp +++ b/harbour/contrib/hbqt/qtgui/QColor.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -85,32 +85,49 @@ QColor ( const QColor & color ) ~QColor () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QColor; + QT_G_FUNC( hbqt_gcRelease_QColor ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QColor p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QColor ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QColor * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QColor Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QColor * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QColor ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QColor Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QColor Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QColor Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QColor( void * pObj ) +void * hbqt_gcAllocate_QColor( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QColor; - HB_TRACE( HB_TR_DEBUG, ( " new_QColor %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QColor ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -154,7 +171,7 @@ HB_FUNC( QT_QCOLOR ) pObj = ( QColor* ) new QColor() ; } - hb_retptrGC( hbqt_gcAllocate_QColor( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( pObj, true ) ); } /* * int alpha () const @@ -209,7 +226,7 @@ HB_FUNC( QT_QCOLOR_BLUEF ) */ HB_FUNC( QT_QCOLOR_CONVERTTO ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->convertTo( ( QColor::Spec ) hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->convertTo( ( QColor::Spec ) hb_parni( 2 ) ) ), true ) ); } /* @@ -233,7 +250,7 @@ HB_FUNC( QT_QCOLOR_CYANF ) */ HB_FUNC( QT_QCOLOR_DARKER ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->darker( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : 200 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->darker( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : 200 ) ) ), true ) ); } /* @@ -393,7 +410,7 @@ HB_FUNC( QT_QCOLOR_ISVALID ) */ HB_FUNC( QT_QCOLOR_LIGHTER ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->lighter( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : 150 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->lighter( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : 150 ) ) ), true ) ); } /* @@ -617,7 +634,7 @@ HB_FUNC( QT_QCOLOR_SPEC ) */ HB_FUNC( QT_QCOLOR_TOCMYK ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->toCmyk() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->toCmyk() ), true ) ); } /* @@ -625,7 +642,7 @@ HB_FUNC( QT_QCOLOR_TOCMYK ) */ HB_FUNC( QT_QCOLOR_TOHSV ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->toHsv() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->toHsv() ), true ) ); } /* @@ -633,7 +650,7 @@ HB_FUNC( QT_QCOLOR_TOHSV ) */ HB_FUNC( QT_QCOLOR_TORGB ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->toRgb() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->toRgb() ), true ) ); } /* @@ -673,7 +690,7 @@ HB_FUNC( QT_QCOLOR_YELLOWF ) */ HB_FUNC( QT_QCOLOR_COLORNAMES ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QColor( 1 )->colorNames() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QColor( 1 )->colorNames() ), true ) ); } /* @@ -681,7 +698,7 @@ HB_FUNC( QT_QCOLOR_COLORNAMES ) */ HB_FUNC( QT_QCOLOR_FROMCMYK ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromCmyk( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), ( HB_ISNUM( 6 ) ? hb_parni( 6 ) : 255 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromCmyk( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), ( HB_ISNUM( 6 ) ? hb_parni( 6 ) : 255 ) ) ), true ) ); } /* @@ -689,7 +706,7 @@ HB_FUNC( QT_QCOLOR_FROMCMYK ) */ HB_FUNC( QT_QCOLOR_FROMCMYKF ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromCmykF( hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ), hb_parnd( 6 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromCmykF( hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ), hb_parnd( 6 ) ) ), true ) ); } /* @@ -697,7 +714,7 @@ HB_FUNC( QT_QCOLOR_FROMCMYKF ) */ HB_FUNC( QT_QCOLOR_FROMHSV ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromHsv( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), ( HB_ISNUM( 5 ) ? hb_parni( 5 ) : 255 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromHsv( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), ( HB_ISNUM( 5 ) ? hb_parni( 5 ) : 255 ) ) ), true ) ); } /* @@ -705,7 +722,7 @@ HB_FUNC( QT_QCOLOR_FROMHSV ) */ HB_FUNC( QT_QCOLOR_FROMHSVF ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromHsvF( hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromHsvF( hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ) ) ), true ) ); } /* @@ -713,7 +730,7 @@ HB_FUNC( QT_QCOLOR_FROMHSVF ) */ HB_FUNC( QT_QCOLOR_FROMRGB ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromRgb( hb_parnl( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromRgb( hb_parnl( 2 ) ) ), true ) ); } /* @@ -721,7 +738,7 @@ HB_FUNC( QT_QCOLOR_FROMRGB ) */ HB_FUNC( QT_QCOLOR_FROMRGB_1 ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromRgb( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), ( HB_ISNUM( 5 ) ? hb_parni( 5 ) : 255 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromRgb( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), ( HB_ISNUM( 5 ) ? hb_parni( 5 ) : 255 ) ) ), true ) ); } /* @@ -729,7 +746,7 @@ HB_FUNC( QT_QCOLOR_FROMRGB_1 ) */ HB_FUNC( QT_QCOLOR_FROMRGBF ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromRgbF( hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromRgbF( hb_parnd( 2 ), hb_parnd( 3 ), hb_parnd( 4 ), hb_parnd( 5 ) ) ), true ) ); } /* @@ -737,7 +754,7 @@ HB_FUNC( QT_QCOLOR_FROMRGBF ) */ HB_FUNC( QT_QCOLOR_FROMRGBA ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromRgba( hb_parnl( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColor( 1 )->fromRgba( hb_parnl( 2 ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QColorDialog.cpp b/harbour/contrib/hbqt/qtgui/QColorDialog.cpp index 91366be86e..80e5548bca 100644 --- a/harbour/contrib/hbqt/qtgui/QColorDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QColorDialog.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -84,6 +84,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QColorDialog > pq; } QGC_POINTER_QColorDialog; @@ -92,48 +93,47 @@ QT_G_FUNC( hbqt_gcRelease_QColorDialog ) { QGC_POINTER_QColorDialog * p = ( QGC_POINTER_QColorDialog * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QColorDialog p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QColorDialog ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QColorDialog * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QColorDialog * ) p->ph )->~QColorDialog(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QColorDialog * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QColorDialog ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QColorDialog ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QColorDialog Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QColorDialog Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QColorDialog Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QColorDialog Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QColorDialog Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QColorDialog( void * pObj ) +void * hbqt_gcAllocate_QColorDialog( void * pObj, bool bNew ) { QGC_POINTER_QColorDialog * p = ( QGC_POINTER_QColorDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QColorDialog ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QColorDialog; - new( & p->pq ) QPointer< QColorDialog >( ( QColorDialog * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QColorDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QColorDialog >( ( QColorDialog * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QColorDialog ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -150,14 +150,14 @@ HB_FUNC( QT_QCOLORDIALOG ) pObj = ( QColorDialog* ) new QColorDialog( hbqt_par_QWidget( 1 ) ) ; } - hb_retptrGC( hbqt_gcAllocate_QColorDialog( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QColorDialog( pObj, true ) ); } /* * QColor currentColor () const */ HB_FUNC( QT_QCOLORDIALOG_CURRENTCOLOR ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColorDialog( 1 )->currentColor() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColorDialog( 1 )->currentColor() ), true ) ); } /* @@ -181,7 +181,7 @@ HB_FUNC( QT_QCOLORDIALOG_OPTIONS ) */ HB_FUNC( QT_QCOLORDIALOG_SELECTEDCOLOR ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColorDialog( 1 )->selectedColor() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColorDialog( 1 )->selectedColor() ), true ) ); } /* @@ -245,7 +245,7 @@ HB_FUNC( QT_QCOLORDIALOG_CUSTOMCOUNT ) */ HB_FUNC( QT_QCOLORDIALOG_GETCOLOR ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColorDialog( 1 )->getColor( *hbqt_par_QColor( 2 ), hbqt_par_QWidget( 3 ), QColorDialog::tr( hb_parc( 4 ) ), ( QColorDialog::ColorDialogOptions ) hb_parni( 5 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColorDialog( 1 )->getColor( *hbqt_par_QColor( 2 ), hbqt_par_QWidget( 3 ), QColorDialog::tr( hb_parc( 4 ) ), ( QColorDialog::ColorDialogOptions ) hb_parni( 5 ) ) ), true ) ); } /* @@ -253,7 +253,7 @@ HB_FUNC( QT_QCOLORDIALOG_GETCOLOR ) */ HB_FUNC( QT_QCOLORDIALOG_GETCOLOR_1 ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColorDialog( 1 )->getColor( *hbqt_par_QColor( 2 ), hbqt_par_QWidget( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QColorDialog( 1 )->getColor( *hbqt_par_QColor( 2 ), hbqt_par_QWidget( 3 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QComboBox.cpp b/harbour/contrib/hbqt/qtgui/QComboBox.cpp index 89112615f0..823d147b69 100644 --- a/harbour/contrib/hbqt/qtgui/QComboBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QComboBox.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -84,6 +84,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QComboBox > pq; } QGC_POINTER_QComboBox; @@ -92,48 +93,47 @@ QT_G_FUNC( hbqt_gcRelease_QComboBox ) { QGC_POINTER_QComboBox * p = ( QGC_POINTER_QComboBox * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QComboBox p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QComboBox ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QComboBox * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QComboBox * ) p->ph )->~QComboBox(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QComboBox * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QComboBox ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QComboBox ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QComboBox Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QComboBox Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QComboBox Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QComboBox Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QComboBox Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QComboBox( void * pObj ) +void * hbqt_gcAllocate_QComboBox( void * pObj, bool bNew ) { QGC_POINTER_QComboBox * p = ( QGC_POINTER_QComboBox * ) hb_gcAllocate( sizeof( QGC_POINTER_QComboBox ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QComboBox; - new( & p->pq ) QPointer< QComboBox >( ( QComboBox * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QComboBox %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QComboBox >( ( QComboBox * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QComboBox ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -143,7 +143,7 @@ HB_FUNC( QT_QCOMBOBOX ) pObj = ( QComboBox* ) new QComboBox( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QComboBox( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QComboBox( pObj, true ) ); } /* * void addItem ( const QString & text, const QVariant & userData = QVariant() ) @@ -174,7 +174,7 @@ HB_FUNC( QT_QCOMBOBOX_ADDITEMS ) */ HB_FUNC( QT_QCOMBOBOX_COMPLETER ) { - hb_retptr( ( QCompleter* ) hbqt_par_QComboBox( 1 )->completer() ); + hb_retptrGC( hbqt_gcAllocate_QCompleter( hbqt_par_QComboBox( 1 )->completer(), false ) ); } /* @@ -246,7 +246,7 @@ HB_FUNC( QT_QCOMBOBOX_HIDEPOPUP ) */ HB_FUNC( QT_QCOMBOBOX_ICONSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QComboBox( 1 )->iconSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QComboBox( 1 )->iconSize() ), true ) ); } /* @@ -302,7 +302,7 @@ HB_FUNC( QT_QCOMBOBOX_ISEDITABLE ) */ HB_FUNC( QT_QCOMBOBOX_ITEMDATA ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QComboBox( 1 )->itemData( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : Qt::UserRole ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QComboBox( 1 )->itemData( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : Qt::UserRole ) ) ), true ) ); } /* @@ -310,7 +310,7 @@ HB_FUNC( QT_QCOMBOBOX_ITEMDATA ) */ HB_FUNC( QT_QCOMBOBOX_ITEMDELEGATE ) { - hb_retptr( ( QAbstractItemDelegate* ) hbqt_par_QComboBox( 1 )->itemDelegate() ); + hb_retptrGC( hbqt_gcAllocate_QAbstractItemDelegate( hbqt_par_QComboBox( 1 )->itemDelegate(), false ) ); } /* @@ -318,7 +318,7 @@ HB_FUNC( QT_QCOMBOBOX_ITEMDELEGATE ) */ HB_FUNC( QT_QCOMBOBOX_ITEMICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QComboBox( 1 )->itemIcon( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QComboBox( 1 )->itemIcon( hb_parni( 2 ) ) ), true ) ); } /* @@ -334,7 +334,7 @@ HB_FUNC( QT_QCOMBOBOX_ITEMTEXT ) */ HB_FUNC( QT_QCOMBOBOX_LINEEDIT ) { - hb_retptr( ( QLineEdit* ) hbqt_par_QComboBox( 1 )->lineEdit() ); + hb_retptrGC( hbqt_gcAllocate_QLineEdit( hbqt_par_QComboBox( 1 )->lineEdit(), false ) ); } /* @@ -366,7 +366,7 @@ HB_FUNC( QT_QCOMBOBOX_MINIMUMCONTENTSLENGTH ) */ HB_FUNC( QT_QCOMBOBOX_MODEL ) { - hb_retptr( ( QAbstractItemModel* ) hbqt_par_QComboBox( 1 )->model() ); + hb_retptrGC( hbqt_gcAllocate_QAbstractItemModel( hbqt_par_QComboBox( 1 )->model(), false ) ); } /* @@ -390,7 +390,7 @@ HB_FUNC( QT_QCOMBOBOX_REMOVEITEM ) */ HB_FUNC( QT_QCOMBOBOX_ROOTMODELINDEX ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QComboBox( 1 )->rootModelIndex() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QComboBox( 1 )->rootModelIndex() ), true ) ); } /* @@ -570,7 +570,7 @@ HB_FUNC( QT_QCOMBOBOX_SIZEADJUSTPOLICY ) } /* - * const QValidator * validator () const + * virtual const QValidator * validator () const */ HB_FUNC( QT_QCOMBOBOX_VALIDATOR ) { @@ -582,7 +582,7 @@ HB_FUNC( QT_QCOMBOBOX_VALIDATOR ) */ HB_FUNC( QT_QCOMBOBOX_VIEW ) { - hb_retptr( ( QAbstractItemView* ) hbqt_par_QComboBox( 1 )->view() ); + hb_retptrGC( hbqt_gcAllocate_QAbstractItemView( hbqt_par_QComboBox( 1 )->view(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QCommandLinkButton.cpp b/harbour/contrib/hbqt/qtgui/QCommandLinkButton.cpp index cb0d388764..5d7bae216e 100644 --- a/harbour/contrib/hbqt/qtgui/QCommandLinkButton.cpp +++ b/harbour/contrib/hbqt/qtgui/QCommandLinkButton.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,6 +80,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QCommandLinkButton > pq; } QGC_POINTER_QCommandLinkButton; @@ -88,48 +89,47 @@ QT_G_FUNC( hbqt_gcRelease_QCommandLinkButton ) { QGC_POINTER_QCommandLinkButton * p = ( QGC_POINTER_QCommandLinkButton * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QCommandLinkButton p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QCommandLinkButton ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QCommandLinkButton * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QCommandLinkButton * ) p->ph )->~QCommandLinkButton(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QCommandLinkButton * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QCommandLinkButton ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QCommandLinkButton ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QCommandLinkButton Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QCommandLinkButton Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QCommandLinkButton Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QCommandLinkButton Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QCommandLinkButton Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QCommandLinkButton( void * pObj ) +void * hbqt_gcAllocate_QCommandLinkButton( void * pObj, bool bNew ) { QGC_POINTER_QCommandLinkButton * p = ( QGC_POINTER_QCommandLinkButton * ) hb_gcAllocate( sizeof( QGC_POINTER_QCommandLinkButton ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QCommandLinkButton; - new( & p->pq ) QPointer< QCommandLinkButton >( ( QCommandLinkButton * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QCommandLinkButton %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QCommandLinkButton >( ( QCommandLinkButton * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QCommandLinkButton ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -139,7 +139,7 @@ HB_FUNC( QT_QCOMMANDLINKBUTTON ) pObj = ( QCommandLinkButton* ) new QCommandLinkButton( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QCommandLinkButton( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QCommandLinkButton( pObj, true ) ); } /* * QString description () const diff --git a/harbour/contrib/hbqt/qtgui/QCommonStyle.cpp b/harbour/contrib/hbqt/qtgui/QCommonStyle.cpp index 6aabada47c..f8cb7be80e 100644 --- a/harbour/contrib/hbqt/qtgui/QCommonStyle.cpp +++ b/harbour/contrib/hbqt/qtgui/QCommonStyle.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -78,6 +78,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QCommonStyle > pq; } QGC_POINTER_QCommonStyle; @@ -86,48 +87,47 @@ QT_G_FUNC( hbqt_gcRelease_QCommonStyle ) { QGC_POINTER_QCommonStyle * p = ( QGC_POINTER_QCommonStyle * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QCommonStyle p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QCommonStyle ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QCommonStyle * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QCommonStyle * ) p->ph )->~QCommonStyle(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QCommonStyle * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QCommonStyle ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QCommonStyle ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QCommonStyle Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QCommonStyle Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QCommonStyle Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QCommonStyle Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QCommonStyle Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QCommonStyle( void * pObj ) +void * hbqt_gcAllocate_QCommonStyle( void * pObj, bool bNew ) { QGC_POINTER_QCommonStyle * p = ( QGC_POINTER_QCommonStyle * ) hb_gcAllocate( sizeof( QGC_POINTER_QCommonStyle ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QCommonStyle; - new( & p->pq ) QPointer< QCommonStyle >( ( QCommonStyle * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QCommonStyle %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QCommonStyle >( ( QCommonStyle * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QCommonStyle ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -137,7 +137,7 @@ HB_FUNC( QT_QCOMMONSTYLE ) pObj = ( QCommonStyle* ) new QCommonStyle() ; - hb_retptrGC( hbqt_gcAllocate_QCommonStyle( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QCommonStyle( pObj, true ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QCompleter.cpp b/harbour/contrib/hbqt/qtgui/QCompleter.cpp index 412712312f..ba2db21737 100644 --- a/harbour/contrib/hbqt/qtgui/QCompleter.cpp +++ b/harbour/contrib/hbqt/qtgui/QCompleter.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -85,6 +85,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QCompleter > pq; } QGC_POINTER_QCompleter; @@ -93,48 +94,47 @@ QT_G_FUNC( hbqt_gcRelease_QCompleter ) { QGC_POINTER_QCompleter * p = ( QGC_POINTER_QCompleter * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QCompleter p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QCompleter ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QCompleter * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QCompleter * ) p->ph )->~QCompleter(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QCompleter * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QCompleter ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QCompleter ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QCompleter Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QCompleter Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QCompleter Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QCompleter Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QCompleter Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QCompleter( void * pObj ) +void * hbqt_gcAllocate_QCompleter( void * pObj, bool bNew ) { QGC_POINTER_QCompleter * p = ( QGC_POINTER_QCompleter * ) hb_gcAllocate( sizeof( QGC_POINTER_QCompleter ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QCompleter; - new( & p->pq ) QPointer< QCompleter >( ( QCompleter * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QCompleter %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QCompleter >( ( QCompleter * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QCompleter ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -144,7 +144,7 @@ HB_FUNC( QT_QCOMPLETER ) pObj = new QCompleter() ; - hb_retptrGC( hbqt_gcAllocate_QCompleter( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QCompleter( pObj, true ) ); } /* * Qt::CaseSensitivity caseSensitivity () const @@ -183,7 +183,7 @@ HB_FUNC( QT_QCOMPLETER_COMPLETIONMODE ) */ HB_FUNC( QT_QCOMPLETER_COMPLETIONMODEL ) { - hb_retptr( ( QAbstractItemModel* ) hbqt_par_QCompleter( 1 )->completionModel() ); + hb_retptrGC( hbqt_gcAllocate_QAbstractItemModel( hbqt_par_QCompleter( 1 )->completionModel(), false ) ); } /* @@ -215,7 +215,7 @@ HB_FUNC( QT_QCOMPLETER_CURRENTCOMPLETION ) */ HB_FUNC( QT_QCOMPLETER_CURRENTINDEX ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QCompleter( 1 )->currentIndex() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QCompleter( 1 )->currentIndex() ), true ) ); } /* @@ -231,7 +231,7 @@ HB_FUNC( QT_QCOMPLETER_CURRENTROW ) */ HB_FUNC( QT_QCOMPLETER_MODEL ) { - hb_retptr( ( QAbstractItemModel* ) hbqt_par_QCompleter( 1 )->model() ); + hb_retptrGC( hbqt_gcAllocate_QAbstractItemModel( hbqt_par_QCompleter( 1 )->model(), false ) ); } /* @@ -255,7 +255,7 @@ HB_FUNC( QT_QCOMPLETER_PATHFROMINDEX ) */ HB_FUNC( QT_QCOMPLETER_POPUP ) { - hb_retptr( ( QAbstractItemView* ) hbqt_par_QCompleter( 1 )->popup() ); + hb_retptrGC( hbqt_gcAllocate_QAbstractItemView( hbqt_par_QCompleter( 1 )->popup(), false ) ); } /* @@ -335,7 +335,7 @@ HB_FUNC( QT_QCOMPLETER_SETWIDGET ) */ HB_FUNC( QT_QCOMPLETER_SPLITPATH ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QCompleter( 1 )->splitPath( QCompleter::tr( hb_parc( 2 ) ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QCompleter( 1 )->splitPath( QCompleter::tr( hb_parc( 2 ) ) ) ), true ) ); } /* @@ -343,7 +343,7 @@ HB_FUNC( QT_QCOMPLETER_SPLITPATH ) */ HB_FUNC( QT_QCOMPLETER_WIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QCompleter( 1 )->widget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QCompleter( 1 )->widget(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QConicalGradient.cpp b/harbour/contrib/hbqt/qtgui/QConicalGradient.cpp index 0fdd8b9be5..3f1aa6cd33 100644 --- a/harbour/contrib/hbqt/qtgui/QConicalGradient.cpp +++ b/harbour/contrib/hbqt/qtgui/QConicalGradient.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -83,32 +83,49 @@ * QConicalGradient ( qreal cx, qreal cy, qreal angle ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QConicalGradient; + QT_G_FUNC( hbqt_gcRelease_QConicalGradient ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QConicalGradient p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QConicalGradient ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QConicalGradient * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QConicalGradient Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QConicalGradient * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QConicalGradient ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QConicalGradient Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QConicalGradient Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QConicalGradient Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QConicalGradient( void * pObj ) +void * hbqt_gcAllocate_QConicalGradient( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QConicalGradient; - HB_TRACE( HB_TR_DEBUG, ( " new_QConicalGradient %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QConicalGradient ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -118,7 +135,7 @@ HB_FUNC( QT_QCONICALGRADIENT ) pObj = ( QConicalGradient* ) new QConicalGradient() ; - hb_retptrGC( hbqt_gcAllocate_QConicalGradient( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QConicalGradient( pObj, true ) ); } /* * qreal angle () const @@ -133,7 +150,7 @@ HB_FUNC( QT_QCONICALGRADIENT_ANGLE ) */ HB_FUNC( QT_QCONICALGRADIENT_CENTER ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QConicalGradient( 1 )->center() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QConicalGradient( 1 )->center() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QContextMenuEvent.cpp b/harbour/contrib/hbqt/qtgui/QContextMenuEvent.cpp index 57c6a5e73e..6bbe158cc6 100644 --- a/harbour/contrib/hbqt/qtgui/QContextMenuEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QContextMenuEvent.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,32 +80,49 @@ * QContextMenuEvent ( Reason reason, const QPoint & pos ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QContextMenuEvent; + QT_G_FUNC( hbqt_gcRelease_QContextMenuEvent ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QContextMenuEvent p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QContextMenuEvent ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QContextMenuEvent * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QContextMenuEvent Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QContextMenuEvent * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QContextMenuEvent ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QContextMenuEvent Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QContextMenuEvent Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QContextMenuEvent Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QContextMenuEvent( void * pObj ) +void * hbqt_gcAllocate_QContextMenuEvent( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QContextMenuEvent; - HB_TRACE( HB_TR_DEBUG, ( " new_QContextMenuEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QContextMenuEvent ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -115,14 +132,14 @@ HB_FUNC( QT_QCONTEXTMENUEVENT ) pObj = new QContextMenuEvent( ( QContextMenuEvent::Reason ) hb_parni( 1 ), *hbqt_par_QPoint( 2 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QContextMenuEvent( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QContextMenuEvent( pObj, true ) ); } /* * const QPoint & globalPos () const */ HB_FUNC( QT_QCONTEXTMENUEVENT_GLOBALPOS ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QContextMenuEvent( 1 )->globalPos() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QContextMenuEvent( 1 )->globalPos() ), true ) ); } /* @@ -146,7 +163,7 @@ HB_FUNC( QT_QCONTEXTMENUEVENT_GLOBALY ) */ HB_FUNC( QT_QCONTEXTMENUEVENT_POS ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QContextMenuEvent( 1 )->pos() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QContextMenuEvent( 1 )->pos() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QCursor.cpp b/harbour/contrib/hbqt/qtgui/QCursor.cpp index 816e89c30f..94f82df1af 100644 --- a/harbour/contrib/hbqt/qtgui/QCursor.cpp +++ b/harbour/contrib/hbqt/qtgui/QCursor.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -70,6 +70,7 @@ #include #include +#include /* * QCursor () @@ -82,32 +83,49 @@ * ~QCursor () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QCursor; + QT_G_FUNC( hbqt_gcRelease_QCursor ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QCursor p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QCursor ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QCursor * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QCursor Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QCursor * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QCursor ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QCursor Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QCursor Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QCursor Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QCursor( void * pObj ) +void * hbqt_gcAllocate_QCursor( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QCursor; - HB_TRACE( HB_TR_DEBUG, ( " new_QCursor %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QCursor ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -145,14 +163,14 @@ HB_FUNC( QT_QCURSOR ) pObj = ( QCursor* ) new QCursor() ; } - hb_retptrGC( hbqt_gcAllocate_QCursor( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QCursor( pObj, true ) ); } /* * const QBitmap * bitmap () const */ HB_FUNC( QT_QCURSOR_BITMAP ) { - hb_retptr( ( QBitmap* ) hbqt_par_QCursor( 1 )->bitmap() ); + hb_retptrGC( hbqt_gcAllocate_QBitmap( new QBitmap( *( hbqt_par_QCursor( 1 )->bitmap() ) ), true ) ); } /* @@ -160,7 +178,7 @@ HB_FUNC( QT_QCURSOR_BITMAP ) */ HB_FUNC( QT_QCURSOR_HOTSPOT ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QCursor( 1 )->hotSpot() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QCursor( 1 )->hotSpot() ), true ) ); } /* @@ -168,7 +186,7 @@ HB_FUNC( QT_QCURSOR_HOTSPOT ) */ HB_FUNC( QT_QCURSOR_MASK ) { - hb_retptr( ( QBitmap* ) hbqt_par_QCursor( 1 )->mask() ); + hb_retptrGC( hbqt_gcAllocate_QBitmap( new QBitmap( *( hbqt_par_QCursor( 1 )->mask() ) ), true ) ); } /* @@ -176,7 +194,7 @@ HB_FUNC( QT_QCURSOR_MASK ) */ HB_FUNC( QT_QCURSOR_PIXMAP ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QCursor( 1 )->pixmap() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QCursor( 1 )->pixmap() ), true ) ); } /* @@ -200,7 +218,7 @@ HB_FUNC( QT_QCURSOR_SHAPE ) */ HB_FUNC( QT_QCURSOR_POS ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QCursor( 1 )->pos() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QCursor( 1 )->pos() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QDateEdit.cpp b/harbour/contrib/hbqt/qtgui/QDateEdit.cpp index 0e8c815324..9a5df6d92f 100644 --- a/harbour/contrib/hbqt/qtgui/QDateEdit.cpp +++ b/harbour/contrib/hbqt/qtgui/QDateEdit.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QDateEdit > pq; } QGC_POINTER_QDateEdit; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QDateEdit ) { QGC_POINTER_QDateEdit * p = ( QGC_POINTER_QDateEdit * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDateEdit p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDateEdit ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QDateEdit * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QDateEdit * ) p->ph )->~QDateEdit(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QDateEdit * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QDateEdit ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QDateEdit ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDateEdit Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QDateEdit Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QDateEdit Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QDateEdit Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QDateEdit Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QDateEdit( void * pObj ) +void * hbqt_gcAllocate_QDateEdit( void * pObj, bool bNew ) { QGC_POINTER_QDateEdit * p = ( QGC_POINTER_QDateEdit * ) hb_gcAllocate( sizeof( QGC_POINTER_QDateEdit ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QDateEdit; - new( & p->pq ) QPointer< QDateEdit >( ( QDateEdit * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QDateEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QDateEdit >( ( QDateEdit * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QDateEdit ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -138,7 +138,7 @@ HB_FUNC( QT_QDATEEDIT ) pObj = ( QDateEdit* ) new QDateEdit( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QDateEdit( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QDateEdit( pObj, true ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QDateTimeEdit.cpp b/harbour/contrib/hbqt/qtgui/QDateTimeEdit.cpp index ef9440419d..772b3d4702 100644 --- a/harbour/contrib/hbqt/qtgui/QDateTimeEdit.cpp +++ b/harbour/contrib/hbqt/qtgui/QDateTimeEdit.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -86,6 +86,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QDateTimeEdit > pq; } QGC_POINTER_QDateTimeEdit; @@ -94,48 +95,47 @@ QT_G_FUNC( hbqt_gcRelease_QDateTimeEdit ) { QGC_POINTER_QDateTimeEdit * p = ( QGC_POINTER_QDateTimeEdit * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDateTimeEdit p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDateTimeEdit ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QDateTimeEdit * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QDateTimeEdit * ) p->ph )->~QDateTimeEdit(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QDateTimeEdit * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QDateTimeEdit ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QDateTimeEdit ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDateTimeEdit Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QDateTimeEdit Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QDateTimeEdit Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QDateTimeEdit Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QDateTimeEdit Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QDateTimeEdit( void * pObj ) +void * hbqt_gcAllocate_QDateTimeEdit( void * pObj, bool bNew ) { QGC_POINTER_QDateTimeEdit * p = ( QGC_POINTER_QDateTimeEdit * ) hb_gcAllocate( sizeof( QGC_POINTER_QDateTimeEdit ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QDateTimeEdit; - new( & p->pq ) QPointer< QDateTimeEdit >( ( QDateTimeEdit * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QDateTimeEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QDateTimeEdit >( ( QDateTimeEdit * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QDateTimeEdit ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -145,7 +145,7 @@ HB_FUNC( QT_QDATETIMEEDIT ) pObj = ( QDateTimeEdit* ) new QDateTimeEdit( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QDateTimeEdit( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTimeEdit( pObj, true ) ); } /* * bool calendarPopup () const @@ -160,7 +160,7 @@ HB_FUNC( QT_QDATETIMEEDIT_CALENDARPOPUP ) */ HB_FUNC( QT_QDATETIMEEDIT_CALENDARWIDGET ) { - hb_retptr( ( QCalendarWidget* ) hbqt_par_QDateTimeEdit( 1 )->calendarWidget() ); + hb_retptrGC( hbqt_gcAllocate_QCalendarWidget( hbqt_par_QDateTimeEdit( 1 )->calendarWidget(), false ) ); } /* @@ -232,7 +232,7 @@ HB_FUNC( QT_QDATETIMEEDIT_CURRENTSECTIONINDEX ) */ HB_FUNC( QT_QDATETIMEEDIT_DATE ) { - hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QDateTimeEdit( 1 )->date() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QDateTimeEdit( 1 )->date() ), true ) ); } /* @@ -240,7 +240,7 @@ HB_FUNC( QT_QDATETIMEEDIT_DATE ) */ HB_FUNC( QT_QDATETIMEEDIT_DATETIME ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTimeEdit( 1 )->dateTime() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTimeEdit( 1 )->dateTime() ), true ) ); } /* @@ -264,7 +264,7 @@ HB_FUNC( QT_QDATETIMEEDIT_DISPLAYEDSECTIONS ) */ HB_FUNC( QT_QDATETIMEEDIT_MAXIMUMDATE ) { - hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QDateTimeEdit( 1 )->maximumDate() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QDateTimeEdit( 1 )->maximumDate() ), true ) ); } /* @@ -272,7 +272,7 @@ HB_FUNC( QT_QDATETIMEEDIT_MAXIMUMDATE ) */ HB_FUNC( QT_QDATETIMEEDIT_MAXIMUMDATETIME ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTimeEdit( 1 )->maximumDateTime() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTimeEdit( 1 )->maximumDateTime() ), true ) ); } /* @@ -280,7 +280,7 @@ HB_FUNC( QT_QDATETIMEEDIT_MAXIMUMDATETIME ) */ HB_FUNC( QT_QDATETIMEEDIT_MAXIMUMTIME ) { - hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QDateTimeEdit( 1 )->maximumTime() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QDateTimeEdit( 1 )->maximumTime() ), true ) ); } /* @@ -288,7 +288,7 @@ HB_FUNC( QT_QDATETIMEEDIT_MAXIMUMTIME ) */ HB_FUNC( QT_QDATETIMEEDIT_MINIMUMDATE ) { - hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QDateTimeEdit( 1 )->minimumDate() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDate( new QDate( hbqt_par_QDateTimeEdit( 1 )->minimumDate() ), true ) ); } /* @@ -296,7 +296,7 @@ HB_FUNC( QT_QDATETIMEEDIT_MINIMUMDATE ) */ HB_FUNC( QT_QDATETIMEEDIT_MINIMUMDATETIME ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTimeEdit( 1 )->minimumDateTime() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QDateTimeEdit( 1 )->minimumDateTime() ), true ) ); } /* @@ -304,7 +304,7 @@ HB_FUNC( QT_QDATETIMEEDIT_MINIMUMDATETIME ) */ HB_FUNC( QT_QDATETIMEEDIT_MINIMUMTIME ) { - hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QDateTimeEdit( 1 )->minimumTime() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QDateTimeEdit( 1 )->minimumTime() ), true ) ); } /* @@ -464,7 +464,7 @@ HB_FUNC( QT_QDATETIMEEDIT_SETTIMESPEC ) */ HB_FUNC( QT_QDATETIMEEDIT_TIME ) { - hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QDateTimeEdit( 1 )->time() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTime( new QTime( hbqt_par_QDateTimeEdit( 1 )->time() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QDesktopWidget.cpp b/harbour/contrib/hbqt/qtgui/QDesktopWidget.cpp index 8d8ff9d69a..fa5d821f6f 100644 --- a/harbour/contrib/hbqt/qtgui/QDesktopWidget.cpp +++ b/harbour/contrib/hbqt/qtgui/QDesktopWidget.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QDesktopWidget > pq; } QGC_POINTER_QDesktopWidget; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QDesktopWidget ) { QGC_POINTER_QDesktopWidget * p = ( QGC_POINTER_QDesktopWidget * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDesktopWidget p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDesktopWidget ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QDesktopWidget * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QDesktopWidget * ) p->ph )->~QDesktopWidget(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QDesktopWidget * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QDesktopWidget ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QDesktopWidget ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDesktopWidget Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QDesktopWidget Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QDesktopWidget Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QDesktopWidget Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QDesktopWidget Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QDesktopWidget( void * pObj ) +void * hbqt_gcAllocate_QDesktopWidget( void * pObj, bool bNew ) { QGC_POINTER_QDesktopWidget * p = ( QGC_POINTER_QDesktopWidget * ) hb_gcAllocate( sizeof( QGC_POINTER_QDesktopWidget ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QDesktopWidget; - new( & p->pq ) QPointer< QDesktopWidget >( ( QDesktopWidget * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QDesktopWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QDesktopWidget >( ( QDesktopWidget * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QDesktopWidget ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -138,14 +138,14 @@ HB_FUNC( QT_QDESKTOPWIDGET ) pObj = new QDesktopWidget() ; - hb_retptrGC( hbqt_gcAllocate_QDesktopWidget( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QDesktopWidget( pObj, true ) ); } /* * const QRect availableGeometry ( int screen = -1 ) const */ HB_FUNC( QT_QDESKTOPWIDGET_AVAILABLEGEOMETRY ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QDesktopWidget( 1 )->availableGeometry( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : -1 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QDesktopWidget( 1 )->availableGeometry( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : -1 ) ) ), true ) ); } /* @@ -153,7 +153,7 @@ HB_FUNC( QT_QDESKTOPWIDGET_AVAILABLEGEOMETRY ) */ HB_FUNC( QT_QDESKTOPWIDGET_AVAILABLEGEOMETRY_1 ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QDesktopWidget( 1 )->availableGeometry( hbqt_par_QWidget( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QDesktopWidget( 1 )->availableGeometry( hbqt_par_QWidget( 2 ) ) ), true ) ); } /* @@ -161,7 +161,7 @@ HB_FUNC( QT_QDESKTOPWIDGET_AVAILABLEGEOMETRY_1 ) */ HB_FUNC( QT_QDESKTOPWIDGET_AVAILABLEGEOMETRY_2 ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QDesktopWidget( 1 )->availableGeometry( *hbqt_par_QPoint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QDesktopWidget( 1 )->availableGeometry( *hbqt_par_QPoint( 2 ) ) ), true ) ); } /* @@ -193,7 +193,7 @@ HB_FUNC( QT_QDESKTOPWIDGET_PRIMARYSCREEN ) */ HB_FUNC( QT_QDESKTOPWIDGET_SCREEN ) { - hb_retptr( ( QWidget* ) hbqt_par_QDesktopWidget( 1 )->screen( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : -1 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QDesktopWidget( 1 )->screen( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : -1 ) ), false ) ); } /* @@ -201,7 +201,7 @@ HB_FUNC( QT_QDESKTOPWIDGET_SCREEN ) */ HB_FUNC( QT_QDESKTOPWIDGET_SCREENGEOMETRY ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QDesktopWidget( 1 )->screenGeometry( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : -1 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QDesktopWidget( 1 )->screenGeometry( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : -1 ) ) ), true ) ); } /* @@ -209,7 +209,7 @@ HB_FUNC( QT_QDESKTOPWIDGET_SCREENGEOMETRY ) */ HB_FUNC( QT_QDESKTOPWIDGET_SCREENGEOMETRY_1 ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QDesktopWidget( 1 )->screenGeometry( hbqt_par_QWidget( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QDesktopWidget( 1 )->screenGeometry( hbqt_par_QWidget( 2 ) ) ), true ) ); } /* @@ -217,7 +217,7 @@ HB_FUNC( QT_QDESKTOPWIDGET_SCREENGEOMETRY_1 ) */ HB_FUNC( QT_QDESKTOPWIDGET_SCREENGEOMETRY_2 ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QDesktopWidget( 1 )->screenGeometry( *hbqt_par_QPoint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QDesktopWidget( 1 )->screenGeometry( *hbqt_par_QPoint( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QDial.cpp b/harbour/contrib/hbqt/qtgui/QDial.cpp index b63bee185d..9683394847 100644 --- a/harbour/contrib/hbqt/qtgui/QDial.cpp +++ b/harbour/contrib/hbqt/qtgui/QDial.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QDial > pq; } QGC_POINTER_QDial; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QDial ) { QGC_POINTER_QDial * p = ( QGC_POINTER_QDial * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDial p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDial ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QDial * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QDial * ) p->ph )->~QDial(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QDial * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QDial ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QDial ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDial Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QDial Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QDial Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QDial Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QDial Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QDial( void * pObj ) +void * hbqt_gcAllocate_QDial( void * pObj, bool bNew ) { QGC_POINTER_QDial * p = ( QGC_POINTER_QDial * ) hb_gcAllocate( sizeof( QGC_POINTER_QDial ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QDial; - new( & p->pq ) QPointer< QDial >( ( QDial * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QDial %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QDial >( ( QDial * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QDial ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -138,7 +138,7 @@ HB_FUNC( QT_QDIAL ) pObj = ( QDial* ) new QDial( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QDial( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QDial( pObj, true ) ); } /* * int notchSize () const diff --git a/harbour/contrib/hbqt/qtgui/QDialog.cpp b/harbour/contrib/hbqt/qtgui/QDialog.cpp index 1222753935..2ee43dff61 100644 --- a/harbour/contrib/hbqt/qtgui/QDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QDialog.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -83,6 +83,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QDialog > pq; } QGC_POINTER_QDialog; @@ -91,48 +92,47 @@ QT_G_FUNC( hbqt_gcRelease_QDialog ) { QGC_POINTER_QDialog * p = ( QGC_POINTER_QDialog * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDialog p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDialog ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QDialog * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QDialog * ) p->ph )->~QDialog(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QDialog * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QDialog ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QDialog ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDialog Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QDialog Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QDialog Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QDialog Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QDialog Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QDialog( void * pObj ) +void * hbqt_gcAllocate_QDialog( void * pObj, bool bNew ) { QGC_POINTER_QDialog * p = ( QGC_POINTER_QDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QDialog ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QDialog; - new( & p->pq ) QPointer< QDialog >( ( QDialog * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QDialog >( ( QDialog * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QDialog ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -142,7 +142,7 @@ HB_FUNC( QT_QDIALOG ) pObj = new QDialog( hbqt_par_QWidget( 1 ), ( Qt::WindowFlags ) hb_parni( 2 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QDialog( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QDialog( pObj, true ) ); } /* * bool isSizeGripEnabled () const diff --git a/harbour/contrib/hbqt/qtgui/QDirModel.cpp b/harbour/contrib/hbqt/qtgui/QDirModel.cpp index 74eccd8d8d..7d3d032562 100644 --- a/harbour/contrib/hbqt/qtgui/QDirModel.cpp +++ b/harbour/contrib/hbqt/qtgui/QDirModel.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -84,6 +84,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QDirModel > pq; } QGC_POINTER_QDirModel; @@ -92,48 +93,47 @@ QT_G_FUNC( hbqt_gcRelease_QDirModel ) { QGC_POINTER_QDirModel * p = ( QGC_POINTER_QDirModel * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDirModel p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDirModel ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QDirModel * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QDirModel * ) p->ph )->~QDirModel(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QDirModel * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QDirModel ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QDirModel ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDirModel Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QDirModel Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QDirModel Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QDirModel Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QDirModel Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QDirModel( void * pObj ) +void * hbqt_gcAllocate_QDirModel( void * pObj, bool bNew ) { QGC_POINTER_QDirModel * p = ( QGC_POINTER_QDirModel * ) hb_gcAllocate( sizeof( QGC_POINTER_QDirModel ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QDirModel; - new( & p->pq ) QPointer< QDirModel >( ( QDirModel * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QDirModel %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QDirModel >( ( QDirModel * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QDirModel ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -143,7 +143,7 @@ HB_FUNC( QT_QDIRMODEL ) pObj = ( QDirModel* ) new QDirModel( hbqt_par_QObject( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QDirModel( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QDirModel( pObj, true ) ); } /* * virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const @@ -158,7 +158,7 @@ HB_FUNC( QT_QDIRMODEL_COLUMNCOUNT ) */ HB_FUNC( QT_QDIRMODEL_DATA ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QDirModel( 1 )->data( *hbqt_par_QModelIndex( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : Qt::DisplayRole ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QDirModel( 1 )->data( *hbqt_par_QModelIndex( 2 ), ( HB_ISNUM( 3 ) ? hb_parni( 3 ) : Qt::DisplayRole ) ) ), true ) ); } /* @@ -174,7 +174,7 @@ HB_FUNC( QT_QDIRMODEL_DROPMIMEDATA ) */ HB_FUNC( QT_QDIRMODEL_FILEICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QDirModel( 1 )->fileIcon( *hbqt_par_QModelIndex( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QDirModel( 1 )->fileIcon( *hbqt_par_QModelIndex( 2 ) ) ), true ) ); } /* @@ -182,7 +182,7 @@ HB_FUNC( QT_QDIRMODEL_FILEICON ) */ HB_FUNC( QT_QDIRMODEL_FILEINFO ) { - hb_retptrGC( hbqt_gcAllocate_QFileInfo( new QFileInfo( hbqt_par_QDirModel( 1 )->fileInfo( *hbqt_par_QModelIndex( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFileInfo( new QFileInfo( hbqt_par_QDirModel( 1 )->fileInfo( *hbqt_par_QModelIndex( 2 ) ) ), true ) ); } /* @@ -230,7 +230,7 @@ HB_FUNC( QT_QDIRMODEL_HASCHILDREN ) */ HB_FUNC( QT_QDIRMODEL_HEADERDATA ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QDirModel( 1 )->headerData( hb_parni( 2 ), ( Qt::Orientation ) hb_parni( 3 ), ( HB_ISNUM( 4 ) ? hb_parni( 4 ) : Qt::DisplayRole ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QDirModel( 1 )->headerData( hb_parni( 2 ), ( Qt::Orientation ) hb_parni( 3 ), ( HB_ISNUM( 4 ) ? hb_parni( 4 ) : Qt::DisplayRole ) ) ), true ) ); } /* @@ -238,7 +238,7 @@ HB_FUNC( QT_QDIRMODEL_HEADERDATA ) */ HB_FUNC( QT_QDIRMODEL_ICONPROVIDER ) { - hb_retptr( ( QFileIconProvider* ) hbqt_par_QDirModel( 1 )->iconProvider() ); + hb_retptrGC( hbqt_gcAllocate_QFileIconProvider( hbqt_par_QDirModel( 1 )->iconProvider(), false ) ); } /* @@ -246,7 +246,7 @@ HB_FUNC( QT_QDIRMODEL_ICONPROVIDER ) */ HB_FUNC( QT_QDIRMODEL_INDEX ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QDirModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QModelIndex( 4 ) : QModelIndex() ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QDirModel( 1 )->index( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QModelIndex( 4 ) : QModelIndex() ) ) ), true ) ); } /* @@ -254,7 +254,7 @@ HB_FUNC( QT_QDIRMODEL_INDEX ) */ HB_FUNC( QT_QDIRMODEL_INDEX_1 ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QDirModel( 1 )->index( QDirModel::tr( hb_parc( 2 ) ), hb_parni( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QDirModel( 1 )->index( QDirModel::tr( hb_parc( 2 ) ), hb_parni( 3 ) ) ), true ) ); } /* @@ -286,7 +286,7 @@ HB_FUNC( QT_QDIRMODEL_LAZYCHILDCOUNT ) */ HB_FUNC( QT_QDIRMODEL_MIMETYPES ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QDirModel( 1 )->mimeTypes() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QDirModel( 1 )->mimeTypes() ), true ) ); } /* @@ -294,7 +294,7 @@ HB_FUNC( QT_QDIRMODEL_MIMETYPES ) */ HB_FUNC( QT_QDIRMODEL_MKDIR ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QDirModel( 1 )->mkdir( *hbqt_par_QModelIndex( 2 ), QDirModel::tr( hb_parc( 3 ) ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QDirModel( 1 )->mkdir( *hbqt_par_QModelIndex( 2 ), QDirModel::tr( hb_parc( 3 ) ) ) ), true ) ); } /* @@ -302,7 +302,7 @@ HB_FUNC( QT_QDIRMODEL_MKDIR ) */ HB_FUNC( QT_QDIRMODEL_NAMEFILTERS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QDirModel( 1 )->nameFilters() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QDirModel( 1 )->nameFilters() ), true ) ); } /* @@ -310,7 +310,7 @@ HB_FUNC( QT_QDIRMODEL_NAMEFILTERS ) */ HB_FUNC( QT_QDIRMODEL_PARENT ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QDirModel( 1 )->parent( *hbqt_par_QModelIndex( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QDirModel( 1 )->parent( *hbqt_par_QModelIndex( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QDockWidget.cpp b/harbour/contrib/hbqt/qtgui/QDockWidget.cpp index b5f91231f6..bae4e02dd3 100644 --- a/harbour/contrib/hbqt/qtgui/QDockWidget.cpp +++ b/harbour/contrib/hbqt/qtgui/QDockWidget.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -85,6 +85,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QDockWidget > pq; } QGC_POINTER_QDockWidget; @@ -93,48 +94,47 @@ QT_G_FUNC( hbqt_gcRelease_QDockWidget ) { QGC_POINTER_QDockWidget * p = ( QGC_POINTER_QDockWidget * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDockWidget p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDockWidget ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QDockWidget * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QDockWidget * ) p->ph )->~QDockWidget(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QDockWidget * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QDockWidget ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QDockWidget ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDockWidget Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QDockWidget Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QDockWidget Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QDockWidget Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QDockWidget Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QDockWidget( void * pObj ) +void * hbqt_gcAllocate_QDockWidget( void * pObj, bool bNew ) { QGC_POINTER_QDockWidget * p = ( QGC_POINTER_QDockWidget * ) hb_gcAllocate( sizeof( QGC_POINTER_QDockWidget ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QDockWidget; - new( & p->pq ) QPointer< QDockWidget >( ( QDockWidget * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QDockWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QDockWidget >( ( QDockWidget * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QDockWidget ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -144,7 +144,7 @@ HB_FUNC( QT_QDOCKWIDGET ) pObj = new QDockWidget( hbqt_par_QWidget( 1 ), ( Qt::WindowFlags ) hb_parni( 2 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QDockWidget( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QDockWidget( pObj, true ) ); } /* * Qt::DockWidgetAreas allowedAreas () const @@ -223,7 +223,7 @@ HB_FUNC( QT_QDOCKWIDGET_SETWIDGET ) */ HB_FUNC( QT_QDOCKWIDGET_TITLEBARWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QDockWidget( 1 )->titleBarWidget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QDockWidget( 1 )->titleBarWidget(), false ) ); } /* @@ -231,7 +231,7 @@ HB_FUNC( QT_QDOCKWIDGET_TITLEBARWIDGET ) */ HB_FUNC( QT_QDOCKWIDGET_TOGGLEVIEWACTION ) { - hb_retptr( ( QAction* ) hbqt_par_QDockWidget( 1 )->toggleViewAction() ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QDockWidget( 1 )->toggleViewAction(), false ) ); } /* @@ -239,7 +239,7 @@ HB_FUNC( QT_QDOCKWIDGET_TOGGLEVIEWACTION ) */ HB_FUNC( QT_QDOCKWIDGET_WIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QDockWidget( 1 )->widget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QDockWidget( 1 )->widget(), false ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QDoubleSpinBox.cpp b/harbour/contrib/hbqt/qtgui/QDoubleSpinBox.cpp index b6ba0f315c..3e07157a50 100644 --- a/harbour/contrib/hbqt/qtgui/QDoubleSpinBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QDoubleSpinBox.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -78,6 +78,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QDoubleSpinBox > pq; } QGC_POINTER_QDoubleSpinBox; @@ -86,48 +87,47 @@ QT_G_FUNC( hbqt_gcRelease_QDoubleSpinBox ) { QGC_POINTER_QDoubleSpinBox * p = ( QGC_POINTER_QDoubleSpinBox * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDoubleSpinBox p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDoubleSpinBox ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QDoubleSpinBox * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QDoubleSpinBox * ) p->ph )->~QDoubleSpinBox(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QDoubleSpinBox * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QDoubleSpinBox ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QDoubleSpinBox ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QDoubleSpinBox Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QDoubleSpinBox Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QDoubleSpinBox Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QDoubleSpinBox Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QDoubleSpinBox Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QDoubleSpinBox( void * pObj ) +void * hbqt_gcAllocate_QDoubleSpinBox( void * pObj, bool bNew ) { QGC_POINTER_QDoubleSpinBox * p = ( QGC_POINTER_QDoubleSpinBox * ) hb_gcAllocate( sizeof( QGC_POINTER_QDoubleSpinBox ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QDoubleSpinBox; - new( & p->pq ) QPointer< QDoubleSpinBox >( ( QDoubleSpinBox * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QDoubleSpinBox %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QDoubleSpinBox >( ( QDoubleSpinBox * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QDoubleSpinBox ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -137,7 +137,7 @@ HB_FUNC( QT_QDOUBLESPINBOX ) pObj = ( QDoubleSpinBox* ) new QDoubleSpinBox( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QDoubleSpinBox( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QDoubleSpinBox( pObj, true ) ); } /* * QString cleanText () const diff --git a/harbour/contrib/hbqt/qtgui/QDragEnterEvent.cpp b/harbour/contrib/hbqt/qtgui/QDragEnterEvent.cpp index faf583e09c..35cdacce81 100644 --- a/harbour/contrib/hbqt/qtgui/QDragEnterEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QDragEnterEvent.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -75,11 +75,33 @@ * QDragEnterEvent ( const QPoint & point, Qt::DropActions actions, const QMimeData * data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QDragEnterEvent; + QT_G_FUNC( hbqt_gcRelease_QDragEnterEvent ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QDragEnterEvent( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QDragEnterEvent; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QDragEnterEvent ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QDRAGENTEREVENT ) { } diff --git a/harbour/contrib/hbqt/qtgui/QDragLeaveEvent.cpp b/harbour/contrib/hbqt/qtgui/QDragLeaveEvent.cpp index bbf5956452..a35c5faaad 100644 --- a/harbour/contrib/hbqt/qtgui/QDragLeaveEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QDragLeaveEvent.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -75,11 +75,33 @@ * QDragLeaveEvent () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QDragLeaveEvent; + QT_G_FUNC( hbqt_gcRelease_QDragLeaveEvent ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QDragLeaveEvent( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QDragLeaveEvent; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QDragLeaveEvent ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QDRAGLEAVEEVENT ) { } diff --git a/harbour/contrib/hbqt/qtgui/QDragMoveEvent.cpp b/harbour/contrib/hbqt/qtgui/QDragMoveEvent.cpp index 539b9434c0..c1dff0b77e 100644 --- a/harbour/contrib/hbqt/qtgui/QDragMoveEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QDragMoveEvent.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -76,11 +76,33 @@ * ~QDragMoveEvent () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QDragMoveEvent; + QT_G_FUNC( hbqt_gcRelease_QDragMoveEvent ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QDragMoveEvent( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QDragMoveEvent; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QDragMoveEvent ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QDRAGMOVEEVENT ) { } @@ -105,7 +127,7 @@ HB_FUNC( QT_QDRAGMOVEEVENT_ACCEPT_1 ) */ HB_FUNC( QT_QDRAGMOVEEVENT_ANSWERRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QDragMoveEvent( 1 )->answerRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QDragMoveEvent( 1 )->answerRect() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QDropEvent.cpp b/harbour/contrib/hbqt/qtgui/QDropEvent.cpp index 24ae3161c1..2eecf887cf 100644 --- a/harbour/contrib/hbqt/qtgui/QDropEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QDropEvent.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -75,11 +75,33 @@ * QDropEvent ( const QPoint & pos, Qt::DropActions actions, const QMimeData * data, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Type type = Drop ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QDropEvent; + QT_G_FUNC( hbqt_gcRelease_QDropEvent ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QDropEvent( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QDropEvent; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QDropEvent ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QDROPEVENT ) { } @@ -107,14 +129,6 @@ HB_FUNC( QT_QDROPEVENT_KEYBOARDMODIFIERS ) hb_retni( ( Qt::KeyboardModifiers ) hbqt_par_QDropEvent( 1 )->keyboardModifiers() ); } -/* - * const QMimeData * mimeData () const - */ -HB_FUNC( QT_QDROPEVENT_MIMEDATA ) -{ - hb_retptr( ( QMimeData* ) hbqt_par_QDropEvent( 1 )->mimeData() ); -} - /* * Qt::MouseButtons mouseButtons () const */ @@ -128,7 +142,7 @@ HB_FUNC( QT_QDROPEVENT_MOUSEBUTTONS ) */ HB_FUNC( QT_QDROPEVENT_POS ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QDropEvent( 1 )->pos() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QDropEvent( 1 )->pos() ), true ) ); } /* @@ -160,7 +174,7 @@ HB_FUNC( QT_QDROPEVENT_SETDROPACTION ) */ HB_FUNC( QT_QDROPEVENT_SOURCE ) { - hb_retptr( ( QWidget* ) hbqt_par_QDropEvent( 1 )->source() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QDropEvent( 1 )->source(), false ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QErrorMessage.cpp b/harbour/contrib/hbqt/qtgui/QErrorMessage.cpp index e0ad31818a..f649e26477 100644 --- a/harbour/contrib/hbqt/qtgui/QErrorMessage.cpp +++ b/harbour/contrib/hbqt/qtgui/QErrorMessage.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QErrorMessage > pq; } QGC_POINTER_QErrorMessage; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QErrorMessage ) { QGC_POINTER_QErrorMessage * p = ( QGC_POINTER_QErrorMessage * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QErrorMessage p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QErrorMessage ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QErrorMessage * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QErrorMessage * ) p->ph )->~QErrorMessage(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QErrorMessage * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QErrorMessage ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QErrorMessage ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QErrorMessage Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QErrorMessage Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QErrorMessage Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QErrorMessage Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QErrorMessage Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QErrorMessage( void * pObj ) +void * hbqt_gcAllocate_QErrorMessage( void * pObj, bool bNew ) { QGC_POINTER_QErrorMessage * p = ( QGC_POINTER_QErrorMessage * ) hb_gcAllocate( sizeof( QGC_POINTER_QErrorMessage ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QErrorMessage; - new( & p->pq ) QPointer< QErrorMessage >( ( QErrorMessage * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QErrorMessage %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QErrorMessage >( ( QErrorMessage * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QErrorMessage ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -138,7 +138,7 @@ HB_FUNC( QT_QERRORMESSAGE ) pObj = ( QErrorMessage* ) new QErrorMessage( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QErrorMessage( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QErrorMessage( pObj, true ) ); } /* * void showMessage ( const QString & message ) diff --git a/harbour/contrib/hbqt/qtgui/QFileDialog.cpp b/harbour/contrib/hbqt/qtgui/QFileDialog.cpp index c00d4d65bd..3306eadf10 100644 --- a/harbour/contrib/hbqt/qtgui/QFileDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QFileDialog.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -106,6 +106,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QFileDialog > pq; } QGC_POINTER_QFileDialog; @@ -114,48 +115,47 @@ QT_G_FUNC( hbqt_gcRelease_QFileDialog ) { QGC_POINTER_QFileDialog * p = ( QGC_POINTER_QFileDialog * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFileDialog p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFileDialog ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QFileDialog * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QFileDialog * ) p->ph )->~QFileDialog(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QFileDialog * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QFileDialog ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QFileDialog ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFileDialog Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QFileDialog Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QFileDialog Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QFileDialog Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QFileDialog Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QFileDialog( void * pObj ) +void * hbqt_gcAllocate_QFileDialog( void * pObj, bool bNew ) { QGC_POINTER_QFileDialog * p = ( QGC_POINTER_QFileDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QFileDialog ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QFileDialog; - new( & p->pq ) QPointer< QFileDialog >( ( QFileDialog * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QFileDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QFileDialog >( ( QFileDialog * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QFileDialog ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -176,7 +176,7 @@ HB_FUNC( QT_QFILEDIALOG ) pObj = new QFileDialog() ; } - hb_retptrGC( hbqt_gcAllocate_QFileDialog( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QFileDialog( pObj, true ) ); } /* * AcceptMode acceptMode () const @@ -207,7 +207,7 @@ HB_FUNC( QT_QFILEDIALOG_DEFAULTSUFFIX ) */ HB_FUNC( QT_QFILEDIALOG_DIRECTORY ) { - hb_retptrGC( hbqt_gcAllocate_QDir( new QDir( hbqt_par_QFileDialog( 1 )->directory() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDir( new QDir( hbqt_par_QFileDialog( 1 )->directory() ), true ) ); } /* @@ -231,7 +231,7 @@ HB_FUNC( QT_QFILEDIALOG_FILTER ) */ HB_FUNC( QT_QFILEDIALOG_HISTORY ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFileDialog( 1 )->history() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFileDialog( 1 )->history() ), true ) ); } /* @@ -239,7 +239,7 @@ HB_FUNC( QT_QFILEDIALOG_HISTORY ) */ HB_FUNC( QT_QFILEDIALOG_ICONPROVIDER ) { - hb_retptr( ( QFileIconProvider* ) hbqt_par_QFileDialog( 1 )->iconProvider() ); + hb_retptrGC( hbqt_gcAllocate_QFileIconProvider( hbqt_par_QFileDialog( 1 )->iconProvider(), false ) ); } /* @@ -263,7 +263,7 @@ HB_FUNC( QT_QFILEDIALOG_ISREADONLY ) */ HB_FUNC( QT_QFILEDIALOG_ITEMDELEGATE ) { - hb_retptr( ( QAbstractItemDelegate* ) hbqt_par_QFileDialog( 1 )->itemDelegate() ); + hb_retptrGC( hbqt_gcAllocate_QAbstractItemDelegate( hbqt_par_QFileDialog( 1 )->itemDelegate(), false ) ); } /* @@ -279,7 +279,7 @@ HB_FUNC( QT_QFILEDIALOG_LABELTEXT ) */ HB_FUNC( QT_QFILEDIALOG_NAMEFILTERS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFileDialog( 1 )->nameFilters() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFileDialog( 1 )->nameFilters() ), true ) ); } /* @@ -295,7 +295,7 @@ HB_FUNC( QT_QFILEDIALOG_OPTIONS ) */ HB_FUNC( QT_QFILEDIALOG_PROXYMODEL ) { - hb_retptr( ( QAbstractProxyModel* ) hbqt_par_QFileDialog( 1 )->proxyModel() ); + hb_retptrGC( hbqt_gcAllocate_QAbstractProxyModel( hbqt_par_QFileDialog( 1 )->proxyModel(), false ) ); } /* @@ -319,7 +319,7 @@ HB_FUNC( QT_QFILEDIALOG_RESTORESTATE ) */ HB_FUNC( QT_QFILEDIALOG_SAVESTATE ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QFileDialog( 1 )->saveState() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QFileDialog( 1 )->saveState() ), true ) ); } /* @@ -343,7 +343,7 @@ HB_FUNC( QT_QFILEDIALOG_SELECTNAMEFILTER ) */ HB_FUNC( QT_QFILEDIALOG_SELECTEDFILES ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFileDialog( 1 )->selectedFiles() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFileDialog( 1 )->selectedFiles() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QFileIconProvider.cpp b/harbour/contrib/hbqt/qtgui/QFileIconProvider.cpp index 1e0c23a51d..242930cae0 100644 --- a/harbour/contrib/hbqt/qtgui/QFileIconProvider.cpp +++ b/harbour/contrib/hbqt/qtgui/QFileIconProvider.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,32 +79,49 @@ * virtual ~QFileIconProvider () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QFileIconProvider; + QT_G_FUNC( hbqt_gcRelease_QFileIconProvider ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFileIconProvider p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFileIconProvider ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QFileIconProvider * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QFileIconProvider Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QFileIconProvider * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QFileIconProvider ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QFileIconProvider Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QFileIconProvider Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QFileIconProvider Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QFileIconProvider( void * pObj ) +void * hbqt_gcAllocate_QFileIconProvider( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QFileIconProvider; - HB_TRACE( HB_TR_DEBUG, ( " new_QFileIconProvider %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QFileIconProvider ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -114,14 +131,14 @@ HB_FUNC( QT_QFILEICONPROVIDER ) pObj = new QFileIconProvider() ; - hb_retptrGC( hbqt_gcAllocate_QFileIconProvider( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QFileIconProvider( pObj, true ) ); } /* * virtual QIcon icon ( IconType type ) const */ HB_FUNC( QT_QFILEICONPROVIDER_ICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QFileIconProvider( 1 )->icon( ( QFileIconProvider::IconType ) hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QFileIconProvider( 1 )->icon( ( QFileIconProvider::IconType ) hb_parni( 2 ) ) ), true ) ); } /* @@ -129,7 +146,7 @@ HB_FUNC( QT_QFILEICONPROVIDER_ICON ) */ HB_FUNC( QT_QFILEICONPROVIDER_ICON_1 ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QFileIconProvider( 1 )->icon( *hbqt_par_QFileInfo( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QFileIconProvider( 1 )->icon( *hbqt_par_QFileInfo( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QFileSystemModel.cpp b/harbour/contrib/hbqt/qtgui/QFileSystemModel.cpp index 53d93db377..e44d64951d 100644 --- a/harbour/contrib/hbqt/qtgui/QFileSystemModel.cpp +++ b/harbour/contrib/hbqt/qtgui/QFileSystemModel.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -83,6 +83,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QFileSystemModel > pq; } QGC_POINTER_QFileSystemModel; @@ -91,48 +92,47 @@ QT_G_FUNC( hbqt_gcRelease_QFileSystemModel ) { QGC_POINTER_QFileSystemModel * p = ( QGC_POINTER_QFileSystemModel * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFileSystemModel p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFileSystemModel ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QFileSystemModel * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QFileSystemModel * ) p->ph )->~QFileSystemModel(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QFileSystemModel * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QFileSystemModel ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QFileSystemModel ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFileSystemModel Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QFileSystemModel Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QFileSystemModel Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QFileSystemModel Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QFileSystemModel Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QFileSystemModel( void * pObj ) +void * hbqt_gcAllocate_QFileSystemModel( void * pObj, bool bNew ) { QGC_POINTER_QFileSystemModel * p = ( QGC_POINTER_QFileSystemModel * ) hb_gcAllocate( sizeof( QGC_POINTER_QFileSystemModel ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QFileSystemModel; - new( & p->pq ) QPointer< QFileSystemModel >( ( QFileSystemModel * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QFileSystemModel %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QFileSystemModel >( ( QFileSystemModel * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QFileSystemModel ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -142,7 +142,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL ) pObj = ( QFileSystemModel * ) new QFileSystemModel() ; - hb_retptrGC( hbqt_gcAllocate_QFileSystemModel( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QFileSystemModel( pObj, true ) ); } /* * virtual bool dropMimeData ( const QMimeData * data, Qt::DropAction action, int row, int column, const QModelIndex & parent ) @@ -157,7 +157,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_DROPMIMEDATA ) */ HB_FUNC( QT_QFILESYSTEMMODEL_FILEICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QFileSystemModel( 1 )->fileIcon( *hbqt_par_QModelIndex( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QFileSystemModel( 1 )->fileIcon( *hbqt_par_QModelIndex( 2 ) ) ), true ) ); } /* @@ -165,7 +165,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_FILEICON ) */ HB_FUNC( QT_QFILESYSTEMMODEL_FILEINFO ) { - hb_retptrGC( hbqt_gcAllocate_QFileInfo( new QFileInfo( hbqt_par_QFileSystemModel( 1 )->fileInfo( *hbqt_par_QModelIndex( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFileInfo( new QFileInfo( hbqt_par_QFileSystemModel( 1 )->fileInfo( *hbqt_par_QModelIndex( 2 ) ) ), true ) ); } /* @@ -197,7 +197,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_FILTER ) */ HB_FUNC( QT_QFILESYSTEMMODEL_INDEX ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QFileSystemModel( 1 )->index( QFileSystemModel::tr( hb_parc( 2 ) ), hb_parni( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QFileSystemModel( 1 )->index( QFileSystemModel::tr( hb_parc( 2 ) ), hb_parni( 3 ) ) ), true ) ); } /* @@ -221,7 +221,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_ISREADONLY ) */ HB_FUNC( QT_QFILESYSTEMMODEL_LASTMODIFIED ) { - hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QFileSystemModel( 1 )->lastModified( *hbqt_par_QModelIndex( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDateTime( new QDateTime( hbqt_par_QFileSystemModel( 1 )->lastModified( *hbqt_par_QModelIndex( 2 ) ) ), true ) ); } /* @@ -229,7 +229,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_LASTMODIFIED ) */ HB_FUNC( QT_QFILESYSTEMMODEL_MIMETYPES ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFileSystemModel( 1 )->mimeTypes() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFileSystemModel( 1 )->mimeTypes() ), true ) ); } /* @@ -237,7 +237,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_MIMETYPES ) */ HB_FUNC( QT_QFILESYSTEMMODEL_MKDIR ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QFileSystemModel( 1 )->mkdir( *hbqt_par_QModelIndex( 2 ), QFileSystemModel::tr( hb_parc( 3 ) ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QFileSystemModel( 1 )->mkdir( *hbqt_par_QModelIndex( 2 ), QFileSystemModel::tr( hb_parc( 3 ) ) ) ), true ) ); } /* @@ -245,7 +245,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_MKDIR ) */ HB_FUNC( QT_QFILESYSTEMMODEL_MYCOMPUTER ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QFileSystemModel( 1 )->myComputer( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : Qt::DisplayRole ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QFileSystemModel( 1 )->myComputer( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : Qt::DisplayRole ) ) ), true ) ); } /* @@ -261,7 +261,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_NAMEFILTERDISABLES ) */ HB_FUNC( QT_QFILESYSTEMMODEL_NAMEFILTERS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFileSystemModel( 1 )->nameFilters() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFileSystemModel( 1 )->nameFilters() ), true ) ); } /* @@ -301,7 +301,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_RMDIR ) */ HB_FUNC( QT_QFILESYSTEMMODEL_ROOTDIRECTORY ) { - hb_retptrGC( hbqt_gcAllocate_QDir( new QDir( hbqt_par_QFileSystemModel( 1 )->rootDirectory() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QDir( new QDir( hbqt_par_QFileSystemModel( 1 )->rootDirectory() ), true ) ); } /* @@ -357,7 +357,7 @@ HB_FUNC( QT_QFILESYSTEMMODEL_SETRESOLVESYMLINKS ) */ HB_FUNC( QT_QFILESYSTEMMODEL_SETROOTPATH ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QFileSystemModel( 1 )->setRootPath( QFileSystemModel::tr( hb_parc( 2 ) ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QFileSystemModel( 1 )->setRootPath( QFileSystemModel::tr( hb_parc( 2 ) ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QFocusEvent.cpp b/harbour/contrib/hbqt/qtgui/QFocusEvent.cpp index 9f15cc16c0..46146744da 100644 --- a/harbour/contrib/hbqt/qtgui/QFocusEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QFocusEvent.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -75,11 +75,33 @@ * QFocusEvent ( Type type, Qt::FocusReason reason = Qt::OtherFocusReason ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QFocusEvent; + QT_G_FUNC( hbqt_gcRelease_QFocusEvent ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QFocusEvent( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QFocusEvent; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QFocusEvent ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QFOCUSEVENT ) { } diff --git a/harbour/contrib/hbqt/qtgui/QFocusFrame.cpp b/harbour/contrib/hbqt/qtgui/QFocusFrame.cpp index a4a960b6cf..3106f2d0d9 100644 --- a/harbour/contrib/hbqt/qtgui/QFocusFrame.cpp +++ b/harbour/contrib/hbqt/qtgui/QFocusFrame.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QFocusFrame > pq; } QGC_POINTER_QFocusFrame; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QFocusFrame ) { QGC_POINTER_QFocusFrame * p = ( QGC_POINTER_QFocusFrame * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFocusFrame p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFocusFrame ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QFocusFrame * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QFocusFrame * ) p->ph )->~QFocusFrame(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QFocusFrame * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QFocusFrame ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QFocusFrame ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFocusFrame Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QFocusFrame Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QFocusFrame Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QFocusFrame Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QFocusFrame Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QFocusFrame( void * pObj ) +void * hbqt_gcAllocate_QFocusFrame( void * pObj, bool bNew ) { QGC_POINTER_QFocusFrame * p = ( QGC_POINTER_QFocusFrame * ) hb_gcAllocate( sizeof( QGC_POINTER_QFocusFrame ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QFocusFrame; - new( & p->pq ) QPointer< QFocusFrame >( ( QFocusFrame * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QFocusFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QFocusFrame >( ( QFocusFrame * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QFocusFrame ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -138,7 +138,7 @@ HB_FUNC( QT_QFOCUSFRAME ) pObj = ( QFocusFrame* ) new QFocusFrame( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QFocusFrame( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QFocusFrame( pObj, true ) ); } /* * void setWidget ( QWidget * widget ) @@ -153,7 +153,7 @@ HB_FUNC( QT_QFOCUSFRAME_SETWIDGET ) */ HB_FUNC( QT_QFOCUSFRAME_WIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QFocusFrame( 1 )->widget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QFocusFrame( 1 )->widget(), false ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QFont.cpp b/harbour/contrib/hbqt/qtgui/QFont.cpp index 826d8e03fb..95770ec6f5 100644 --- a/harbour/contrib/hbqt/qtgui/QFont.cpp +++ b/harbour/contrib/hbqt/qtgui/QFont.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -89,32 +89,49 @@ * ~QFont () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QFont; + QT_G_FUNC( hbqt_gcRelease_QFont ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFont p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFont ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QFont * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QFont Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QFont * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QFont ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QFont Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QFont Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QFont Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QFont( void * pObj ) +void * hbqt_gcAllocate_QFont( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QFont; - HB_TRACE( HB_TR_DEBUG, ( " new_QFont %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QFont ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -151,7 +168,7 @@ HB_FUNC( QT_QFONT ) pObj = ( QFont* ) new QFont() ; } - hb_retptrGC( hbqt_gcAllocate_QFont( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( pObj, true ) ); } /* * bool bold () const @@ -606,7 +623,7 @@ HB_FUNC( QT_QFONT_SUBSTITUTE ) */ HB_FUNC( QT_QFONT_SUBSTITUTES ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFont( 1 )->substitutes( hbqt_par_QString( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFont( 1 )->substitutes( hbqt_par_QString( 2 ) ) ), true ) ); } /* @@ -614,7 +631,7 @@ HB_FUNC( QT_QFONT_SUBSTITUTES ) */ HB_FUNC( QT_QFONT_SUBSTITUTIONS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFont( 1 )->substitutions() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFont( 1 )->substitutions() ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QFontComboBox.cpp b/harbour/contrib/hbqt/qtgui/QFontComboBox.cpp index b067d80459..36dba715f5 100644 --- a/harbour/contrib/hbqt/qtgui/QFontComboBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QFontComboBox.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -84,6 +84,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QFontComboBox > pq; } QGC_POINTER_QFontComboBox; @@ -92,48 +93,47 @@ QT_G_FUNC( hbqt_gcRelease_QFontComboBox ) { QGC_POINTER_QFontComboBox * p = ( QGC_POINTER_QFontComboBox * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFontComboBox p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFontComboBox ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QFontComboBox * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QFontComboBox * ) p->ph )->~QFontComboBox(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QFontComboBox * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QFontComboBox ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QFontComboBox ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFontComboBox Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QFontComboBox Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QFontComboBox Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QFontComboBox Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QFontComboBox Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QFontComboBox( void * pObj ) +void * hbqt_gcAllocate_QFontComboBox( void * pObj, bool bNew ) { QGC_POINTER_QFontComboBox * p = ( QGC_POINTER_QFontComboBox * ) hb_gcAllocate( sizeof( QGC_POINTER_QFontComboBox ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QFontComboBox; - new( & p->pq ) QPointer< QFontComboBox >( ( QFontComboBox * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QFontComboBox %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QFontComboBox >( ( QFontComboBox * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QFontComboBox ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -143,14 +143,14 @@ HB_FUNC( QT_QFONTCOMBOBOX ) pObj = ( QFontComboBox * ) new QFontComboBox( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QFontComboBox( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QFontComboBox( pObj, true ) ); } /* * QFont currentFont () const */ HB_FUNC( QT_QFONTCOMBOBOX_CURRENTFONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QFontComboBox( 1 )->currentFont() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QFontComboBox( 1 )->currentFont() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QFontDatabase.cpp b/harbour/contrib/hbqt/qtgui/QFontDatabase.cpp index 683dc945c0..f18af532c3 100644 --- a/harbour/contrib/hbqt/qtgui/QFontDatabase.cpp +++ b/harbour/contrib/hbqt/qtgui/QFontDatabase.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -93,32 +93,49 @@ * QFontDatabase () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QFontDatabase; + QT_G_FUNC( hbqt_gcRelease_QFontDatabase ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFontDatabase p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFontDatabase ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QFontDatabase * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QFontDatabase Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QFontDatabase * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QFontDatabase ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QFontDatabase Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QFontDatabase Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QFontDatabase Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QFontDatabase( void * pObj ) +void * hbqt_gcAllocate_QFontDatabase( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QFontDatabase; - HB_TRACE( HB_TR_DEBUG, ( " new_QFontDatabase %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QFontDatabase ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -128,7 +145,7 @@ HB_FUNC( QT_QFONTDATABASE ) pObj = new QFontDatabase() ; - hb_retptrGC( hbqt_gcAllocate_QFontDatabase( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QFontDatabase( pObj, true ) ); } /* * bool bold ( const QString & family, const QString & style ) const @@ -143,7 +160,7 @@ HB_FUNC( QT_QFONTDATABASE_BOLD ) */ HB_FUNC( QT_QFONTDATABASE_FAMILIES ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFontDatabase( 1 )->families( ( HB_ISNUM( 2 ) ? ( QFontDatabase::WritingSystem ) hb_parni( 2 ) : ( QFontDatabase::WritingSystem ) QFontDatabase::Any ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFontDatabase( 1 )->families( ( HB_ISNUM( 2 ) ? ( QFontDatabase::WritingSystem ) hb_parni( 2 ) : ( QFontDatabase::WritingSystem ) QFontDatabase::Any ) ) ), true ) ); } /* @@ -151,7 +168,7 @@ HB_FUNC( QT_QFONTDATABASE_FAMILIES ) */ HB_FUNC( QT_QFONTDATABASE_FONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QFontDatabase( 1 )->font( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ), hb_parni( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QFontDatabase( 1 )->font( hbqt_par_QString( 2 ), hbqt_par_QString( 3 ), hb_parni( 4 ) ) ), true ) ); } /* @@ -215,7 +232,7 @@ HB_FUNC( QT_QFONTDATABASE_STYLESTRING_1 ) */ HB_FUNC( QT_QFONTDATABASE_STYLES ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFontDatabase( 1 )->styles( hbqt_par_QString( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFontDatabase( 1 )->styles( hbqt_par_QString( 2 ) ) ), true ) ); } /* @@ -247,7 +264,7 @@ HB_FUNC( QT_QFONTDATABASE_ADDAPPLICATIONFONTFROMDATA ) */ HB_FUNC( QT_QFONTDATABASE_APPLICATIONFONTFAMILIES ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFontDatabase( 1 )->applicationFontFamilies( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QFontDatabase( 1 )->applicationFontFamilies( hb_parni( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QFontDialog.cpp b/harbour/contrib/hbqt/qtgui/QFontDialog.cpp index 483d68f289..8efa0564f9 100644 --- a/harbour/contrib/hbqt/qtgui/QFontDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QFontDialog.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -84,6 +84,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QFontDialog > pq; } QGC_POINTER_QFontDialog; @@ -92,48 +93,47 @@ QT_G_FUNC( hbqt_gcRelease_QFontDialog ) { QGC_POINTER_QFontDialog * p = ( QGC_POINTER_QFontDialog * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFontDialog p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFontDialog ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QFontDialog * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QFontDialog * ) p->ph )->~QFontDialog(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QFontDialog * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QFontDialog ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QFontDialog ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFontDialog Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QFontDialog Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QFontDialog Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QFontDialog Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QFontDialog Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QFontDialog( void * pObj ) +void * hbqt_gcAllocate_QFontDialog( void * pObj, bool bNew ) { QGC_POINTER_QFontDialog * p = ( QGC_POINTER_QFontDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QFontDialog ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QFontDialog; - new( & p->pq ) QPointer< QFontDialog >( ( QFontDialog * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QFontDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QFontDialog >( ( QFontDialog * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QFontDialog ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -154,14 +154,14 @@ HB_FUNC( QT_QFONTDIALOG ) pObj = new QFontDialog( 0 ) ; } - hb_retptrGC( hbqt_gcAllocate_QFontDialog( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QFontDialog( pObj, true ) ); } /* * QFont currentFont () const */ HB_FUNC( QT_QFONTDIALOG_CURRENTFONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->currentFont() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->currentFont() ), true ) ); } /* @@ -177,7 +177,7 @@ HB_FUNC( QT_QFONTDIALOG_OPTIONS ) */ HB_FUNC( QT_QFONTDIALOG_SELECTEDFONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->selectedFont() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->selectedFont() ), true ) ); } /* @@ -219,7 +219,7 @@ HB_FUNC( QT_QFONTDIALOG_GETFONT ) { bool iOk = 0; - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, *hbqt_par_QFont( 3 ), hbqt_par_QWidget( 4 ), QFontDialog::tr( hb_parc( 5 ) ), ( QFontDialog::FontDialogOptions ) hb_parni( 6 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, *hbqt_par_QFont( 3 ), hbqt_par_QWidget( 4 ), QFontDialog::tr( hb_parc( 5 ) ), ( QFontDialog::FontDialogOptions ) hb_parni( 6 ) ) ), true ) ); hb_stornl( iOk, 2 ); } @@ -231,7 +231,7 @@ HB_FUNC( QT_QFONTDIALOG_GETFONT_1 ) { bool iOk = 0; - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, *hbqt_par_QFont( 3 ), hbqt_par_QWidget( 4 ), hbqt_par_char( 5 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, *hbqt_par_QFont( 3 ), hbqt_par_QWidget( 4 ), hbqt_par_char( 5 ) ) ), true ) ); hb_stornl( iOk, 2 ); } @@ -243,7 +243,7 @@ HB_FUNC( QT_QFONTDIALOG_GETFONT_2 ) { bool iOk = 0; - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, *hbqt_par_QFont( 3 ), hbqt_par_QWidget( 4 ), QFontDialog::tr( hb_parc( 5 ) ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, *hbqt_par_QFont( 3 ), hbqt_par_QWidget( 4 ), QFontDialog::tr( hb_parc( 5 ) ) ) ), true ) ); hb_stornl( iOk, 2 ); } @@ -255,7 +255,7 @@ HB_FUNC( QT_QFONTDIALOG_GETFONT_3 ) { bool iOk = 0; - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, *hbqt_par_QFont( 3 ), hbqt_par_QWidget( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, *hbqt_par_QFont( 3 ), hbqt_par_QWidget( 4 ) ) ), true ) ); hb_stornl( iOk, 2 ); } @@ -267,7 +267,7 @@ HB_FUNC( QT_QFONTDIALOG_GETFONT_4 ) { bool iOk = 0; - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, hbqt_par_QWidget( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QFontDialog( 1 )->getFont( &iOk, hbqt_par_QWidget( 3 ) ) ), true ) ); hb_stornl( iOk, 2 ); } diff --git a/harbour/contrib/hbqt/qtgui/QFontInfo.cpp b/harbour/contrib/hbqt/qtgui/QFontInfo.cpp index 69ba4e2950..5bab14c5f3 100644 --- a/harbour/contrib/hbqt/qtgui/QFontInfo.cpp +++ b/harbour/contrib/hbqt/qtgui/QFontInfo.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -77,32 +77,49 @@ * ~QFontInfo () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QFontInfo; + QT_G_FUNC( hbqt_gcRelease_QFontInfo ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFontInfo p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFontInfo ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QFontInfo * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QFontInfo Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QFontInfo * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QFontInfo ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QFontInfo Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QFontInfo Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QFontInfo Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QFontInfo( void * pObj ) +void * hbqt_gcAllocate_QFontInfo( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QFontInfo; - HB_TRACE( HB_TR_DEBUG, ( " new_QFontInfo %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QFontInfo ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -119,7 +136,7 @@ HB_FUNC( QT_QFONTINFO ) pObj = new QFontInfo( *hbqt_par_QFont( 2 ) ) ; } - hb_retptrGC( hbqt_gcAllocate_QFontInfo( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QFontInfo( pObj, true ) ); } /* * bool bold () const diff --git a/harbour/contrib/hbqt/qtgui/QFontMetrics.cpp b/harbour/contrib/hbqt/qtgui/QFontMetrics.cpp index d86c3fda1f..cdd2fc0a88 100644 --- a/harbour/contrib/hbqt/qtgui/QFontMetrics.cpp +++ b/harbour/contrib/hbqt/qtgui/QFontMetrics.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -78,32 +78,49 @@ * ~QFontMetrics () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QFontMetrics; + QT_G_FUNC( hbqt_gcRelease_QFontMetrics ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFontMetrics p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFontMetrics ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QFontMetrics * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QFontMetrics Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QFontMetrics * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QFontMetrics ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QFontMetrics Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QFontMetrics Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QFontMetrics Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QFontMetrics( void * pObj ) +void * hbqt_gcAllocate_QFontMetrics( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QFontMetrics; - HB_TRACE( HB_TR_DEBUG, ( " new_QFontMetrics %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QFontMetrics ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -127,7 +144,7 @@ HB_FUNC( QT_QFONTMETRICS ) pObj = new QFontMetrics( *hbqt_par_QFont( 1 ), hbqt_par_QPaintDevice( 2 ) ) ; } - hb_retptrGC( hbqt_gcAllocate_QFontMetrics( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QFontMetrics( pObj, true ) ); } /* * int ascent () const @@ -150,7 +167,7 @@ HB_FUNC( QT_QFONTMETRICS_AVERAGECHARWIDTH ) */ HB_FUNC( QT_QFONTMETRICS_BOUNDINGRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QFontMetrics( 1 )->boundingRect( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QFontMetrics( 1 )->boundingRect( hb_parni( 2 ) ) ), true ) ); } /* @@ -158,7 +175,7 @@ HB_FUNC( QT_QFONTMETRICS_BOUNDINGRECT ) */ HB_FUNC( QT_QFONTMETRICS_BOUNDINGRECT_1 ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QFontMetrics( 1 )->boundingRect( hbqt_par_QString( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QFontMetrics( 1 )->boundingRect( hbqt_par_QString( 2 ) ) ), true ) ); } /* @@ -168,7 +185,7 @@ HB_FUNC( QT_QFONTMETRICS_BOUNDINGRECT_2 ) { int iTabArray = 0; - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QFontMetrics( 1 )->boundingRect( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), hb_parni( 6 ), hbqt_par_QString( 7 ), hb_parni( 8 ), &iTabArray ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QFontMetrics( 1 )->boundingRect( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), hb_parni( 6 ), hbqt_par_QString( 7 ), hb_parni( 8 ), &iTabArray ) ), true ) ); hb_storni( iTabArray, 9 ); } @@ -180,7 +197,7 @@ HB_FUNC( QT_QFONTMETRICS_BOUNDINGRECT_3 ) { int iTabArray = 0; - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QFontMetrics( 1 )->boundingRect( *hbqt_par_QRect( 2 ), hb_parni( 3 ), hbqt_par_QString( 4 ), hb_parni( 5 ), &iTabArray ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QFontMetrics( 1 )->boundingRect( *hbqt_par_QRect( 2 ), hb_parni( 3 ), hbqt_par_QString( 4 ), hb_parni( 5 ), &iTabArray ) ), true ) ); hb_storni( iTabArray, 6 ); } @@ -296,7 +313,7 @@ HB_FUNC( QT_QFONTMETRICS_SIZE ) { int iTabArray = 0; - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QFontMetrics( 1 )->size( hb_parni( 2 ), hbqt_par_QString( 3 ), hb_parni( 4 ), &iTabArray ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QFontMetrics( 1 )->size( hb_parni( 2 ), hbqt_par_QString( 3 ), hb_parni( 4 ), &iTabArray ) ), true ) ); hb_storni( iTabArray, 5 ); } @@ -314,7 +331,7 @@ HB_FUNC( QT_QFONTMETRICS_STRIKEOUTPOS ) */ HB_FUNC( QT_QFONTMETRICS_TIGHTBOUNDINGRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QFontMetrics( 1 )->tightBoundingRect( hbqt_par_QString( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QFontMetrics( 1 )->tightBoundingRect( hbqt_par_QString( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QFontMetricsF.cpp b/harbour/contrib/hbqt/qtgui/QFontMetricsF.cpp index c349472530..acc5b45a97 100644 --- a/harbour/contrib/hbqt/qtgui/QFontMetricsF.cpp +++ b/harbour/contrib/hbqt/qtgui/QFontMetricsF.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,32 +79,49 @@ * ~QFontMetricsF () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QFontMetricsF; + QT_G_FUNC( hbqt_gcRelease_QFontMetricsF ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFontMetricsF p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFontMetricsF ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QFontMetricsF * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QFontMetricsF Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QFontMetricsF * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QFontMetricsF ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QFontMetricsF Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QFontMetricsF Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QFontMetricsF Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QFontMetricsF( void * pObj ) +void * hbqt_gcAllocate_QFontMetricsF( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QFontMetricsF; - HB_TRACE( HB_TR_DEBUG, ( " new_QFontMetricsF %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QFontMetricsF ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -132,7 +149,7 @@ HB_FUNC( QT_QFONTMETRICSF ) pObj = ( QFontMetricsF* ) new QFontMetricsF( *hbqt_par_QFont( 1 ), hbqt_par_QPaintDevice( 2 ) ) ; } - hb_retptrGC( hbqt_gcAllocate_QFontMetricsF( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QFontMetricsF( pObj, true ) ); } /* * qreal ascent () const @@ -155,7 +172,7 @@ HB_FUNC( QT_QFONTMETRICSF_AVERAGECHARWIDTH ) */ HB_FUNC( QT_QFONTMETRICSF_BOUNDINGRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QFontMetricsF( 1 )->boundingRect( hbqt_par_QString( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QFontMetricsF( 1 )->boundingRect( hbqt_par_QString( 2 ) ) ), true ) ); } /* @@ -163,7 +180,7 @@ HB_FUNC( QT_QFONTMETRICSF_BOUNDINGRECT ) */ HB_FUNC( QT_QFONTMETRICSF_BOUNDINGRECT_1 ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QFontMetricsF( 1 )->boundingRect( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QFontMetricsF( 1 )->boundingRect( hb_parni( 2 ) ) ), true ) ); } /* @@ -173,7 +190,7 @@ HB_FUNC( QT_QFONTMETRICSF_BOUNDINGRECT_2 ) { int iTabArray = 0; - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QFontMetricsF( 1 )->boundingRect( *hbqt_par_QRectF( 2 ), hb_parni( 3 ), hbqt_par_QString( 4 ), hb_parni( 5 ), &iTabArray ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QFontMetricsF( 1 )->boundingRect( *hbqt_par_QRectF( 2 ), hb_parni( 3 ), hbqt_par_QString( 4 ), hb_parni( 5 ), &iTabArray ) ), true ) ); hb_storni( iTabArray, 6 ); } @@ -289,7 +306,7 @@ HB_FUNC( QT_QFONTMETRICSF_SIZE ) { int iTabArray = 0; - hb_retptrGC( hbqt_gcAllocate_QSizeF( new QSizeF( hbqt_par_QFontMetricsF( 1 )->size( hb_parni( 2 ), hbqt_par_QString( 3 ), hb_parni( 4 ), &iTabArray ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSizeF( new QSizeF( hbqt_par_QFontMetricsF( 1 )->size( hb_parni( 2 ), hbqt_par_QString( 3 ), hb_parni( 4 ), &iTabArray ) ), true ) ); hb_storni( iTabArray, 5 ); } @@ -307,7 +324,7 @@ HB_FUNC( QT_QFONTMETRICSF_STRIKEOUTPOS ) */ HB_FUNC( QT_QFONTMETRICSF_TIGHTBOUNDINGRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QFontMetricsF( 1 )->tightBoundingRect( hbqt_par_QString( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QFontMetricsF( 1 )->tightBoundingRect( hbqt_par_QString( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QFormLayout.cpp b/harbour/contrib/hbqt/qtgui/QFormLayout.cpp index 0b4c48c99e..11ed468251 100644 --- a/harbour/contrib/hbqt/qtgui/QFormLayout.cpp +++ b/harbour/contrib/hbqt/qtgui/QFormLayout.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -85,6 +85,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QFormLayout > pq; } QGC_POINTER_QFormLayout; @@ -93,48 +94,47 @@ QT_G_FUNC( hbqt_gcRelease_QFormLayout ) { QGC_POINTER_QFormLayout * p = ( QGC_POINTER_QFormLayout * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFormLayout p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFormLayout ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QFormLayout * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QFormLayout * ) p->ph )->~QFormLayout(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QFormLayout * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QFormLayout ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QFormLayout ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFormLayout Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QFormLayout Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QFormLayout Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QFormLayout Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QFormLayout Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QFormLayout( void * pObj ) +void * hbqt_gcAllocate_QFormLayout( void * pObj, bool bNew ) { QGC_POINTER_QFormLayout * p = ( QGC_POINTER_QFormLayout * ) hb_gcAllocate( sizeof( QGC_POINTER_QFormLayout ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QFormLayout; - new( & p->pq ) QPointer< QFormLayout >( ( QFormLayout * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QFormLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QFormLayout >( ( QFormLayout * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QFormLayout ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -144,7 +144,7 @@ HB_FUNC( QT_QFORMLAYOUT ) pObj = ( QFormLayout * ) new QFormLayout( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QFormLayout( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QFormLayout( pObj, true ) ); } /* * void addRow ( QWidget * label, QWidget * field ) @@ -313,7 +313,7 @@ HB_FUNC( QT_QFORMLAYOUT_INSERTROW_5 ) */ HB_FUNC( QT_QFORMLAYOUT_ITEMAT ) { - hb_retptr( ( QLayoutItem* ) hbqt_par_QFormLayout( 1 )->itemAt( hb_parni( 2 ), ( QFormLayout::ItemRole ) hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLayoutItem( hbqt_par_QFormLayout( 1 )->itemAt( hb_parni( 2 ), ( QFormLayout::ItemRole ) hb_parni( 3 ) ), false ) ); } /* @@ -329,7 +329,7 @@ HB_FUNC( QT_QFORMLAYOUT_LABELALIGNMENT ) */ HB_FUNC( QT_QFORMLAYOUT_LABELFORFIELD ) { - hb_retptr( ( QWidget* ) hbqt_par_QFormLayout( 1 )->labelForField( hbqt_par_QWidget( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QFormLayout( 1 )->labelForField( hbqt_par_QWidget( 2 ) ), false ) ); } /* @@ -337,7 +337,7 @@ HB_FUNC( QT_QFORMLAYOUT_LABELFORFIELD ) */ HB_FUNC( QT_QFORMLAYOUT_LABELFORFIELD_1 ) { - hb_retptr( ( QWidget* ) hbqt_par_QFormLayout( 1 )->labelForField( hbqt_par_QLayout( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QFormLayout( 1 )->labelForField( hbqt_par_QLayout( 2 ) ), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QFrame.cpp b/harbour/contrib/hbqt/qtgui/QFrame.cpp index d806476a70..01e2f7537c 100644 --- a/harbour/contrib/hbqt/qtgui/QFrame.cpp +++ b/harbour/contrib/hbqt/qtgui/QFrame.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -85,6 +85,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QFrame > pq; } QGC_POINTER_QFrame; @@ -93,48 +94,47 @@ QT_G_FUNC( hbqt_gcRelease_QFrame ) { QGC_POINTER_QFrame * p = ( QGC_POINTER_QFrame * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFrame p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFrame ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QFrame * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QFrame * ) p->ph )->~QFrame(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QFrame * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QFrame ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QFrame ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFrame Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QFrame Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QFrame Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QFrame Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QFrame Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QFrame( void * pObj ) +void * hbqt_gcAllocate_QFrame( void * pObj, bool bNew ) { QGC_POINTER_QFrame * p = ( QGC_POINTER_QFrame * ) hb_gcAllocate( sizeof( QGC_POINTER_QFrame ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QFrame; - new( & p->pq ) QPointer< QFrame >( ( QFrame * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QFrame >( ( QFrame * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QFrame ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -144,14 +144,14 @@ HB_FUNC( QT_QFRAME ) pObj = new QFrame( hbqt_par_QWidget( 1 ), ( Qt::WindowFlags ) hb_parni( 2 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QFrame( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QFrame( pObj, true ) ); } /* * QRect frameRect () const */ HB_FUNC( QT_QFRAME_FRAMERECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QFrame( 1 )->frameRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QFrame( 1 )->frameRect() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QGradient.cpp b/harbour/contrib/hbqt/qtgui/QGradient.cpp index 7fd705f3ad..0e23ef36f2 100644 --- a/harbour/contrib/hbqt/qtgui/QGradient.cpp +++ b/harbour/contrib/hbqt/qtgui/QGradient.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,11 +81,33 @@ * */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QGradient; + QT_G_FUNC( hbqt_gcRelease_QGradient ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QGradient( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QGradient; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QGradient ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QGRADIENT ) { } diff --git a/harbour/contrib/hbqt/qtgui/QGridLayout.cpp b/harbour/contrib/hbqt/qtgui/QGridLayout.cpp index a36796feb4..7e39c5baf7 100644 --- a/harbour/contrib/hbqt/qtgui/QGridLayout.cpp +++ b/harbour/contrib/hbqt/qtgui/QGridLayout.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,6 +80,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QGridLayout > pq; } QGC_POINTER_QGridLayout; @@ -88,48 +89,47 @@ QT_G_FUNC( hbqt_gcRelease_QGridLayout ) { QGC_POINTER_QGridLayout * p = ( QGC_POINTER_QGridLayout * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QGridLayout p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QGridLayout ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QGridLayout * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QGridLayout * ) p->ph )->~QGridLayout(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QGridLayout * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QGridLayout ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QGridLayout ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QGridLayout Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QGridLayout Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QGridLayout Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QGridLayout Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QGridLayout Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QGridLayout( void * pObj ) +void * hbqt_gcAllocate_QGridLayout( void * pObj, bool bNew ) { QGC_POINTER_QGridLayout * p = ( QGC_POINTER_QGridLayout * ) hb_gcAllocate( sizeof( QGC_POINTER_QGridLayout ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QGridLayout; - new( & p->pq ) QPointer< QGridLayout >( ( QGridLayout * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QGridLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QGridLayout >( ( QGridLayout * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QGridLayout ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -139,7 +139,7 @@ HB_FUNC( QT_QGRIDLAYOUT ) pObj = new QGridLayout( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QGridLayout( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QGridLayout( pObj, true ) ); } /* * void addItem ( QLayoutItem * item, int row, int column, int rowSpan = 1, int columnSpan = 1, Qt::Alignment alignment = 0 ) @@ -186,7 +186,7 @@ HB_FUNC( QT_QGRIDLAYOUT_ADDWIDGET_1 ) */ HB_FUNC( QT_QGRIDLAYOUT_CELLRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QGridLayout( 1 )->cellRect( hb_parni( 2 ), hb_parni( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QGridLayout( 1 )->cellRect( hb_parni( 2 ), hb_parni( 3 ) ) ), true ) ); } /* @@ -244,7 +244,7 @@ HB_FUNC( QT_QGRIDLAYOUT_HORIZONTALSPACING ) */ HB_FUNC( QT_QGRIDLAYOUT_ITEMATPOSITION ) { - hb_retptr( ( QLayoutItem* ) hbqt_par_QGridLayout( 1 )->itemAtPosition( hb_parni( 2 ), hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLayoutItem( hbqt_par_QGridLayout( 1 )->itemAtPosition( hb_parni( 2 ), hb_parni( 3 ) ), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QGroupBox.cpp b/harbour/contrib/hbqt/qtgui/QGroupBox.cpp index c90571e8e9..22be516e20 100644 --- a/harbour/contrib/hbqt/qtgui/QGroupBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QGroupBox.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,6 +80,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QGroupBox > pq; } QGC_POINTER_QGroupBox; @@ -88,48 +89,47 @@ QT_G_FUNC( hbqt_gcRelease_QGroupBox ) { QGC_POINTER_QGroupBox * p = ( QGC_POINTER_QGroupBox * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QGroupBox p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QGroupBox ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QGroupBox * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QGroupBox * ) p->ph )->~QGroupBox(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QGroupBox * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QGroupBox ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QGroupBox ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QGroupBox Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QGroupBox Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QGroupBox Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QGroupBox Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QGroupBox Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QGroupBox( void * pObj ) +void * hbqt_gcAllocate_QGroupBox( void * pObj, bool bNew ) { QGC_POINTER_QGroupBox * p = ( QGC_POINTER_QGroupBox * ) hb_gcAllocate( sizeof( QGC_POINTER_QGroupBox ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QGroupBox; - new( & p->pq ) QPointer< QGroupBox >( ( QGroupBox * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QGroupBox %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QGroupBox >( ( QGroupBox * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QGroupBox ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -139,7 +139,7 @@ HB_FUNC( QT_QGROUPBOX ) pObj = ( QGroupBox * ) new QGroupBox( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QGroupBox( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QGroupBox( pObj, true ) ); } /* * Qt::Alignment alignment () const diff --git a/harbour/contrib/hbqt/qtgui/QHBoxLayout.cpp b/harbour/contrib/hbqt/qtgui/QHBoxLayout.cpp index d90a4416d9..df2cf1bea3 100644 --- a/harbour/contrib/hbqt/qtgui/QHBoxLayout.cpp +++ b/harbour/contrib/hbqt/qtgui/QHBoxLayout.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,6 +80,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QHBoxLayout > pq; } QGC_POINTER_QHBoxLayout; @@ -88,48 +89,47 @@ QT_G_FUNC( hbqt_gcRelease_QHBoxLayout ) { QGC_POINTER_QHBoxLayout * p = ( QGC_POINTER_QHBoxLayout * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QHBoxLayout p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QHBoxLayout ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QHBoxLayout * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QHBoxLayout * ) p->ph )->~QHBoxLayout(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QHBoxLayout * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QHBoxLayout ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QHBoxLayout ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QHBoxLayout Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QHBoxLayout Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QHBoxLayout Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QHBoxLayout Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QHBoxLayout Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QHBoxLayout( void * pObj ) +void * hbqt_gcAllocate_QHBoxLayout( void * pObj, bool bNew ) { QGC_POINTER_QHBoxLayout * p = ( QGC_POINTER_QHBoxLayout * ) hb_gcAllocate( sizeof( QGC_POINTER_QHBoxLayout ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QHBoxLayout; - new( & p->pq ) QPointer< QHBoxLayout >( ( QHBoxLayout * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QHBoxLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QHBoxLayout >( ( QHBoxLayout * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QHBoxLayout ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -139,7 +139,7 @@ HB_FUNC( QT_QHBOXLAYOUT ) pObj = ( QHBoxLayout * ) new QHBoxLayout( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QHBoxLayout( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QHBoxLayout( pObj, true ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QHeaderView.cpp b/harbour/contrib/hbqt/qtgui/QHeaderView.cpp index 3312e44879..662044584b 100644 --- a/harbour/contrib/hbqt/qtgui/QHeaderView.cpp +++ b/harbour/contrib/hbqt/qtgui/QHeaderView.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -83,6 +83,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QHeaderView > pq; } QGC_POINTER_QHeaderView; @@ -91,48 +92,47 @@ QT_G_FUNC( hbqt_gcRelease_QHeaderView ) { QGC_POINTER_QHeaderView * p = ( QGC_POINTER_QHeaderView * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QHeaderView p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QHeaderView ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QHeaderView * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QHeaderView * ) p->ph )->~QHeaderView(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QHeaderView * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QHeaderView ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QHeaderView ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QHeaderView Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QHeaderView Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QHeaderView Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QHeaderView Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QHeaderView Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QHeaderView( void * pObj ) +void * hbqt_gcAllocate_QHeaderView( void * pObj, bool bNew ) { QGC_POINTER_QHeaderView * p = ( QGC_POINTER_QHeaderView * ) hb_gcAllocate( sizeof( QGC_POINTER_QHeaderView ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QHeaderView; - new( & p->pq ) QPointer< QHeaderView >( ( QHeaderView * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QHeaderView %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QHeaderView >( ( QHeaderView * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QHeaderView ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -142,7 +142,7 @@ HB_FUNC( QT_QHEADERVIEW ) pObj = new QHeaderView( ( Qt::Orientation ) hb_parni( 1 ), hbqt_par_QWidget( 2 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QHeaderView( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QHeaderView( pObj, true ) ); } /* * bool cascadingSectionResizes () const @@ -341,7 +341,7 @@ HB_FUNC( QT_QHEADERVIEW_RESTORESTATE ) */ HB_FUNC( QT_QHEADERVIEW_SAVESTATE ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QHeaderView( 1 )->saveState() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QHeaderView( 1 )->saveState() ), true ) ); } /* @@ -509,7 +509,7 @@ HB_FUNC( QT_QHEADERVIEW_SHOWSECTION ) */ HB_FUNC( QT_QHEADERVIEW_SIZEHINT ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QHeaderView( 1 )->sizeHint() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QHeaderView( 1 )->sizeHint() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QHelpEvent.cpp b/harbour/contrib/hbqt/qtgui/QHelpEvent.cpp index 7e33b05aa9..2e248cff47 100644 --- a/harbour/contrib/hbqt/qtgui/QHelpEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QHelpEvent.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -75,11 +75,33 @@ * */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QHelpEvent; + QT_G_FUNC( hbqt_gcRelease_QHelpEvent ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QHelpEvent( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QHelpEvent; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QHelpEvent ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QHELPEVENT ) { } @@ -88,7 +110,7 @@ HB_FUNC( QT_QHELPEVENT ) */ HB_FUNC( QT_QHELPEVENT_GLOBALPOS ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QHelpEvent( 1 )->globalPos() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QHelpEvent( 1 )->globalPos() ), true ) ); } /* @@ -112,7 +134,7 @@ HB_FUNC( QT_QHELPEVENT_GLOBALY ) */ HB_FUNC( QT_QHELPEVENT_POS ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QHelpEvent( 1 )->pos() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QHelpEvent( 1 )->pos() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QIcon.cpp b/harbour/contrib/hbqt/qtgui/QIcon.cpp index 226689c7f5..09fc286318 100644 --- a/harbour/contrib/hbqt/qtgui/QIcon.cpp +++ b/harbour/contrib/hbqt/qtgui/QIcon.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -95,32 +95,49 @@ * ~QIcon () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QIcon; + QT_G_FUNC( hbqt_gcRelease_QIcon ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QIcon p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QIcon ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QIcon * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QIcon Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QIcon * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QIcon ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QIcon Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QIcon Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QIcon Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QIcon( void * pObj ) +void * hbqt_gcAllocate_QIcon( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QIcon; - HB_TRACE( HB_TR_DEBUG, ( " new_QIcon %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QIcon ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -141,14 +158,14 @@ HB_FUNC( QT_QICON ) pObj = ( QIcon* ) new QIcon() ; } - hb_retptrGC( hbqt_gcAllocate_QIcon( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( pObj, true ) ); } /* * QSize actualSize ( const QSize & size, Mode mode = Normal, State state = Off ) const */ HB_FUNC( QT_QICON_ACTUALSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QIcon( 1 )->actualSize( *hbqt_par_QSize( 2 ), ( HB_ISNUM( 3 ) ? ( QIcon::Mode ) hb_parni( 3 ) : ( QIcon::Mode ) QIcon::Normal ), ( HB_ISNUM( 4 ) ? ( QIcon::State ) hb_parni( 4 ) : ( QIcon::State ) QIcon::Off ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QIcon( 1 )->actualSize( *hbqt_par_QSize( 2 ), ( HB_ISNUM( 3 ) ? ( QIcon::Mode ) hb_parni( 3 ) : ( QIcon::Mode ) QIcon::Normal ), ( HB_ISNUM( 4 ) ? ( QIcon::State ) hb_parni( 4 ) : ( QIcon::State ) QIcon::Off ) ) ), true ) ); } /* @@ -204,7 +221,7 @@ HB_FUNC( QT_QICON_PAINT_1 ) */ HB_FUNC( QT_QICON_PIXMAP ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QIcon( 1 )->pixmap( *hbqt_par_QSize( 2 ), ( HB_ISNUM( 3 ) ? ( QIcon::Mode ) hb_parni( 3 ) : ( QIcon::Mode ) QIcon::Normal ), ( HB_ISNUM( 4 ) ? ( QIcon::State ) hb_parni( 4 ) : ( QIcon::State ) QIcon::Off ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QIcon( 1 )->pixmap( *hbqt_par_QSize( 2 ), ( HB_ISNUM( 3 ) ? ( QIcon::Mode ) hb_parni( 3 ) : ( QIcon::Mode ) QIcon::Normal ), ( HB_ISNUM( 4 ) ? ( QIcon::State ) hb_parni( 4 ) : ( QIcon::State ) QIcon::Off ) ) ), true ) ); } /* @@ -212,7 +229,7 @@ HB_FUNC( QT_QICON_PIXMAP ) */ HB_FUNC( QT_QICON_PIXMAP_1 ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QIcon( 1 )->pixmap( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISNUM( 4 ) ? ( QIcon::Mode ) hb_parni( 4 ) : ( QIcon::Mode ) QIcon::Normal ), ( HB_ISNUM( 5 ) ? ( QIcon::State ) hb_parni( 5 ) : ( QIcon::State ) QIcon::Off ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QIcon( 1 )->pixmap( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISNUM( 4 ) ? ( QIcon::Mode ) hb_parni( 4 ) : ( QIcon::Mode ) QIcon::Normal ), ( HB_ISNUM( 5 ) ? ( QIcon::State ) hb_parni( 5 ) : ( QIcon::State ) QIcon::Off ) ) ), true ) ); } /* @@ -220,7 +237,7 @@ HB_FUNC( QT_QICON_PIXMAP_1 ) */ HB_FUNC( QT_QICON_PIXMAP_2 ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QIcon( 1 )->pixmap( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( QIcon::Mode ) hb_parni( 3 ) : ( QIcon::Mode ) QIcon::Normal ), ( HB_ISNUM( 4 ) ? ( QIcon::State ) hb_parni( 4 ) : ( QIcon::State ) QIcon::Off ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QIcon( 1 )->pixmap( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( QIcon::Mode ) hb_parni( 3 ) : ( QIcon::Mode ) QIcon::Normal ), ( HB_ISNUM( 4 ) ? ( QIcon::State ) hb_parni( 4 ) : ( QIcon::State ) QIcon::Off ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QImage.cpp b/harbour/contrib/hbqt/qtgui/QImage.cpp index e553430a09..ad320f4e4f 100644 --- a/harbour/contrib/hbqt/qtgui/QImage.cpp +++ b/harbour/contrib/hbqt/qtgui/QImage.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -107,32 +107,49 @@ * ~QImage () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QImage; + QT_G_FUNC( hbqt_gcRelease_QImage ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QImage p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QImage ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QImage * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QImage Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QImage * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QImage ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QImage Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QImage Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QImage Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QImage( void * pObj ) +void * hbqt_gcAllocate_QImage( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QImage; - HB_TRACE( HB_TR_DEBUG, ( " new_QImage %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QImage ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -173,7 +190,7 @@ HB_FUNC( QT_QIMAGE ) pObj = ( QImage* ) new QImage() ; } - hb_retptrGC( hbqt_gcAllocate_QImage( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( pObj, true ) ); } /* * bool allGray () const @@ -188,7 +205,7 @@ HB_FUNC( QT_QIMAGE_ALLGRAY ) */ HB_FUNC( QT_QIMAGE_ALPHACHANNEL ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->alphaChannel() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->alphaChannel() ), true ) ); } /* @@ -236,7 +253,7 @@ HB_FUNC( QT_QIMAGE_COLOR ) */ HB_FUNC( QT_QIMAGE_CONVERTTOFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->convertToFormat( ( QImage::Format ) hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::ImageConversionFlags ) hb_parni( 3 ) : ( Qt::ImageConversionFlags ) Qt::AutoColor ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->convertToFormat( ( QImage::Format ) hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::ImageConversionFlags ) hb_parni( 3 ) : ( Qt::ImageConversionFlags ) Qt::AutoColor ) ) ), true ) ); } /* @@ -244,7 +261,7 @@ HB_FUNC( QT_QIMAGE_CONVERTTOFORMAT ) */ HB_FUNC( QT_QIMAGE_COPY ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->copy( ( HB_ISPOINTER( 2 ) ? *hbqt_par_QRect( 2 ) : QRect() ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->copy( ( HB_ISPOINTER( 2 ) ? *hbqt_par_QRect( 2 ) : QRect() ) ) ), true ) ); } /* @@ -252,7 +269,7 @@ HB_FUNC( QT_QIMAGE_COPY ) */ HB_FUNC( QT_QIMAGE_COPY_1 ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->copy( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->copy( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) ) ), true ) ); } /* @@ -260,7 +277,7 @@ HB_FUNC( QT_QIMAGE_COPY_1 ) */ HB_FUNC( QT_QIMAGE_CREATEALPHAMASK ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->createAlphaMask( ( HB_ISNUM( 2 ) ? ( Qt::ImageConversionFlags ) hb_parni( 2 ) : ( Qt::ImageConversionFlags ) Qt::AutoColor ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->createAlphaMask( ( HB_ISNUM( 2 ) ? ( Qt::ImageConversionFlags ) hb_parni( 2 ) : ( Qt::ImageConversionFlags ) Qt::AutoColor ) ) ), true ) ); } /* @@ -268,7 +285,7 @@ HB_FUNC( QT_QIMAGE_CREATEALPHAMASK ) */ HB_FUNC( QT_QIMAGE_CREATEHEURISTICMASK ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->createHeuristicMask( hb_parl( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->createHeuristicMask( hb_parl( 2 ) ) ), true ) ); } /* @@ -276,7 +293,7 @@ HB_FUNC( QT_QIMAGE_CREATEHEURISTICMASK ) */ HB_FUNC( QT_QIMAGE_CREATEMASKFROMCOLOR ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->createMaskFromColor( hb_parnl( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::MaskMode ) hb_parni( 3 ) : ( Qt::MaskMode ) Qt::MaskInColor ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->createMaskFromColor( hb_parnl( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::MaskMode ) hb_parni( 3 ) : ( Qt::MaskMode ) Qt::MaskInColor ) ) ), true ) ); } /* @@ -388,7 +405,7 @@ HB_FUNC( QT_QIMAGE_LOADFROMDATA ) */ HB_FUNC( QT_QIMAGE_MIRRORED ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->mirrored( hb_parl( 2 ), hb_parl( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->mirrored( hb_parl( 2 ), hb_parl( 3 ) ) ), true ) ); } /* @@ -412,7 +429,7 @@ HB_FUNC( QT_QIMAGE_NUMCOLORS ) */ HB_FUNC( QT_QIMAGE_OFFSET ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QImage( 1 )->offset() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QImage( 1 )->offset() ), true ) ); } /* @@ -452,7 +469,7 @@ HB_FUNC( QT_QIMAGE_PIXELINDEX_1 ) */ HB_FUNC( QT_QIMAGE_RECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QImage( 1 )->rect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QImage( 1 )->rect() ), true ) ); } /* @@ -460,7 +477,7 @@ HB_FUNC( QT_QIMAGE_RECT ) */ HB_FUNC( QT_QIMAGE_RGBSWAPPED ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->rgbSwapped() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->rgbSwapped() ), true ) ); } /* @@ -484,7 +501,7 @@ HB_FUNC( QT_QIMAGE_SAVE_1 ) */ HB_FUNC( QT_QIMAGE_SCALED ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->scaled( *hbqt_par_QSize( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::AspectRatioMode ) hb_parni( 3 ) : ( Qt::AspectRatioMode ) Qt::IgnoreAspectRatio ), ( HB_ISNUM( 4 ) ? ( Qt::TransformationMode ) hb_parni( 4 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->scaled( *hbqt_par_QSize( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::AspectRatioMode ) hb_parni( 3 ) : ( Qt::AspectRatioMode ) Qt::IgnoreAspectRatio ), ( HB_ISNUM( 4 ) ? ( Qt::TransformationMode ) hb_parni( 4 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), true ) ); } /* @@ -492,7 +509,7 @@ HB_FUNC( QT_QIMAGE_SCALED ) */ HB_FUNC( QT_QIMAGE_SCALED_1 ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->scaled( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISNUM( 4 ) ? ( Qt::AspectRatioMode ) hb_parni( 4 ) : ( Qt::AspectRatioMode ) Qt::IgnoreAspectRatio ), ( HB_ISNUM( 5 ) ? ( Qt::TransformationMode ) hb_parni( 5 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->scaled( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISNUM( 4 ) ? ( Qt::AspectRatioMode ) hb_parni( 4 ) : ( Qt::AspectRatioMode ) Qt::IgnoreAspectRatio ), ( HB_ISNUM( 5 ) ? ( Qt::TransformationMode ) hb_parni( 5 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), true ) ); } /* @@ -500,7 +517,7 @@ HB_FUNC( QT_QIMAGE_SCALED_1 ) */ HB_FUNC( QT_QIMAGE_SCALEDTOHEIGHT ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->scaledToHeight( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->scaledToHeight( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), true ) ); } /* @@ -508,7 +525,7 @@ HB_FUNC( QT_QIMAGE_SCALEDTOHEIGHT ) */ HB_FUNC( QT_QIMAGE_SCALEDTOWIDTH ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->scaledToWidth( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->scaledToWidth( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), true ) ); } /* @@ -596,7 +613,7 @@ HB_FUNC( QT_QIMAGE_SETTEXT ) */ HB_FUNC( QT_QIMAGE_SIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QImage( 1 )->size() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QImage( 1 )->size() ), true ) ); } /* @@ -612,7 +629,7 @@ HB_FUNC( QT_QIMAGE_TEXT ) */ HB_FUNC( QT_QIMAGE_TEXTKEYS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QImage( 1 )->textKeys() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QImage( 1 )->textKeys() ), true ) ); } /* @@ -620,7 +637,7 @@ HB_FUNC( QT_QIMAGE_TEXTKEYS ) */ HB_FUNC( QT_QIMAGE_TRANSFORMED ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->transformed( *hbqt_par_QMatrix( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->transformed( *hbqt_par_QMatrix( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), true ) ); } /* @@ -628,7 +645,7 @@ HB_FUNC( QT_QIMAGE_TRANSFORMED ) */ HB_FUNC( QT_QIMAGE_TRANSFORMED_1 ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->transformed( *hbqt_par_QTransform( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImage( 1 )->transformed( *hbqt_par_QTransform( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QImageReader.cpp b/harbour/contrib/hbqt/qtgui/QImageReader.cpp index 41c3976182..1ebe026d64 100644 --- a/harbour/contrib/hbqt/qtgui/QImageReader.cpp +++ b/harbour/contrib/hbqt/qtgui/QImageReader.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -92,32 +92,49 @@ * ~QImageReader () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QImageReader; + QT_G_FUNC( hbqt_gcRelease_QImageReader ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QImageReader p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QImageReader ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QImageReader * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QImageReader Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QImageReader * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QImageReader ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QImageReader Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QImageReader Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QImageReader Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QImageReader( void * pObj ) +void * hbqt_gcAllocate_QImageReader( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QImageReader; - HB_TRACE( HB_TR_DEBUG, ( " new_QImageReader %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QImageReader ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -127,7 +144,7 @@ HB_FUNC( QT_QIMAGEREADER ) pObj = ( QImageReader* ) new QImageReader() ; - hb_retptrGC( hbqt_gcAllocate_QImageReader( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QImageReader( pObj, true ) ); } /* * bool autoDetectImageFormat () const @@ -142,7 +159,7 @@ HB_FUNC( QT_QIMAGEREADER_AUTODETECTIMAGEFORMAT ) */ HB_FUNC( QT_QIMAGEREADER_BACKGROUNDCOLOR ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QImageReader( 1 )->backgroundColor() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QImageReader( 1 )->backgroundColor() ), true ) ); } /* @@ -158,7 +175,7 @@ HB_FUNC( QT_QIMAGEREADER_CANREAD ) */ HB_FUNC( QT_QIMAGEREADER_CLIPRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QImageReader( 1 )->clipRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QImageReader( 1 )->clipRect() ), true ) ); } /* @@ -174,7 +191,7 @@ HB_FUNC( QT_QIMAGEREADER_CURRENTIMAGENUMBER ) */ HB_FUNC( QT_QIMAGEREADER_CURRENTIMAGERECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QImageReader( 1 )->currentImageRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QImageReader( 1 )->currentImageRect() ), true ) ); } /* @@ -182,7 +199,7 @@ HB_FUNC( QT_QIMAGEREADER_CURRENTIMAGERECT ) */ HB_FUNC( QT_QIMAGEREADER_DEVICE ) { - hb_retptr( ( QIODevice* ) hbqt_par_QImageReader( 1 )->device() ); + hb_retptrGC( hbqt_gcAllocate_QIODevice( hbqt_par_QImageReader( 1 )->device(), false ) ); } /* @@ -214,7 +231,7 @@ HB_FUNC( QT_QIMAGEREADER_FILENAME ) */ HB_FUNC( QT_QIMAGEREADER_FORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QImageReader( 1 )->format() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QImageReader( 1 )->format() ), true ) ); } /* @@ -278,7 +295,7 @@ HB_FUNC( QT_QIMAGEREADER_QUALITY ) */ HB_FUNC( QT_QIMAGEREADER_READ ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImageReader( 1 )->read() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QImageReader( 1 )->read() ), true ) ); } /* @@ -294,7 +311,7 @@ HB_FUNC( QT_QIMAGEREADER_READ_1 ) */ HB_FUNC( QT_QIMAGEREADER_SCALEDCLIPRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QImageReader( 1 )->scaledClipRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QImageReader( 1 )->scaledClipRect() ), true ) ); } /* @@ -302,7 +319,7 @@ HB_FUNC( QT_QIMAGEREADER_SCALEDCLIPRECT ) */ HB_FUNC( QT_QIMAGEREADER_SCALEDSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QImageReader( 1 )->scaledSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QImageReader( 1 )->scaledSize() ), true ) ); } /* @@ -382,7 +399,7 @@ HB_FUNC( QT_QIMAGEREADER_SETSCALEDSIZE ) */ HB_FUNC( QT_QIMAGEREADER_SIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QImageReader( 1 )->size() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QImageReader( 1 )->size() ), true ) ); } /* @@ -414,7 +431,7 @@ HB_FUNC( QT_QIMAGEREADER_TEXT ) */ HB_FUNC( QT_QIMAGEREADER_TEXTKEYS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QImageReader( 1 )->textKeys() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QImageReader( 1 )->textKeys() ), true ) ); } /* @@ -422,7 +439,7 @@ HB_FUNC( QT_QIMAGEREADER_TEXTKEYS ) */ HB_FUNC( QT_QIMAGEREADER_IMAGEFORMAT_1 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QImageReader( 1 )->imageFormat( hbqt_par_QString( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QImageReader( 1 )->imageFormat( hbqt_par_QString( 2 ) ) ), true ) ); } /* @@ -430,7 +447,7 @@ HB_FUNC( QT_QIMAGEREADER_IMAGEFORMAT_1 ) */ HB_FUNC( QT_QIMAGEREADER_IMAGEFORMAT_2 ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QImageReader( 1 )->imageFormat( hbqt_par_QIODevice( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QImageReader( 1 )->imageFormat( hbqt_par_QIODevice( 2 ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QImageWriter.cpp b/harbour/contrib/hbqt/qtgui/QImageWriter.cpp index 2e628445f6..9d977624b8 100644 --- a/harbour/contrib/hbqt/qtgui/QImageWriter.cpp +++ b/harbour/contrib/hbqt/qtgui/QImageWriter.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -91,32 +91,49 @@ * ~QImageWriter () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QImageWriter; + QT_G_FUNC( hbqt_gcRelease_QImageWriter ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QImageWriter p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QImageWriter ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QImageWriter * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QImageWriter Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QImageWriter * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QImageWriter ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QImageWriter Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QImageWriter Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QImageWriter Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QImageWriter( void * pObj ) +void * hbqt_gcAllocate_QImageWriter( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QImageWriter; - HB_TRACE( HB_TR_DEBUG, ( " new_QImageWriter %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QImageWriter ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -126,7 +143,7 @@ HB_FUNC( QT_QIMAGEWRITER ) pObj = ( QImageWriter* ) new QImageWriter() ; - hb_retptrGC( hbqt_gcAllocate_QImageWriter( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QImageWriter( pObj, true ) ); } /* * bool canWrite () const @@ -149,7 +166,7 @@ HB_FUNC( QT_QIMAGEWRITER_COMPRESSION ) */ HB_FUNC( QT_QIMAGEWRITER_DEVICE ) { - hb_retptr( ( QIODevice* ) hbqt_par_QImageWriter( 1 )->device() ); + hb_retptrGC( hbqt_gcAllocate_QIODevice( hbqt_par_QImageWriter( 1 )->device(), false ) ); } /* @@ -181,7 +198,7 @@ HB_FUNC( QT_QIMAGEWRITER_FILENAME ) */ HB_FUNC( QT_QIMAGEWRITER_FORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QImageWriter( 1 )->format() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QImageWriter( 1 )->format() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QInputContext.cpp b/harbour/contrib/hbqt/qtgui/QInputContext.cpp index fa3bf3f89d..8e759c74cd 100644 --- a/harbour/contrib/hbqt/qtgui/QInputContext.cpp +++ b/harbour/contrib/hbqt/qtgui/QInputContext.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -92,11 +92,35 @@ * virtual ~QInputContext () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QInputContext > pq; +} QGC_POINTER_QInputContext; + QT_G_FUNC( hbqt_gcRelease_QInputContext ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QInputContext( void * pObj, bool bNew ) +{ + QGC_POINTER_QInputContext * p = ( QGC_POINTER_QInputContext * ) hb_gcAllocate( sizeof( QGC_POINTER_QInputContext ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QInputContext; + + if( bNew ) + { + new( & p->pq ) QPointer< QInputContext >( ( QInputContext * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QInputContext ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QINPUTCONTEXT ) { } @@ -113,7 +137,7 @@ HB_FUNC( QT_QINPUTCONTEXT_FILTEREVENT ) */ HB_FUNC( QT_QINPUTCONTEXT_FONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QInputContext( 1 )->font() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QInputContext( 1 )->font() ), true ) ); } /* @@ -169,7 +193,7 @@ HB_FUNC( QT_QINPUTCONTEXT_SENDEVENT ) */ HB_FUNC( QT_QINPUTCONTEXT_STANDARDFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextFormat( new QTextFormat( hbqt_par_QInputContext( 1 )->standardFormat( ( QInputContext::StandardFormat ) hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextFormat( new QTextFormat( hbqt_par_QInputContext( 1 )->standardFormat( ( QInputContext::StandardFormat ) hb_parni( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QInputDialog.cpp b/harbour/contrib/hbqt/qtgui/QInputDialog.cpp index a5cc8d5611..864e820141 100644 --- a/harbour/contrib/hbqt/qtgui/QInputDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QInputDialog.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -85,6 +85,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QInputDialog > pq; } QGC_POINTER_QInputDialog; @@ -93,48 +94,47 @@ QT_G_FUNC( hbqt_gcRelease_QInputDialog ) { QGC_POINTER_QInputDialog * p = ( QGC_POINTER_QInputDialog * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QInputDialog p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QInputDialog ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QInputDialog * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QInputDialog * ) p->ph )->~QInputDialog(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QInputDialog * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QInputDialog ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QInputDialog ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QInputDialog Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QInputDialog Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QInputDialog Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QInputDialog Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QInputDialog Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QInputDialog( void * pObj ) +void * hbqt_gcAllocate_QInputDialog( void * pObj, bool bNew ) { QGC_POINTER_QInputDialog * p = ( QGC_POINTER_QInputDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QInputDialog ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QInputDialog; - new( & p->pq ) QPointer< QInputDialog >( ( QInputDialog * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QInputDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QInputDialog >( ( QInputDialog * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QInputDialog ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -144,7 +144,7 @@ HB_FUNC( QT_QINPUTDIALOG ) pObj = ( QInputDialog * ) new QInputDialog( hbqt_par_QWidget( 1 ), ( Qt::WindowFlags ) hb_parni( 2 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QInputDialog( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QInputDialog( pObj, true ) ); } /* * QString cancelButtonText () const @@ -159,7 +159,7 @@ HB_FUNC( QT_QINPUTDIALOG_CANCELBUTTONTEXT ) */ HB_FUNC( QT_QINPUTDIALOG_COMBOBOXITEMS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QInputDialog( 1 )->comboBoxItems() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QInputDialog( 1 )->comboBoxItems() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QInputEvent.cpp b/harbour/contrib/hbqt/qtgui/QInputEvent.cpp index 40be579426..07ee9bf34d 100644 --- a/harbour/contrib/hbqt/qtgui/QInputEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QInputEvent.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -76,32 +76,49 @@ * */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QInputEvent; + QT_G_FUNC( hbqt_gcRelease_QInputEvent ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QInputEvent p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QInputEvent ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QInputEvent * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QInputEvent Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QInputEvent * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QInputEvent ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QInputEvent Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QInputEvent Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QInputEvent Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QInputEvent( void * pObj ) +void * hbqt_gcAllocate_QInputEvent( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QInputEvent; - HB_TRACE( HB_TR_DEBUG, ( " new_QInputEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QInputEvent ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -111,7 +128,7 @@ HB_FUNC( QT_QINPUTEVENT ) pObj = ( QInputEvent* ) new QInputEvent( ( QEvent::Type ) hb_parni( 1 ), ( Qt::KeyboardModifiers ) hb_parni( 2 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QInputEvent( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QInputEvent( pObj, true ) ); } /* * Qt::KeyboardModifiers modifiers () const diff --git a/harbour/contrib/hbqt/qtgui/QInputMethodEvent.cpp b/harbour/contrib/hbqt/qtgui/QInputMethodEvent.cpp index 209a4f8968..d8256adc28 100644 --- a/harbour/contrib/hbqt/qtgui/QInputMethodEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QInputMethodEvent.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -89,32 +89,49 @@ * QInputMethodEvent ( const QInputMethodEvent & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QInputMethodEvent; + QT_G_FUNC( hbqt_gcRelease_QInputMethodEvent ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QInputMethodEvent p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QInputMethodEvent ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QInputMethodEvent * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QInputMethodEvent Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QInputMethodEvent * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QInputMethodEvent ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QInputMethodEvent Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QInputMethodEvent Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QInputMethodEvent Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QInputMethodEvent( void * pObj ) +void * hbqt_gcAllocate_QInputMethodEvent( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QInputMethodEvent; - HB_TRACE( HB_TR_DEBUG, ( " new_QInputMethodEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QInputMethodEvent ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -124,7 +141,7 @@ HB_FUNC( QT_QINPUTMETHODEVENT ) pObj = new QInputMethodEvent() ; - hb_retptrGC( hbqt_gcAllocate_QInputMethodEvent( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QInputMethodEvent( pObj, true ) ); } /* * const QString & commitString () const diff --git a/harbour/contrib/hbqt/qtgui/QItemSelection.cpp b/harbour/contrib/hbqt/qtgui/QItemSelection.cpp index 302bbce5a2..17c39de325 100644 --- a/harbour/contrib/hbqt/qtgui/QItemSelection.cpp +++ b/harbour/contrib/hbqt/qtgui/QItemSelection.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -75,32 +75,49 @@ * QItemSelection ( const QModelIndex & topLeft, const QModelIndex & bottomRight ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QItemSelection; + QT_G_FUNC( hbqt_gcRelease_QItemSelection ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QItemSelection p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QItemSelection ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QItemSelection * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QItemSelection Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QItemSelection * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QItemSelection ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QItemSelection Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QItemSelection Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QItemSelection Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QItemSelection( void * pObj ) +void * hbqt_gcAllocate_QItemSelection( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QItemSelection; - HB_TRACE( HB_TR_DEBUG, ( " new_QItemSelection %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QItemSelection ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -110,7 +127,7 @@ HB_FUNC( QT_QITEMSELECTION ) pObj = new QItemSelection() ; - hb_retptrGC( hbqt_gcAllocate_QItemSelection( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QItemSelection( pObj, true ) ); } /* * bool contains ( const QModelIndex & index ) const diff --git a/harbour/contrib/hbqt/qtgui/QItemSelectionModel.cpp b/harbour/contrib/hbqt/qtgui/QItemSelectionModel.cpp index 525eab9f87..b9e8f72aee 100644 --- a/harbour/contrib/hbqt/qtgui/QItemSelectionModel.cpp +++ b/harbour/contrib/hbqt/qtgui/QItemSelectionModel.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -84,6 +84,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QItemSelectionModel > pq; } QGC_POINTER_QItemSelectionModel; @@ -92,48 +93,47 @@ QT_G_FUNC( hbqt_gcRelease_QItemSelectionModel ) { QGC_POINTER_QItemSelectionModel * p = ( QGC_POINTER_QItemSelectionModel * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QItemSelectionModel p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QItemSelectionModel ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QItemSelectionModel * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QItemSelectionModel * ) p->ph )->~QItemSelectionModel(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QItemSelectionModel * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QItemSelectionModel ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QItemSelectionModel ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QItemSelectionModel Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QItemSelectionModel Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QItemSelectionModel Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QItemSelectionModel Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QItemSelectionModel Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QItemSelectionModel( void * pObj ) +void * hbqt_gcAllocate_QItemSelectionModel( void * pObj, bool bNew ) { QGC_POINTER_QItemSelectionModel * p = ( QGC_POINTER_QItemSelectionModel * ) hb_gcAllocate( sizeof( QGC_POINTER_QItemSelectionModel ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QItemSelectionModel; - new( & p->pq ) QPointer< QItemSelectionModel >( ( QItemSelectionModel * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QItemSelectionModel %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QItemSelectionModel >( ( QItemSelectionModel * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QItemSelectionModel ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -146,7 +146,7 @@ HB_FUNC( QT_QITEMSELECTIONMODEL ) pObj = new QItemSelectionModel( hbqt_par_QAbstractItemModel( 1 ) ) ; } - hb_retptrGC( hbqt_gcAllocate_QItemSelectionModel( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QItemSelectionModel( pObj, true ) ); } /* * bool columnIntersectsSelection ( int column, const QModelIndex & parent ) const @@ -161,7 +161,7 @@ HB_FUNC( QT_QITEMSELECTIONMODEL_COLUMNINTERSECTSSELECTION ) */ HB_FUNC( QT_QITEMSELECTIONMODEL_CURRENTINDEX ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QItemSelectionModel( 1 )->currentIndex() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QItemSelectionModel( 1 )->currentIndex() ), true ) ); } /* @@ -217,7 +217,7 @@ HB_FUNC( QT_QITEMSELECTIONMODEL_ROWINTERSECTSSELECTION ) */ HB_FUNC( QT_QITEMSELECTIONMODEL_SELECTION ) { - hb_retptrGC( hbqt_gcAllocate_QItemSelection( new QItemSelection( hbqt_par_QItemSelectionModel( 1 )->selection() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QItemSelection( new QItemSelection( hbqt_par_QItemSelectionModel( 1 )->selection() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QKeyEvent.cpp b/harbour/contrib/hbqt/qtgui/QKeyEvent.cpp index c9cfd7ae94..2cb3fd1270 100644 --- a/harbour/contrib/hbqt/qtgui/QKeyEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QKeyEvent.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -76,11 +76,33 @@ * ~QKeyEvent () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QKeyEvent; + QT_G_FUNC( hbqt_gcRelease_QKeyEvent ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QKeyEvent( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QKeyEvent; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QKeyEvent ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QKEYEVENT ) { } diff --git a/harbour/contrib/hbqt/qtgui/QKeySequence.cpp b/harbour/contrib/hbqt/qtgui/QKeySequence.cpp index 248ee08633..04d1cee092 100644 --- a/harbour/contrib/hbqt/qtgui/QKeySequence.cpp +++ b/harbour/contrib/hbqt/qtgui/QKeySequence.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -95,32 +95,49 @@ * ~QKeySequence () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QKeySequence; + QT_G_FUNC( hbqt_gcRelease_QKeySequence ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QKeySequence p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QKeySequence ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QKeySequence * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QKeySequence Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QKeySequence * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QKeySequence ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QKeySequence Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QKeySequence Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QKeySequence Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QKeySequence( void * pObj ) +void * hbqt_gcAllocate_QKeySequence( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QKeySequence; - HB_TRACE( HB_TR_DEBUG, ( " new_QKeySequence %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QKeySequence ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -137,7 +154,7 @@ HB_FUNC( QT_QKEYSEQUENCE ) else pObj = ( QKeySequence * ) new QKeySequence() ; - hb_retptrGC( hbqt_gcAllocate_QKeySequence( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QKeySequence( pObj, true ) ); } /* * uint count () const @@ -176,7 +193,7 @@ HB_FUNC( QT_QKEYSEQUENCE_TOSTRING ) */ HB_FUNC( QT_QKEYSEQUENCE_FROMSTRING ) { - hb_retptrGC( hbqt_gcAllocate_QKeySequence( new QKeySequence( hbqt_par_QKeySequence( 1 )->fromString( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( QKeySequence::SequenceFormat ) hb_parni( 3 ) : ( QKeySequence::SequenceFormat ) QKeySequence::PortableText ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QKeySequence( new QKeySequence( hbqt_par_QKeySequence( 1 )->fromString( hbqt_par_QString( 2 ), ( HB_ISNUM( 3 ) ? ( QKeySequence::SequenceFormat ) hb_parni( 3 ) : ( QKeySequence::SequenceFormat ) QKeySequence::PortableText ) ) ), true ) ); } /* @@ -184,7 +201,7 @@ HB_FUNC( QT_QKEYSEQUENCE_FROMSTRING ) */ HB_FUNC( QT_QKEYSEQUENCE_MNEMONIC ) { - hb_retptrGC( hbqt_gcAllocate_QKeySequence( new QKeySequence( hbqt_par_QKeySequence( 1 )->mnemonic( hbqt_par_QString( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QKeySequence( new QKeySequence( hbqt_par_QKeySequence( 1 )->mnemonic( hbqt_par_QString( 2 ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QLCDNumber.cpp b/harbour/contrib/hbqt/qtgui/QLCDNumber.cpp index 7ddcf92e57..536cd8d6f6 100644 --- a/harbour/contrib/hbqt/qtgui/QLCDNumber.cpp +++ b/harbour/contrib/hbqt/qtgui/QLCDNumber.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -85,6 +85,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QLCDNumber > pq; } QGC_POINTER_QLCDNumber; @@ -93,48 +94,47 @@ QT_G_FUNC( hbqt_gcRelease_QLCDNumber ) { QGC_POINTER_QLCDNumber * p = ( QGC_POINTER_QLCDNumber * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLCDNumber p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLCDNumber ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QLCDNumber * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QLCDNumber * ) p->ph )->~QLCDNumber(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QLCDNumber * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QLCDNumber ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QLCDNumber ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLCDNumber Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QLCDNumber Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QLCDNumber Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QLCDNumber Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QLCDNumber Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QLCDNumber( void * pObj ) +void * hbqt_gcAllocate_QLCDNumber( void * pObj, bool bNew ) { QGC_POINTER_QLCDNumber * p = ( QGC_POINTER_QLCDNumber * ) hb_gcAllocate( sizeof( QGC_POINTER_QLCDNumber ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QLCDNumber; - new( & p->pq ) QPointer< QLCDNumber >( ( QLCDNumber * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QLCDNumber %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QLCDNumber >( ( QLCDNumber * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QLCDNumber ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -144,7 +144,7 @@ HB_FUNC( QT_QLCDNUMBER ) pObj = ( QLCDNumber * ) new QLCDNumber( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QLCDNumber( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QLCDNumber( pObj, true ) ); } /* * bool checkOverflow ( double num ) const diff --git a/harbour/contrib/hbqt/qtgui/QLabel.cpp b/harbour/contrib/hbqt/qtgui/QLabel.cpp index 7b4feaa9c4..5fcbddbba4 100644 --- a/harbour/contrib/hbqt/qtgui/QLabel.cpp +++ b/harbour/contrib/hbqt/qtgui/QLabel.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -69,6 +69,7 @@ #include #include +#include /* @@ -80,6 +81,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QLabel > pq; } QGC_POINTER_QLabel; @@ -88,48 +90,47 @@ QT_G_FUNC( hbqt_gcRelease_QLabel ) { QGC_POINTER_QLabel * p = ( QGC_POINTER_QLabel * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLabel p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLabel ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QLabel * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QLabel * ) p->ph )->~QLabel(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QLabel * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QLabel ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QLabel ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLabel Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QLabel Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QLabel Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QLabel Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QLabel Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QLabel( void * pObj ) +void * hbqt_gcAllocate_QLabel( void * pObj, bool bNew ) { QGC_POINTER_QLabel * p = ( QGC_POINTER_QLabel * ) hb_gcAllocate( sizeof( QGC_POINTER_QLabel ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QLabel; - new( & p->pq ) QPointer< QLabel >( ( QLabel * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QLabel %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QLabel >( ( QLabel * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QLabel ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -139,7 +140,7 @@ HB_FUNC( QT_QLABEL ) pObj = ( QLabel* ) new QLabel( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QLabel( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QLabel( pObj, true ) ); } /* * Qt::Alignment alignment () const @@ -154,7 +155,7 @@ HB_FUNC( QT_QLABEL_ALIGNMENT ) */ HB_FUNC( QT_QLABEL_BUDDY ) { - hb_retptr( ( QWidget* ) hbqt_par_QLabel( 1 )->buddy() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QLabel( 1 )->buddy(), false ) ); } /* @@ -186,7 +187,7 @@ HB_FUNC( QT_QLABEL_MARGIN ) */ HB_FUNC( QT_QLABEL_MOVIE ) { - hb_retptr( ( QMovie* ) hbqt_par_QLabel( 1 )->movie() ); + hb_retptrGC( hbqt_gcAllocate_QMovie( hbqt_par_QLabel( 1 )->movie(), false ) ); } /* @@ -202,7 +203,7 @@ HB_FUNC( QT_QLABEL_OPENEXTERNALLINKS ) */ HB_FUNC( QT_QLABEL_PICTURE ) { - hb_retptr( ( QPicture* ) hbqt_par_QLabel( 1 )->picture() ); + hb_retptrGC( hbqt_gcAllocate_QPicture( new QPicture( *( hbqt_par_QLabel( 1 )->picture() ) ), true ) ); } /* @@ -210,7 +211,7 @@ HB_FUNC( QT_QLABEL_PICTURE ) */ HB_FUNC( QT_QLABEL_PIXMAP ) { - hb_retptr( ( QPixmap* ) hbqt_par_QLabel( 1 )->pixmap() ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( *( hbqt_par_QLabel( 1 )->pixmap() ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QLayout.cpp b/harbour/contrib/hbqt/qtgui/QLayout.cpp index 0e442eea0a..7d8d72a77f 100644 --- a/harbour/contrib/hbqt/qtgui/QLayout.cpp +++ b/harbour/contrib/hbqt/qtgui/QLayout.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,11 +80,35 @@ * QLayout () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QLayout > pq; +} QGC_POINTER_QLayout; + QT_G_FUNC( hbqt_gcRelease_QLayout ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QLayout( void * pObj, bool bNew ) +{ + QGC_POINTER_QLayout * p = ( QGC_POINTER_QLayout * ) hb_gcAllocate( sizeof( QGC_POINTER_QLayout ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QLayout; + + if( bNew ) + { + new( & p->pq ) QPointer< QLayout >( ( QLayout * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QLayout ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QLAYOUT ) { } @@ -117,7 +141,7 @@ HB_FUNC( QT_QLAYOUT_ADDWIDGET ) */ HB_FUNC( QT_QLAYOUT_CONTENTSRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QLayout( 1 )->contentsRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QLayout( 1 )->contentsRect() ), true ) ); } /* @@ -175,7 +199,7 @@ HB_FUNC( QT_QLAYOUT_ISENABLED ) */ HB_FUNC( QT_QLAYOUT_ITEMAT ) { - hb_retptr( ( QLayoutItem* ) hbqt_par_QLayout( 1 )->itemAt( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLayoutItem( hbqt_par_QLayout( 1 )->itemAt( hb_parni( 2 ) ), false ) ); } /* @@ -183,7 +207,7 @@ HB_FUNC( QT_QLAYOUT_ITEMAT ) */ HB_FUNC( QT_QLAYOUT_MAXIMUMSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QLayout( 1 )->maximumSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QLayout( 1 )->maximumSize() ), true ) ); } /* @@ -191,7 +215,7 @@ HB_FUNC( QT_QLAYOUT_MAXIMUMSIZE ) */ HB_FUNC( QT_QLAYOUT_MENUBAR ) { - hb_retptr( ( QWidget* ) hbqt_par_QLayout( 1 )->menuBar() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QLayout( 1 )->menuBar(), false ) ); } /* @@ -199,7 +223,7 @@ HB_FUNC( QT_QLAYOUT_MENUBAR ) */ HB_FUNC( QT_QLAYOUT_MINIMUMSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QLayout( 1 )->minimumSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QLayout( 1 )->minimumSize() ), true ) ); } /* @@ -207,7 +231,7 @@ HB_FUNC( QT_QLAYOUT_MINIMUMSIZE ) */ HB_FUNC( QT_QLAYOUT_PARENTWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QLayout( 1 )->parentWidget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QLayout( 1 )->parentWidget(), false ) ); } /* @@ -311,7 +335,7 @@ HB_FUNC( QT_QLAYOUT_SPACING ) */ HB_FUNC( QT_QLAYOUT_TAKEAT ) { - hb_retptr( ( QLayoutItem* ) hbqt_par_QLayout( 1 )->takeAt( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLayoutItem( hbqt_par_QLayout( 1 )->takeAt( hb_parni( 2 ) ), false ) ); } /* @@ -327,7 +351,7 @@ HB_FUNC( QT_QLAYOUT_UPDATE ) */ HB_FUNC( QT_QLAYOUT_CLOSESTACCEPTABLESIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QLayout( 1 )->closestAcceptableSize( hbqt_par_QWidget( 2 ), *hbqt_par_QSize( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QLayout( 1 )->closestAcceptableSize( hbqt_par_QWidget( 2 ), *hbqt_par_QSize( 3 ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QLayoutItem.cpp b/harbour/contrib/hbqt/qtgui/QLayoutItem.cpp index 971308a121..736a53bb36 100644 --- a/harbour/contrib/hbqt/qtgui/QLayoutItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QLayoutItem.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -76,11 +76,33 @@ * virtual ~QLayoutItem () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QLayoutItem; + QT_G_FUNC( hbqt_gcRelease_QLayoutItem ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QLayoutItem( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QLayoutItem; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QLayoutItem ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QLAYOUTITEM ) { } @@ -113,7 +135,7 @@ HB_FUNC( QT_QLAYOUTITEM_EXPANDINGDIRECTIONS ) */ HB_FUNC( QT_QLAYOUTITEM_GEOMETRY ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QLayoutItem( 1 )->geometry() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QLayoutItem( 1 )->geometry() ), true ) ); } /* @@ -153,7 +175,7 @@ HB_FUNC( QT_QLAYOUTITEM_ISEMPTY ) */ HB_FUNC( QT_QLAYOUTITEM_LAYOUT ) { - hb_retptr( ( QLayout* ) hbqt_par_QLayoutItem( 1 )->layout() ); + hb_retptrGC( hbqt_gcAllocate_QLayout( hbqt_par_QLayoutItem( 1 )->layout(), false ) ); } /* @@ -161,7 +183,7 @@ HB_FUNC( QT_QLAYOUTITEM_LAYOUT ) */ HB_FUNC( QT_QLAYOUTITEM_MAXIMUMSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QLayoutItem( 1 )->maximumSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QLayoutItem( 1 )->maximumSize() ), true ) ); } /* @@ -177,7 +199,7 @@ HB_FUNC( QT_QLAYOUTITEM_MINIMUMHEIGHTFORWIDTH ) */ HB_FUNC( QT_QLAYOUTITEM_MINIMUMSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QLayoutItem( 1 )->minimumSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QLayoutItem( 1 )->minimumSize() ), true ) ); } /* @@ -201,7 +223,7 @@ HB_FUNC( QT_QLAYOUTITEM_SETGEOMETRY ) */ HB_FUNC( QT_QLAYOUTITEM_SIZEHINT ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QLayoutItem( 1 )->sizeHint() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QLayoutItem( 1 )->sizeHint() ), true ) ); } /* @@ -209,7 +231,7 @@ HB_FUNC( QT_QLAYOUTITEM_SIZEHINT ) */ HB_FUNC( QT_QLAYOUTITEM_SPACERITEM ) { - hb_retptr( ( QSpacerItem* ) hbqt_par_QLayoutItem( 1 )->spacerItem() ); + hb_retptrGC( hbqt_gcAllocate_QSpacerItem( hbqt_par_QLayoutItem( 1 )->spacerItem(), false ) ); } /* @@ -217,7 +239,7 @@ HB_FUNC( QT_QLAYOUTITEM_SPACERITEM ) */ HB_FUNC( QT_QLAYOUTITEM_WIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QLayoutItem( 1 )->widget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QLayoutItem( 1 )->widget(), false ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QLineEdit.cpp b/harbour/contrib/hbqt/qtgui/QLineEdit.cpp index fcb3fb2edb..df035e4b3d 100644 --- a/harbour/contrib/hbqt/qtgui/QLineEdit.cpp +++ b/harbour/contrib/hbqt/qtgui/QLineEdit.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -73,6 +73,7 @@ #include #include +#include /* @@ -84,6 +85,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QLineEdit > pq; } QGC_POINTER_QLineEdit; @@ -92,48 +94,47 @@ QT_G_FUNC( hbqt_gcRelease_QLineEdit ) { QGC_POINTER_QLineEdit * p = ( QGC_POINTER_QLineEdit * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLineEdit p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLineEdit ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QLineEdit * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QLineEdit * ) p->ph )->~QLineEdit(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QLineEdit * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QLineEdit ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QLineEdit ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLineEdit Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QLineEdit Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QLineEdit Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QLineEdit Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QLineEdit Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QLineEdit( void * pObj ) +void * hbqt_gcAllocate_QLineEdit( void * pObj, bool bNew ) { QGC_POINTER_QLineEdit * p = ( QGC_POINTER_QLineEdit * ) hb_gcAllocate( sizeof( QGC_POINTER_QLineEdit ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QLineEdit; - new( & p->pq ) QPointer< QLineEdit >( ( QLineEdit * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QLineEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QLineEdit >( ( QLineEdit * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QLineEdit ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -143,7 +144,7 @@ HB_FUNC( QT_QLINEEDIT ) pObj = ( QLineEdit* ) new QLineEdit( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QLineEdit( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QLineEdit( pObj, true ) ); } /* * Qt::Alignment alignment () const @@ -166,7 +167,7 @@ HB_FUNC( QT_QLINEEDIT_BACKSPACE ) */ HB_FUNC( QT_QLINEEDIT_COMPLETER ) { - hb_retptr( ( QCompleter* ) hbqt_par_QLineEdit( 1 )->completer() ); + hb_retptrGC( hbqt_gcAllocate_QCompleter( hbqt_par_QLineEdit( 1 )->completer(), false ) ); } /* @@ -174,7 +175,7 @@ HB_FUNC( QT_QLINEEDIT_COMPLETER ) */ HB_FUNC( QT_QLINEEDIT_CREATESTANDARDCONTEXTMENU ) { - hb_retptr( ( QMenu* ) hbqt_par_QLineEdit( 1 )->createStandardContextMenu() ); + hb_retptrGC( hbqt_gcAllocate_QMenu( hbqt_par_QLineEdit( 1 )->createStandardContextMenu(), false ) ); } /* @@ -384,7 +385,7 @@ HB_FUNC( QT_QLINEEDIT_MAXLENGTH ) */ HB_FUNC( QT_QLINEEDIT_MINIMUMSIZEHINT ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QLineEdit( 1 )->minimumSizeHint() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QLineEdit( 1 )->minimumSizeHint() ), true ) ); } /* @@ -512,7 +513,7 @@ HB_FUNC( QT_QLINEEDIT_SETVALIDATOR ) */ HB_FUNC( QT_QLINEEDIT_SIZEHINT ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QLineEdit( 1 )->sizeHint() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QLineEdit( 1 )->sizeHint() ), true ) ); } /* @@ -524,7 +525,7 @@ HB_FUNC( QT_QLINEEDIT_TEXT ) } /* - * const QValidator * validator () const + * virtual const QValidator * validator () const */ HB_FUNC( QT_QLINEEDIT_VALIDATOR ) { diff --git a/harbour/contrib/hbqt/qtgui/QLinearGradient.cpp b/harbour/contrib/hbqt/qtgui/QLinearGradient.cpp index f62741287f..adaf8868bc 100644 --- a/harbour/contrib/hbqt/qtgui/QLinearGradient.cpp +++ b/harbour/contrib/hbqt/qtgui/QLinearGradient.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -83,32 +83,49 @@ * QLinearGradient ( qreal x1, qreal y1, qreal x2, qreal y2 ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QLinearGradient; + QT_G_FUNC( hbqt_gcRelease_QLinearGradient ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLinearGradient p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QLinearGradient ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QLinearGradient * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QLinearGradient Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QLinearGradient * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QLinearGradient ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QLinearGradient Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QLinearGradient Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QLinearGradient Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QLinearGradient( void * pObj ) +void * hbqt_gcAllocate_QLinearGradient( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QLinearGradient; - HB_TRACE( HB_TR_DEBUG, ( " new_QLinearGradient %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QLinearGradient ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -133,14 +150,14 @@ HB_FUNC( QT_QLINEARGRADIENT ) pObj = ( QLinearGradient* ) new QLinearGradient() ; } - hb_retptrGC( hbqt_gcAllocate_QLinearGradient( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QLinearGradient( pObj, true ) ); } /* * QPointF finalStop () const */ HB_FUNC( QT_QLINEARGRADIENT_FINALSTOP ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QLinearGradient( 1 )->finalStop() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QLinearGradient( 1 )->finalStop() ), true ) ); } /* @@ -180,7 +197,7 @@ HB_FUNC( QT_QLINEARGRADIENT_SETSTART_1 ) */ HB_FUNC( QT_QLINEARGRADIENT_START ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QLinearGradient( 1 )->start() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QLinearGradient( 1 )->start() ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QListView.cpp b/harbour/contrib/hbqt/qtgui/QListView.cpp index 24e233c45d..5b15ff4522 100644 --- a/harbour/contrib/hbqt/qtgui/QListView.cpp +++ b/harbour/contrib/hbqt/qtgui/QListView.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -87,6 +87,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QListView > pq; } QGC_POINTER_QListView; @@ -95,48 +96,47 @@ QT_G_FUNC( hbqt_gcRelease_QListView ) { QGC_POINTER_QListView * p = ( QGC_POINTER_QListView * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QListView p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QListView ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QListView * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QListView * ) p->ph )->~QListView(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QListView * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QListView ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QListView ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QListView Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QListView Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QListView Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QListView Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QListView Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QListView( void * pObj ) +void * hbqt_gcAllocate_QListView( void * pObj, bool bNew ) { QGC_POINTER_QListView * p = ( QGC_POINTER_QListView * ) hb_gcAllocate( sizeof( QGC_POINTER_QListView ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QListView; - new( & p->pq ) QPointer< QListView >( ( QListView * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QListView %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QListView >( ( QListView * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QListView ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -146,7 +146,7 @@ HB_FUNC( QT_QLISTVIEW ) pObj = ( QListView * ) new QListView( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QListView( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QListView( pObj, true ) ); } /* * int batchSize () const @@ -177,7 +177,7 @@ HB_FUNC( QT_QLISTVIEW_FLOW ) */ HB_FUNC( QT_QLISTVIEW_GRIDSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QListView( 1 )->gridSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QListView( 1 )->gridSize() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QListWidget.cpp b/harbour/contrib/hbqt/qtgui/QListWidget.cpp index 3a3337ce28..940c26b588 100644 --- a/harbour/contrib/hbqt/qtgui/QListWidget.cpp +++ b/harbour/contrib/hbqt/qtgui/QListWidget.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -89,6 +89,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QListWidget > pq; } QGC_POINTER_QListWidget; @@ -97,48 +98,47 @@ QT_G_FUNC( hbqt_gcRelease_QListWidget ) { QGC_POINTER_QListWidget * p = ( QGC_POINTER_QListWidget * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QListWidget p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QListWidget ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QListWidget * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QListWidget * ) p->ph )->~QListWidget(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QListWidget * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QListWidget ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QListWidget ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QListWidget Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QListWidget Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QListWidget Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QListWidget Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QListWidget Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QListWidget( void * pObj ) +void * hbqt_gcAllocate_QListWidget( void * pObj, bool bNew ) { QGC_POINTER_QListWidget * p = ( QGC_POINTER_QListWidget * ) hb_gcAllocate( sizeof( QGC_POINTER_QListWidget ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QListWidget; - new( & p->pq ) QPointer< QListWidget >( ( QListWidget * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QListWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QListWidget >( ( QListWidget * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QListWidget ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -148,7 +148,7 @@ HB_FUNC( QT_QLISTWIDGET ) pObj = new QListWidget( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QListWidget( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QListWidget( pObj, true ) ); } /* * void addItem ( const QString & label ) @@ -195,7 +195,7 @@ HB_FUNC( QT_QLISTWIDGET_COUNT ) */ HB_FUNC( QT_QLISTWIDGET_CURRENTITEM ) { - hb_retptr( ( QListWidgetItem* ) hbqt_par_QListWidget( 1 )->currentItem() ); + hb_retptrGC( hbqt_gcAllocate_QListWidgetItem( hbqt_par_QListWidget( 1 )->currentItem(), false ) ); } /* @@ -251,7 +251,7 @@ HB_FUNC( QT_QLISTWIDGET_ISSORTINGENABLED ) */ HB_FUNC( QT_QLISTWIDGET_ITEM ) { - hb_retptr( ( QListWidgetItem* ) hbqt_par_QListWidget( 1 )->item( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QListWidgetItem( hbqt_par_QListWidget( 1 )->item( hb_parni( 2 ) ), false ) ); } /* @@ -259,7 +259,7 @@ HB_FUNC( QT_QLISTWIDGET_ITEM ) */ HB_FUNC( QT_QLISTWIDGET_ITEMAT ) { - hb_retptr( ( QListWidgetItem* ) hbqt_par_QListWidget( 1 )->itemAt( *hbqt_par_QPoint( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QListWidgetItem( hbqt_par_QListWidget( 1 )->itemAt( *hbqt_par_QPoint( 2 ) ), false ) ); } /* @@ -267,7 +267,7 @@ HB_FUNC( QT_QLISTWIDGET_ITEMAT ) */ HB_FUNC( QT_QLISTWIDGET_ITEMAT_1 ) { - hb_retptr( ( QListWidgetItem* ) hbqt_par_QListWidget( 1 )->itemAt( hb_parni( 2 ), hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QListWidgetItem( hbqt_par_QListWidget( 1 )->itemAt( hb_parni( 2 ), hb_parni( 3 ) ), false ) ); } /* @@ -275,7 +275,7 @@ HB_FUNC( QT_QLISTWIDGET_ITEMAT_1 ) */ HB_FUNC( QT_QLISTWIDGET_ITEMWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QListWidget( 1 )->itemWidget( hbqt_par_QListWidgetItem( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QListWidget( 1 )->itemWidget( hbqt_par_QListWidgetItem( 2 ) ), false ) ); } /* @@ -363,7 +363,7 @@ HB_FUNC( QT_QLISTWIDGET_SORTITEMS ) */ HB_FUNC( QT_QLISTWIDGET_TAKEITEM ) { - hb_retptr( ( QListWidgetItem* ) hbqt_par_QListWidget( 1 )->takeItem( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QListWidgetItem( hbqt_par_QListWidget( 1 )->takeItem( hb_parni( 2 ) ), false ) ); } /* @@ -371,7 +371,7 @@ HB_FUNC( QT_QLISTWIDGET_TAKEITEM ) */ HB_FUNC( QT_QLISTWIDGET_VISUALITEMRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QListWidget( 1 )->visualItemRect( hbqt_par_QListWidgetItem( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QListWidget( 1 )->visualItemRect( hbqt_par_QListWidgetItem( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QListWidgetItem.cpp b/harbour/contrib/hbqt/qtgui/QListWidgetItem.cpp index 96ba9bf789..396eb6d6c7 100644 --- a/harbour/contrib/hbqt/qtgui/QListWidgetItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QListWidgetItem.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -83,32 +83,49 @@ * virtual ~QListWidgetItem () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QListWidgetItem; + QT_G_FUNC( hbqt_gcRelease_QListWidgetItem ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QListWidgetItem p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QListWidgetItem ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QListWidgetItem * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QListWidgetItem Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QListWidgetItem * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QListWidgetItem ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QListWidgetItem Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QListWidgetItem Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QListWidgetItem Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QListWidgetItem( void * pObj ) +void * hbqt_gcAllocate_QListWidgetItem( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QListWidgetItem; - HB_TRACE( HB_TR_DEBUG, ( " new_QListWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QListWidgetItem ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -118,14 +135,14 @@ HB_FUNC( QT_QLISTWIDGETITEM ) pObj = new QListWidgetItem( hbqt_par_QListWidget( 1 ), hb_parni( 2 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QListWidgetItem( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QListWidgetItem( pObj, true ) ); } /* * QBrush background () const */ HB_FUNC( QT_QLISTWIDGETITEM_BACKGROUND ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QListWidgetItem( 1 )->background() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QListWidgetItem( 1 )->background() ), true ) ); } /* @@ -141,7 +158,7 @@ HB_FUNC( QT_QLISTWIDGETITEM_CHECKSTATE ) */ HB_FUNC( QT_QLISTWIDGETITEM_CLONE ) { - hb_retptr( ( QListWidgetItem* ) hbqt_par_QListWidgetItem( 1 )->clone() ); + hb_retptrGC( hbqt_gcAllocate_QListWidgetItem( hbqt_par_QListWidgetItem( 1 )->clone(), false ) ); } /* @@ -149,7 +166,7 @@ HB_FUNC( QT_QLISTWIDGETITEM_CLONE ) */ HB_FUNC( QT_QLISTWIDGETITEM_DATA ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QListWidgetItem( 1 )->data( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QListWidgetItem( 1 )->data( hb_parni( 2 ) ) ), true ) ); } /* @@ -165,7 +182,7 @@ HB_FUNC( QT_QLISTWIDGETITEM_FLAGS ) */ HB_FUNC( QT_QLISTWIDGETITEM_FONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QListWidgetItem( 1 )->font() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QListWidgetItem( 1 )->font() ), true ) ); } /* @@ -173,7 +190,7 @@ HB_FUNC( QT_QLISTWIDGETITEM_FONT ) */ HB_FUNC( QT_QLISTWIDGETITEM_FOREGROUND ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QListWidgetItem( 1 )->foreground() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QListWidgetItem( 1 )->foreground() ), true ) ); } /* @@ -181,7 +198,7 @@ HB_FUNC( QT_QLISTWIDGETITEM_FOREGROUND ) */ HB_FUNC( QT_QLISTWIDGETITEM_ICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QListWidgetItem( 1 )->icon() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QListWidgetItem( 1 )->icon() ), true ) ); } /* @@ -205,7 +222,7 @@ HB_FUNC( QT_QLISTWIDGETITEM_ISSELECTED ) */ HB_FUNC( QT_QLISTWIDGETITEM_LISTWIDGET ) { - hb_retptr( ( QListWidget* ) hbqt_par_QListWidgetItem( 1 )->listWidget() ); + hb_retptrGC( hbqt_gcAllocate_QListWidget( hbqt_par_QListWidgetItem( 1 )->listWidget(), false ) ); } /* @@ -341,7 +358,7 @@ HB_FUNC( QT_QLISTWIDGETITEM_SETWHATSTHIS ) */ HB_FUNC( QT_QLISTWIDGETITEM_SIZEHINT ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QListWidgetItem( 1 )->sizeHint() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QListWidgetItem( 1 )->sizeHint() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QMainWindow.cpp b/harbour/contrib/hbqt/qtgui/QMainWindow.cpp index b02ff88fcc..e946a4eaed 100644 --- a/harbour/contrib/hbqt/qtgui/QMainWindow.cpp +++ b/harbour/contrib/hbqt/qtgui/QMainWindow.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -108,6 +108,7 @@ HB_FUNC( HBQT_QMAINWINDOW_RESTSETTINGS ) typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QMainWindow > pq; } QGC_POINTER_QMainWindow; @@ -116,48 +117,47 @@ QT_G_FUNC( hbqt_gcRelease_QMainWindow ) { QGC_POINTER_QMainWindow * p = ( QGC_POINTER_QMainWindow * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMainWindow p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMainWindow ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QMainWindow * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QMainWindow * ) p->ph )->~QMainWindow(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QMainWindow * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QMainWindow ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QMainWindow ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMainWindow Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QMainWindow Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QMainWindow Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QMainWindow Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QMainWindow Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QMainWindow( void * pObj ) +void * hbqt_gcAllocate_QMainWindow( void * pObj, bool bNew ) { QGC_POINTER_QMainWindow * p = ( QGC_POINTER_QMainWindow * ) hb_gcAllocate( sizeof( QGC_POINTER_QMainWindow ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QMainWindow; - new( & p->pq ) QPointer< QMainWindow >( ( QMainWindow * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QMainWindow %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QMainWindow >( ( QMainWindow * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QMainWindow ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -167,7 +167,7 @@ HB_FUNC( QT_QMAINWINDOW ) pObj = ( QMainWindow* ) new QMainWindow( hbqt_par_QWidget( 1 ), ( Qt::WindowFlags ) hb_parni( 2 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QMainWindow( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QMainWindow( pObj, true ) ); } /* * void addDockWidget ( Qt::DockWidgetArea area, QDockWidget * dockwidget ) @@ -206,7 +206,7 @@ HB_FUNC( QT_QMAINWINDOW_ADDTOOLBAR_1 ) */ HB_FUNC( QT_QMAINWINDOW_ADDTOOLBAR_2 ) { - hb_retptr( ( QToolBar* ) hbqt_par_QMainWindow( 1 )->addToolBar( QMainWindow::tr( hb_parc( 2 ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QToolBar( hbqt_par_QMainWindow( 1 )->addToolBar( QMainWindow::tr( hb_parc( 2 ) ) ), false ) ); } /* @@ -222,7 +222,7 @@ HB_FUNC( QT_QMAINWINDOW_ADDTOOLBARBREAK ) */ HB_FUNC( QT_QMAINWINDOW_CENTRALWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QMainWindow( 1 )->centralWidget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QMainWindow( 1 )->centralWidget(), false ) ); } /* @@ -238,7 +238,7 @@ HB_FUNC( QT_QMAINWINDOW_CORNER ) */ HB_FUNC( QT_QMAINWINDOW_CREATEPOPUPMENU ) { - hb_retptr( ( QMenu* ) hbqt_par_QMainWindow( 1 )->createPopupMenu() ); + hb_retptrGC( hbqt_gcAllocate_QMenu( hbqt_par_QMainWindow( 1 )->createPopupMenu(), false ) ); } /* @@ -270,7 +270,7 @@ HB_FUNC( QT_QMAINWINDOW_DOCUMENTMODE ) */ HB_FUNC( QT_QMAINWINDOW_ICONSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QMainWindow( 1 )->iconSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QMainWindow( 1 )->iconSize() ), true ) ); } /* @@ -310,7 +310,7 @@ HB_FUNC( QT_QMAINWINDOW_ISDOCKNESTINGENABLED ) */ HB_FUNC( QT_QMAINWINDOW_MENUBAR ) { - hb_retptr( ( QMenuBar* ) hbqt_par_QMainWindow( 1 )->menuBar() ); + hb_retptrGC( hbqt_gcAllocate_QMenuBar( hbqt_par_QMainWindow( 1 )->menuBar(), false ) ); } /* @@ -318,7 +318,7 @@ HB_FUNC( QT_QMAINWINDOW_MENUBAR ) */ HB_FUNC( QT_QMAINWINDOW_MENUWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QMainWindow( 1 )->menuWidget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QMainWindow( 1 )->menuWidget(), false ) ); } /* @@ -366,7 +366,7 @@ HB_FUNC( QT_QMAINWINDOW_RESTORESTATE ) */ HB_FUNC( QT_QMAINWINDOW_SAVESTATE ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QMainWindow( 1 )->saveState( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QMainWindow( 1 )->saveState( hb_parni( 2 ) ) ), true ) ); } /* @@ -478,7 +478,7 @@ HB_FUNC( QT_QMAINWINDOW_SPLITDOCKWIDGET ) */ HB_FUNC( QT_QMAINWINDOW_STATUSBAR ) { - hb_retptr( ( QStatusBar* ) hbqt_par_QMainWindow( 1 )->statusBar() ); + hb_retptrGC( hbqt_gcAllocate_QStatusBar( hbqt_par_QMainWindow( 1 )->statusBar(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QMatrix.cpp b/harbour/contrib/hbqt/qtgui/QMatrix.cpp index 3fb8c1c515..f87eb5b82f 100644 --- a/harbour/contrib/hbqt/qtgui/QMatrix.cpp +++ b/harbour/contrib/hbqt/qtgui/QMatrix.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -77,32 +77,49 @@ * QMatrix ( const QMatrix & matrix ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QMatrix; + QT_G_FUNC( hbqt_gcRelease_QMatrix ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMatrix p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMatrix ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QMatrix * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QMatrix Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QMatrix * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QMatrix ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QMatrix Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QMatrix Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QMatrix Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QMatrix( void * pObj ) +void * hbqt_gcAllocate_QMatrix( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QMatrix; - HB_TRACE( HB_TR_DEBUG, ( " new_QMatrix %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QMatrix ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -112,7 +129,7 @@ HB_FUNC( QT_QMATRIX ) pObj = new QMatrix() ; - hb_retptrGC( hbqt_gcAllocate_QMatrix( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QMatrix( pObj, true ) ); } /* * qreal m11 () const @@ -177,7 +194,7 @@ HB_FUNC( QT_QMATRIX_INVERTED ) { bool iInvertible = 0; - hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QMatrix( 1 )->inverted( &iInvertible ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QMatrix( 1 )->inverted( &iInvertible ) ), true ) ); hb_stornl( iInvertible, 2 ); } @@ -231,7 +248,7 @@ HB_FUNC( QT_QMATRIX_MAP_1 ) */ HB_FUNC( QT_QMATRIX_MAP_2 ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPointF( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPointF( 2 ) ) ), true ) ); } /* @@ -239,7 +256,7 @@ HB_FUNC( QT_QMATRIX_MAP_2 ) */ HB_FUNC( QT_QMATRIX_MAP_3 ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPoint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPoint( 2 ) ) ), true ) ); } /* @@ -247,7 +264,7 @@ HB_FUNC( QT_QMATRIX_MAP_3 ) */ HB_FUNC( QT_QMATRIX_MAP_4 ) { - hb_retptrGC( hbqt_gcAllocate_QLineF( new QLineF( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QLineF( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLineF( new QLineF( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QLineF( 2 ) ) ), true ) ); } /* @@ -255,7 +272,7 @@ HB_FUNC( QT_QMATRIX_MAP_4 ) */ HB_FUNC( QT_QMATRIX_MAP_5 ) { - hb_retptrGC( hbqt_gcAllocate_QLine( new QLine( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QLine( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLine( new QLine( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QLine( 2 ) ) ), true ) ); } /* @@ -263,7 +280,7 @@ HB_FUNC( QT_QMATRIX_MAP_5 ) */ HB_FUNC( QT_QMATRIX_MAP_6 ) { - hb_retptrGC( hbqt_gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPolygonF( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPolygonF( 2 ) ) ), true ) ); } /* @@ -271,7 +288,7 @@ HB_FUNC( QT_QMATRIX_MAP_6 ) */ HB_FUNC( QT_QMATRIX_MAP_7 ) { - hb_retptrGC( hbqt_gcAllocate_QPolygon( new QPolygon( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPolygon( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPolygon( new QPolygon( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPolygon( 2 ) ) ), true ) ); } /* @@ -279,7 +296,7 @@ HB_FUNC( QT_QMATRIX_MAP_7 ) */ HB_FUNC( QT_QMATRIX_MAP_8 ) { - hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QRegion( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QRegion( 2 ) ) ), true ) ); } /* @@ -287,7 +304,7 @@ HB_FUNC( QT_QMATRIX_MAP_8 ) */ HB_FUNC( QT_QMATRIX_MAP_9 ) { - hb_retptrGC( hbqt_gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPainterPath( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QMatrix( 1 )->map( *hbqt_par_QPainterPath( 2 ) ) ), true ) ); } /* @@ -295,7 +312,7 @@ HB_FUNC( QT_QMATRIX_MAP_9 ) */ HB_FUNC( QT_QMATRIX_MAPRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QMatrix( 1 )->mapRect( *hbqt_par_QRectF( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QMatrix( 1 )->mapRect( *hbqt_par_QRectF( 2 ) ) ), true ) ); } /* @@ -303,7 +320,7 @@ HB_FUNC( QT_QMATRIX_MAPRECT ) */ HB_FUNC( QT_QMATRIX_MAPRECT_1 ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QMatrix( 1 )->mapRect( *hbqt_par_QRect( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QMatrix( 1 )->mapRect( *hbqt_par_QRect( 2 ) ) ), true ) ); } /* @@ -311,7 +328,7 @@ HB_FUNC( QT_QMATRIX_MAPRECT_1 ) */ HB_FUNC( QT_QMATRIX_MAPTOPOLYGON ) { - hb_retptrGC( hbqt_gcAllocate_QPolygon( new QPolygon( hbqt_par_QMatrix( 1 )->mapToPolygon( *hbqt_par_QRect( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPolygon( new QPolygon( hbqt_par_QMatrix( 1 )->mapToPolygon( *hbqt_par_QRect( 2 ) ) ), true ) ); } /* @@ -327,7 +344,7 @@ HB_FUNC( QT_QMATRIX_RESET ) */ HB_FUNC( QT_QMATRIX_ROTATE ) { - hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QMatrix( 1 )->rotate( hb_parnd( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QMatrix( 1 )->rotate( hb_parnd( 2 ) ) ), true ) ); } /* @@ -335,7 +352,7 @@ HB_FUNC( QT_QMATRIX_ROTATE ) */ HB_FUNC( QT_QMATRIX_SCALE ) { - hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QMatrix( 1 )->scale( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QMatrix( 1 )->scale( hb_parnd( 2 ), hb_parnd( 3 ) ) ), true ) ); } /* @@ -351,7 +368,7 @@ HB_FUNC( QT_QMATRIX_SETMATRIX ) */ HB_FUNC( QT_QMATRIX_SHEAR ) { - hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QMatrix( 1 )->shear( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QMatrix( 1 )->shear( hb_parnd( 2 ), hb_parnd( 3 ) ) ), true ) ); } /* @@ -359,7 +376,7 @@ HB_FUNC( QT_QMATRIX_SHEAR ) */ HB_FUNC( QT_QMATRIX_TRANSLATE ) { - hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QMatrix( 1 )->translate( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QMatrix( 1 )->translate( hb_parnd( 2 ), hb_parnd( 3 ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QMdiArea.cpp b/harbour/contrib/hbqt/qtgui/QMdiArea.cpp index 1b27ce6865..577820d154 100644 --- a/harbour/contrib/hbqt/qtgui/QMdiArea.cpp +++ b/harbour/contrib/hbqt/qtgui/QMdiArea.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -96,6 +96,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QMdiArea > pq; } QGC_POINTER_QMdiArea; @@ -104,48 +105,47 @@ QT_G_FUNC( hbqt_gcRelease_QMdiArea ) { QGC_POINTER_QMdiArea * p = ( QGC_POINTER_QMdiArea * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMdiArea p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMdiArea ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QMdiArea * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QMdiArea * ) p->ph )->~QMdiArea(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QMdiArea * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QMdiArea ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QMdiArea ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMdiArea Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QMdiArea Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QMdiArea Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QMdiArea Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QMdiArea Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QMdiArea( void * pObj ) +void * hbqt_gcAllocate_QMdiArea( void * pObj, bool bNew ) { QGC_POINTER_QMdiArea * p = ( QGC_POINTER_QMdiArea * ) hb_gcAllocate( sizeof( QGC_POINTER_QMdiArea ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QMdiArea; - new( & p->pq ) QPointer< QMdiArea >( ( QMdiArea * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QMdiArea %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QMdiArea >( ( QMdiArea * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QMdiArea ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -162,7 +162,7 @@ HB_FUNC( QT_QMDIAREA ) pObj = new QMdiArea() ; } - hb_retptrGC( hbqt_gcAllocate_QMdiArea( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QMdiArea( pObj, true ) ); } /* * WindowOrder activationOrder () const @@ -177,7 +177,7 @@ HB_FUNC( QT_QMDIAREA_ACTIVATIONORDER ) */ HB_FUNC( QT_QMDIAREA_ACTIVESUBWINDOW ) { - hb_retptr( ( QMdiSubWindow* ) hbqt_par_QMdiArea( 1 )->activeSubWindow() ); + hb_retptrGC( hbqt_gcAllocate_QMdiSubWindow( hbqt_par_QMdiArea( 1 )->activeSubWindow(), false ) ); } /* @@ -185,7 +185,7 @@ HB_FUNC( QT_QMDIAREA_ACTIVESUBWINDOW ) */ HB_FUNC( QT_QMDIAREA_ADDSUBWINDOW ) { - hb_retptr( ( QMdiSubWindow* ) hbqt_par_QMdiArea( 1 )->addSubWindow( hbqt_par_QWidget( 2 ), ( Qt::WindowFlags ) hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QMdiSubWindow( hbqt_par_QMdiArea( 1 )->addSubWindow( hbqt_par_QWidget( 2 ), ( Qt::WindowFlags ) hb_parni( 3 ) ), false ) ); } /* @@ -193,7 +193,7 @@ HB_FUNC( QT_QMDIAREA_ADDSUBWINDOW ) */ HB_FUNC( QT_QMDIAREA_BACKGROUND ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QMdiArea( 1 )->background() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QMdiArea( 1 )->background() ), true ) ); } /* @@ -201,7 +201,7 @@ HB_FUNC( QT_QMDIAREA_BACKGROUND ) */ HB_FUNC( QT_QMDIAREA_CURRENTSUBWINDOW ) { - hb_retptr( ( QMdiSubWindow* ) hbqt_par_QMdiArea( 1 )->currentSubWindow() ); + hb_retptrGC( hbqt_gcAllocate_QMdiSubWindow( hbqt_par_QMdiArea( 1 )->currentSubWindow(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QMdiSubWindow.cpp b/harbour/contrib/hbqt/qtgui/QMdiSubWindow.cpp index 4ce7597ed5..74b2fce25a 100644 --- a/harbour/contrib/hbqt/qtgui/QMdiSubWindow.cpp +++ b/harbour/contrib/hbqt/qtgui/QMdiSubWindow.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -85,6 +85,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QMdiSubWindow > pq; } QGC_POINTER_QMdiSubWindow; @@ -93,48 +94,47 @@ QT_G_FUNC( hbqt_gcRelease_QMdiSubWindow ) { QGC_POINTER_QMdiSubWindow * p = ( QGC_POINTER_QMdiSubWindow * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMdiSubWindow p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMdiSubWindow ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QMdiSubWindow * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QMdiSubWindow * ) p->ph )->~QMdiSubWindow(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QMdiSubWindow * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QMdiSubWindow ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QMdiSubWindow ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMdiSubWindow Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QMdiSubWindow Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QMdiSubWindow Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QMdiSubWindow Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QMdiSubWindow Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QMdiSubWindow( void * pObj ) +void * hbqt_gcAllocate_QMdiSubWindow( void * pObj, bool bNew ) { QGC_POINTER_QMdiSubWindow * p = ( QGC_POINTER_QMdiSubWindow * ) hb_gcAllocate( sizeof( QGC_POINTER_QMdiSubWindow ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QMdiSubWindow; - new( & p->pq ) QPointer< QMdiSubWindow >( ( QMdiSubWindow * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QMdiSubWindow %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QMdiSubWindow >( ( QMdiSubWindow * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QMdiSubWindow ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -151,7 +151,7 @@ HB_FUNC( QT_QMDISUBWINDOW ) pObj = new QMdiSubWindow() ; } - hb_retptrGC( hbqt_gcAllocate_QMdiSubWindow( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QMdiSubWindow( pObj, true ) ); } /* * bool isShaded () const @@ -182,7 +182,7 @@ HB_FUNC( QT_QMDISUBWINDOW_KEYBOARDSINGLESTEP ) */ HB_FUNC( QT_QMDISUBWINDOW_MDIAREA ) { - hb_retptr( ( QMdiArea* ) hbqt_par_QMdiSubWindow( 1 )->mdiArea() ); + hb_retptrGC( hbqt_gcAllocate_QMdiArea( hbqt_par_QMdiSubWindow( 1 )->mdiArea(), false ) ); } /* @@ -230,7 +230,7 @@ HB_FUNC( QT_QMDISUBWINDOW_SETWIDGET ) */ HB_FUNC( QT_QMDISUBWINDOW_SYSTEMMENU ) { - hb_retptr( ( QMenu* ) hbqt_par_QMdiSubWindow( 1 )->systemMenu() ); + hb_retptrGC( hbqt_gcAllocate_QMenu( hbqt_par_QMdiSubWindow( 1 )->systemMenu(), false ) ); } /* @@ -246,7 +246,7 @@ HB_FUNC( QT_QMDISUBWINDOW_TESTOPTION ) */ HB_FUNC( QT_QMDISUBWINDOW_WIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QMdiSubWindow( 1 )->widget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QMdiSubWindow( 1 )->widget(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QMenu.cpp b/harbour/contrib/hbqt/qtgui/QMenu.cpp index 8508361bc4..3f61b263e1 100644 --- a/harbour/contrib/hbqt/qtgui/QMenu.cpp +++ b/harbour/contrib/hbqt/qtgui/QMenu.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,6 +80,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QMenu > pq; } QGC_POINTER_QMenu; @@ -88,48 +89,47 @@ QT_G_FUNC( hbqt_gcRelease_QMenu ) { QGC_POINTER_QMenu * p = ( QGC_POINTER_QMenu * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMenu p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMenu ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QMenu * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QMenu * ) p->ph )->~QMenu(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QMenu * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QMenu ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QMenu ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMenu Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QMenu Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QMenu Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QMenu Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QMenu Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QMenu( void * pObj ) +void * hbqt_gcAllocate_QMenu( void * pObj, bool bNew ) { QGC_POINTER_QMenu * p = ( QGC_POINTER_QMenu * ) hb_gcAllocate( sizeof( QGC_POINTER_QMenu ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QMenu; - new( & p->pq ) QPointer< QMenu >( ( QMenu * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QMenu %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QMenu >( ( QMenu * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QMenu ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -146,14 +146,14 @@ HB_FUNC( QT_QMENU ) pObj = ( QMenu* ) new QMenu( hbqt_par_QWidget( 1 ) ) ; } - hb_retptrGC( hbqt_gcAllocate_QMenu( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QMenu( pObj, true ) ); } /* * QAction * actionAt ( const QPoint & pt ) const */ HB_FUNC( QT_QMENU_ACTIONAT ) { - hb_retptr( ( QAction* ) hbqt_par_QMenu( 1 )->actionAt( *hbqt_par_QPoint( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenu( 1 )->actionAt( *hbqt_par_QPoint( 2 ) ), false ) ); } /* @@ -161,7 +161,7 @@ HB_FUNC( QT_QMENU_ACTIONAT ) */ HB_FUNC( QT_QMENU_ACTIONGEOMETRY ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QMenu( 1 )->actionGeometry( hbqt_par_QAction( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QMenu( 1 )->actionGeometry( hbqt_par_QAction( 2 ) ) ), true ) ); } /* @@ -169,7 +169,7 @@ HB_FUNC( QT_QMENU_ACTIONGEOMETRY ) */ HB_FUNC( QT_QMENU_ACTIVEACTION ) { - hb_retptr( ( QAction* ) hbqt_par_QMenu( 1 )->activeAction() ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenu( 1 )->activeAction(), false ) ); } /* @@ -177,7 +177,7 @@ HB_FUNC( QT_QMENU_ACTIVEACTION ) */ HB_FUNC( QT_QMENU_ADDACTION ) { - hb_retptr( ( QAction* ) hbqt_par_QMenu( 1 )->addAction( QMenu::tr( hb_parc( 2 ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenu( 1 )->addAction( QMenu::tr( hb_parc( 2 ) ) ), false ) ); } /* @@ -185,7 +185,7 @@ HB_FUNC( QT_QMENU_ADDACTION ) */ HB_FUNC( QT_QMENU_ADDACTION_1 ) { - hb_retptr( ( QAction* ) hbqt_par_QMenu( 1 )->addAction( QIcon( hbqt_par_QString( 2 ) ), QMenu::tr( hb_parc( 3 ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenu( 1 )->addAction( QIcon( hbqt_par_QString( 2 ) ), QMenu::tr( hb_parc( 3 ) ) ), false ) ); } /* @@ -193,7 +193,7 @@ HB_FUNC( QT_QMENU_ADDACTION_1 ) */ HB_FUNC( QT_QMENU_ADDACTION_2 ) { - hb_retptr( ( QAction* ) hbqt_par_QMenu( 1 )->addAction( QMenu::tr( hb_parc( 2 ) ), hbqt_par_QObject( 3 ), hbqt_par_char( 4 ), *hbqt_par_QKeySequence( 5 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenu( 1 )->addAction( QMenu::tr( hb_parc( 2 ) ), hbqt_par_QObject( 3 ), hbqt_par_char( 4 ), *hbqt_par_QKeySequence( 5 ) ), false ) ); } /* @@ -201,7 +201,7 @@ HB_FUNC( QT_QMENU_ADDACTION_2 ) */ HB_FUNC( QT_QMENU_ADDACTION_3 ) { - hb_retptr( ( QAction* ) hbqt_par_QMenu( 1 )->addAction( QIcon( hbqt_par_QString( 2 ) ), QMenu::tr( hb_parc( 3 ) ), hbqt_par_QObject( 4 ), hbqt_par_char( 5 ), *hbqt_par_QKeySequence( 6 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenu( 1 )->addAction( QIcon( hbqt_par_QString( 2 ) ), QMenu::tr( hb_parc( 3 ) ), hbqt_par_QObject( 4 ), hbqt_par_char( 5 ), *hbqt_par_QKeySequence( 6 ) ), false ) ); } /* @@ -217,7 +217,7 @@ HB_FUNC( QT_QMENU_ADDACTION_4 ) */ HB_FUNC( QT_QMENU_ADDMENU ) { - hb_retptr( ( QAction* ) hbqt_par_QMenu( 1 )->addMenu( hbqt_par_QMenu( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenu( 1 )->addMenu( hbqt_par_QMenu( 2 ) ), false ) ); } /* @@ -225,7 +225,7 @@ HB_FUNC( QT_QMENU_ADDMENU ) */ HB_FUNC( QT_QMENU_ADDMENU_1 ) { - hb_retptr( ( QMenu* ) hbqt_par_QMenu( 1 )->addMenu( QMenu::tr( hb_parc( 2 ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QMenu( hbqt_par_QMenu( 1 )->addMenu( QMenu::tr( hb_parc( 2 ) ) ), false ) ); } /* @@ -233,7 +233,7 @@ HB_FUNC( QT_QMENU_ADDMENU_1 ) */ HB_FUNC( QT_QMENU_ADDMENU_2 ) { - hb_retptr( ( QMenu* ) hbqt_par_QMenu( 1 )->addMenu( QIcon( hbqt_par_QString( 2 ) ), QMenu::tr( hb_parc( 3 ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QMenu( hbqt_par_QMenu( 1 )->addMenu( QIcon( hbqt_par_QString( 2 ) ), QMenu::tr( hb_parc( 3 ) ) ), false ) ); } /* @@ -241,7 +241,7 @@ HB_FUNC( QT_QMENU_ADDMENU_2 ) */ HB_FUNC( QT_QMENU_ADDSEPARATOR ) { - hb_retptr( ( QAction* ) hbqt_par_QMenu( 1 )->addSeparator() ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenu( 1 )->addSeparator(), false ) ); } /* @@ -257,7 +257,7 @@ HB_FUNC( QT_QMENU_CLEAR ) */ HB_FUNC( QT_QMENU_DEFAULTACTION ) { - hb_retptr( ( QAction* ) hbqt_par_QMenu( 1 )->defaultAction() ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenu( 1 )->defaultAction(), false ) ); } /* @@ -265,7 +265,7 @@ HB_FUNC( QT_QMENU_DEFAULTACTION ) */ HB_FUNC( QT_QMENU_EXEC ) { - hb_retptr( ( QAction* ) hbqt_par_QMenu( 1 )->exec() ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenu( 1 )->exec(), false ) ); } /* @@ -273,7 +273,7 @@ HB_FUNC( QT_QMENU_EXEC ) */ HB_FUNC( QT_QMENU_EXEC_1 ) { - hb_retptr( ( QAction* ) hbqt_par_QMenu( 1 )->exec( *hbqt_par_QPoint( 2 ), hbqt_par_QAction( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenu( 1 )->exec( *hbqt_par_QPoint( 2 ), hbqt_par_QAction( 3 ) ), false ) ); } /* @@ -289,7 +289,7 @@ HB_FUNC( QT_QMENU_HIDETEAROFFMENU ) */ HB_FUNC( QT_QMENU_ICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QMenu( 1 )->icon() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QMenu( 1 )->icon() ), true ) ); } /* @@ -297,7 +297,7 @@ HB_FUNC( QT_QMENU_ICON ) */ HB_FUNC( QT_QMENU_INSERTMENU ) { - hb_retptr( ( QAction* ) hbqt_par_QMenu( 1 )->insertMenu( hbqt_par_QAction( 2 ), hbqt_par_QMenu( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenu( 1 )->insertMenu( hbqt_par_QAction( 2 ), hbqt_par_QMenu( 3 ) ), false ) ); } /* @@ -305,7 +305,7 @@ HB_FUNC( QT_QMENU_INSERTMENU ) */ HB_FUNC( QT_QMENU_INSERTSEPARATOR ) { - hb_retptr( ( QAction* ) hbqt_par_QMenu( 1 )->insertSeparator( hbqt_par_QAction( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenu( 1 )->insertSeparator( hbqt_par_QAction( 2 ) ), false ) ); } /* @@ -337,7 +337,7 @@ HB_FUNC( QT_QMENU_ISTEAROFFMENUVISIBLE ) */ HB_FUNC( QT_QMENU_MENUACTION ) { - hb_retptr( ( QAction* ) hbqt_par_QMenu( 1 )->menuAction() ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenu( 1 )->menuAction(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QMenuBar.cpp b/harbour/contrib/hbqt/qtgui/QMenuBar.cpp index da1a7326c9..3b8234a8c5 100644 --- a/harbour/contrib/hbqt/qtgui/QMenuBar.cpp +++ b/harbour/contrib/hbqt/qtgui/QMenuBar.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QMenuBar > pq; } QGC_POINTER_QMenuBar; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QMenuBar ) { QGC_POINTER_QMenuBar * p = ( QGC_POINTER_QMenuBar * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMenuBar p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMenuBar ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QMenuBar * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QMenuBar * ) p->ph )->~QMenuBar(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QMenuBar * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QMenuBar ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QMenuBar ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMenuBar Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QMenuBar Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QMenuBar Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QMenuBar Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QMenuBar Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QMenuBar( void * pObj ) +void * hbqt_gcAllocate_QMenuBar( void * pObj, bool bNew ) { QGC_POINTER_QMenuBar * p = ( QGC_POINTER_QMenuBar * ) hb_gcAllocate( sizeof( QGC_POINTER_QMenuBar ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QMenuBar; - new( & p->pq ) QPointer< QMenuBar >( ( QMenuBar * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QMenuBar %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QMenuBar >( ( QMenuBar * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QMenuBar ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -138,14 +138,14 @@ HB_FUNC( QT_QMENUBAR ) pObj = ( QMenuBar* ) new QMenuBar( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QMenuBar( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QMenuBar( pObj, true ) ); } /* * QAction * activeAction () const */ HB_FUNC( QT_QMENUBAR_ACTIVEACTION ) { - hb_retptr( ( QAction* ) hbqt_par_QMenuBar( 1 )->activeAction() ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenuBar( 1 )->activeAction(), false ) ); } /* @@ -153,7 +153,7 @@ HB_FUNC( QT_QMENUBAR_ACTIVEACTION ) */ HB_FUNC( QT_QMENUBAR_ADDACTION ) { - hb_retptr( ( QAction* ) hbqt_par_QMenuBar( 1 )->addAction( QMenuBar::tr( hb_parc( 2 ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenuBar( 1 )->addAction( QMenuBar::tr( hb_parc( 2 ) ) ), false ) ); } /* @@ -161,7 +161,7 @@ HB_FUNC( QT_QMENUBAR_ADDACTION ) */ HB_FUNC( QT_QMENUBAR_ADDACTION_1 ) { - hb_retptr( ( QAction* ) hbqt_par_QMenuBar( 1 )->addAction( QMenuBar::tr( hb_parc( 2 ) ), hbqt_par_QObject( 3 ), hbqt_par_char( 4 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenuBar( 1 )->addAction( QMenuBar::tr( hb_parc( 2 ) ), hbqt_par_QObject( 3 ), hbqt_par_char( 4 ) ), false ) ); } /* @@ -177,7 +177,7 @@ HB_FUNC( QT_QMENUBAR_ADDACTION_2 ) */ HB_FUNC( QT_QMENUBAR_ADDMENU ) { - hb_retptr( ( QAction* ) hbqt_par_QMenuBar( 1 )->addMenu( hbqt_par_QMenu( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenuBar( 1 )->addMenu( hbqt_par_QMenu( 2 ) ), false ) ); } /* @@ -185,7 +185,7 @@ HB_FUNC( QT_QMENUBAR_ADDMENU ) */ HB_FUNC( QT_QMENUBAR_ADDMENU_1 ) { - hb_retptr( ( QMenu* ) hbqt_par_QMenuBar( 1 )->addMenu( QMenuBar::tr( hb_parc( 2 ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QMenu( hbqt_par_QMenuBar( 1 )->addMenu( QMenuBar::tr( hb_parc( 2 ) ) ), false ) ); } /* @@ -193,7 +193,7 @@ HB_FUNC( QT_QMENUBAR_ADDMENU_1 ) */ HB_FUNC( QT_QMENUBAR_ADDMENU_2 ) { - hb_retptr( ( QMenu* ) hbqt_par_QMenuBar( 1 )->addMenu( QIcon( hbqt_par_QString( 2 ) ), QMenuBar::tr( hb_parc( 3 ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QMenu( hbqt_par_QMenuBar( 1 )->addMenu( QIcon( hbqt_par_QString( 2 ) ), QMenuBar::tr( hb_parc( 3 ) ) ), false ) ); } /* @@ -201,7 +201,7 @@ HB_FUNC( QT_QMENUBAR_ADDMENU_2 ) */ HB_FUNC( QT_QMENUBAR_ADDSEPARATOR ) { - hb_retptr( ( QAction* ) hbqt_par_QMenuBar( 1 )->addSeparator() ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenuBar( 1 )->addSeparator(), false ) ); } /* @@ -217,7 +217,7 @@ HB_FUNC( QT_QMENUBAR_CLEAR ) */ HB_FUNC( QT_QMENUBAR_INSERTMENU ) { - hb_retptr( ( QAction* ) hbqt_par_QMenuBar( 1 )->insertMenu( hbqt_par_QAction( 2 ), hbqt_par_QMenu( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenuBar( 1 )->insertMenu( hbqt_par_QAction( 2 ), hbqt_par_QMenu( 3 ) ), false ) ); } /* @@ -225,7 +225,7 @@ HB_FUNC( QT_QMENUBAR_INSERTMENU ) */ HB_FUNC( QT_QMENUBAR_INSERTSEPARATOR ) { - hb_retptr( ( QAction* ) hbqt_par_QMenuBar( 1 )->insertSeparator( hbqt_par_QAction( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QMenuBar( 1 )->insertSeparator( hbqt_par_QAction( 2 ) ), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QMessageBox.cpp b/harbour/contrib/hbqt/qtgui/QMessageBox.cpp index ea5e706053..c7912d160e 100644 --- a/harbour/contrib/hbqt/qtgui/QMessageBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QMessageBox.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -96,6 +96,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QMessageBox > pq; } QGC_POINTER_QMessageBox; @@ -104,48 +105,47 @@ QT_G_FUNC( hbqt_gcRelease_QMessageBox ) { QGC_POINTER_QMessageBox * p = ( QGC_POINTER_QMessageBox * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMessageBox p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMessageBox ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QMessageBox * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QMessageBox * ) p->ph )->~QMessageBox(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QMessageBox * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QMessageBox ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QMessageBox ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMessageBox Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QMessageBox Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QMessageBox Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QMessageBox Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QMessageBox Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QMessageBox( void * pObj ) +void * hbqt_gcAllocate_QMessageBox( void * pObj, bool bNew ) { QGC_POINTER_QMessageBox * p = ( QGC_POINTER_QMessageBox * ) hb_gcAllocate( sizeof( QGC_POINTER_QMessageBox ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QMessageBox; - new( & p->pq ) QPointer< QMessageBox >( ( QMessageBox * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QMessageBox %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QMessageBox >( ( QMessageBox * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QMessageBox ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -155,7 +155,7 @@ HB_FUNC( QT_QMESSAGEBOX ) pObj = ( QMessageBox* ) new QMessageBox() ; - hb_retptrGC( hbqt_gcAllocate_QMessageBox( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QMessageBox( pObj, true ) ); } /* * void addButton ( QAbstractButton * button, ButtonRole role ) @@ -170,7 +170,7 @@ HB_FUNC( QT_QMESSAGEBOX_ADDBUTTON ) */ HB_FUNC( QT_QMESSAGEBOX_ADDBUTTON_1 ) { - hb_retptr( ( QPushButton* ) hbqt_par_QMessageBox( 1 )->addButton( QMessageBox::tr( hb_parc( 2 ) ), ( QMessageBox::ButtonRole ) hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPushButton( hbqt_par_QMessageBox( 1 )->addButton( QMessageBox::tr( hb_parc( 2 ) ), ( QMessageBox::ButtonRole ) hb_parni( 3 ) ), false ) ); } /* @@ -178,7 +178,7 @@ HB_FUNC( QT_QMESSAGEBOX_ADDBUTTON_1 ) */ HB_FUNC( QT_QMESSAGEBOX_ADDBUTTON_2 ) { - hb_retptr( ( QPushButton* ) hbqt_par_QMessageBox( 1 )->addButton( ( QMessageBox::StandardButton ) hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPushButton( hbqt_par_QMessageBox( 1 )->addButton( ( QMessageBox::StandardButton ) hb_parni( 2 ) ), false ) ); } /* @@ -186,7 +186,7 @@ HB_FUNC( QT_QMESSAGEBOX_ADDBUTTON_2 ) */ HB_FUNC( QT_QMESSAGEBOX_BUTTON ) { - hb_retptr( ( QAbstractButton* ) hbqt_par_QMessageBox( 1 )->button( ( QMessageBox::StandardButton ) hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAbstractButton( hbqt_par_QMessageBox( 1 )->button( ( QMessageBox::StandardButton ) hb_parni( 2 ) ), false ) ); } /* @@ -202,7 +202,7 @@ HB_FUNC( QT_QMESSAGEBOX_BUTTONROLE ) */ HB_FUNC( QT_QMESSAGEBOX_CLICKEDBUTTON ) { - hb_retptr( ( QAbstractButton* ) hbqt_par_QMessageBox( 1 )->clickedButton() ); + hb_retptrGC( hbqt_gcAllocate_QAbstractButton( hbqt_par_QMessageBox( 1 )->clickedButton(), false ) ); } /* @@ -210,7 +210,7 @@ HB_FUNC( QT_QMESSAGEBOX_CLICKEDBUTTON ) */ HB_FUNC( QT_QMESSAGEBOX_DEFAULTBUTTON ) { - hb_retptr( ( QPushButton* ) hbqt_par_QMessageBox( 1 )->defaultButton() ); + hb_retptrGC( hbqt_gcAllocate_QPushButton( hbqt_par_QMessageBox( 1 )->defaultButton(), false ) ); } /* @@ -226,7 +226,7 @@ HB_FUNC( QT_QMESSAGEBOX_DETAILEDTEXT ) */ HB_FUNC( QT_QMESSAGEBOX_ESCAPEBUTTON ) { - hb_retptr( ( QAbstractButton* ) hbqt_par_QMessageBox( 1 )->escapeButton() ); + hb_retptrGC( hbqt_gcAllocate_QAbstractButton( hbqt_par_QMessageBox( 1 )->escapeButton(), false ) ); } /* @@ -242,7 +242,7 @@ HB_FUNC( QT_QMESSAGEBOX_ICON ) */ HB_FUNC( QT_QMESSAGEBOX_ICONPIXMAP ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QMessageBox( 1 )->iconPixmap() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QMessageBox( 1 )->iconPixmap() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QMouseEvent.cpp b/harbour/contrib/hbqt/qtgui/QMouseEvent.cpp index 549cd886c8..d4306dd8a4 100644 --- a/harbour/contrib/hbqt/qtgui/QMouseEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QMouseEvent.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -77,32 +77,49 @@ * ~QMouseEvent () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QMouseEvent; + QT_G_FUNC( hbqt_gcRelease_QMouseEvent ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMouseEvent p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMouseEvent ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QMouseEvent * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QMouseEvent Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QMouseEvent * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QMouseEvent ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QMouseEvent Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QMouseEvent Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QMouseEvent Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QMouseEvent( void * pObj ) +void * hbqt_gcAllocate_QMouseEvent( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QMouseEvent; - HB_TRACE( HB_TR_DEBUG, ( " new_QMouseEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QMouseEvent ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -115,7 +132,7 @@ HB_FUNC( QT_QMOUSEEVENT ) pObj = new QMouseEvent( *hbqt_par_QMouseEvent( 1 ) ) ; } - hb_retptrGC( hbqt_gcAllocate_QMouseEvent( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QMouseEvent( pObj, true ) ); } /* * Qt::MouseButton button () const @@ -138,7 +155,7 @@ HB_FUNC( QT_QMOUSEEVENT_BUTTONS ) */ HB_FUNC( QT_QMOUSEEVENT_GLOBALPOS ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QMouseEvent( 1 )->globalPos() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QMouseEvent( 1 )->globalPos() ), true ) ); } /* @@ -162,7 +179,7 @@ HB_FUNC( QT_QMOUSEEVENT_GLOBALY ) */ HB_FUNC( QT_QMOUSEEVENT_POS ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QMouseEvent( 1 )->pos() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QMouseEvent( 1 )->pos() ), true ) ); } /* @@ -170,7 +187,7 @@ HB_FUNC( QT_QMOUSEEVENT_POS ) */ HB_FUNC( QT_QMOUSEEVENT_POSF ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QMouseEvent( 1 )->posF() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QMouseEvent( 1 )->posF() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QMoveEvent.cpp b/harbour/contrib/hbqt/qtgui/QMoveEvent.cpp index 8363c5f5ed..9a6bc0e764 100644 --- a/harbour/contrib/hbqt/qtgui/QMoveEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QMoveEvent.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -76,11 +76,33 @@ * ~QMoveEvent () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QMoveEvent; + QT_G_FUNC( hbqt_gcRelease_QMoveEvent ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QMoveEvent( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QMoveEvent; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QMoveEvent ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QMOVEEVENT ) { } @@ -89,7 +111,7 @@ HB_FUNC( QT_QMOVEEVENT ) */ HB_FUNC( QT_QMOVEEVENT_OLDPOS ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QMoveEvent( 1 )->oldPos() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QMoveEvent( 1 )->oldPos() ), true ) ); } /* @@ -97,7 +119,7 @@ HB_FUNC( QT_QMOVEEVENT_OLDPOS ) */ HB_FUNC( QT_QMOVEEVENT_POS ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QMoveEvent( 1 )->pos() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QMoveEvent( 1 )->pos() ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QMovie.cpp b/harbour/contrib/hbqt/qtgui/QMovie.cpp index e59ebb4821..9817464b4f 100644 --- a/harbour/contrib/hbqt/qtgui/QMovie.cpp +++ b/harbour/contrib/hbqt/qtgui/QMovie.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -87,6 +87,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QMovie > pq; } QGC_POINTER_QMovie; @@ -95,48 +96,47 @@ QT_G_FUNC( hbqt_gcRelease_QMovie ) { QGC_POINTER_QMovie * p = ( QGC_POINTER_QMovie * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMovie p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMovie ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QMovie * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QMovie * ) p->ph )->~QMovie(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QMovie * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QMovie ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QMovie ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QMovie Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QMovie Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QMovie Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QMovie Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QMovie Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QMovie( void * pObj ) +void * hbqt_gcAllocate_QMovie( void * pObj, bool bNew ) { QGC_POINTER_QMovie * p = ( QGC_POINTER_QMovie * ) hb_gcAllocate( sizeof( QGC_POINTER_QMovie ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QMovie; - new( & p->pq ) QPointer< QMovie >( ( QMovie * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QMovie %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QMovie >( ( QMovie * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QMovie ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -146,14 +146,14 @@ HB_FUNC( QT_QMOVIE ) pObj = new QMovie() ; - hb_retptrGC( hbqt_gcAllocate_QMovie( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QMovie( pObj, true ) ); } /* * QColor backgroundColor () const */ HB_FUNC( QT_QMOVIE_BACKGROUNDCOLOR ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QMovie( 1 )->backgroundColor() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QMovie( 1 )->backgroundColor() ), true ) ); } /* @@ -177,7 +177,7 @@ HB_FUNC( QT_QMOVIE_CURRENTFRAMENUMBER ) */ HB_FUNC( QT_QMOVIE_CURRENTIMAGE ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QMovie( 1 )->currentImage() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QMovie( 1 )->currentImage() ), true ) ); } /* @@ -185,7 +185,7 @@ HB_FUNC( QT_QMOVIE_CURRENTIMAGE ) */ HB_FUNC( QT_QMOVIE_CURRENTPIXMAP ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QMovie( 1 )->currentPixmap() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QMovie( 1 )->currentPixmap() ), true ) ); } /* @@ -193,7 +193,7 @@ HB_FUNC( QT_QMOVIE_CURRENTPIXMAP ) */ HB_FUNC( QT_QMOVIE_DEVICE ) { - hb_retptr( ( QIODevice* ) hbqt_par_QMovie( 1 )->device() ); + hb_retptrGC( hbqt_gcAllocate_QIODevice( hbqt_par_QMovie( 1 )->device(), false ) ); } /* @@ -209,7 +209,7 @@ HB_FUNC( QT_QMOVIE_FILENAME ) */ HB_FUNC( QT_QMOVIE_FORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QMovie( 1 )->format() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QMovie( 1 )->format() ), true ) ); } /* @@ -225,7 +225,7 @@ HB_FUNC( QT_QMOVIE_FRAMECOUNT ) */ HB_FUNC( QT_QMOVIE_FRAMERECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QMovie( 1 )->frameRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QMovie( 1 )->frameRect() ), true ) ); } /* @@ -265,7 +265,7 @@ HB_FUNC( QT_QMOVIE_NEXTFRAMEDELAY ) */ HB_FUNC( QT_QMOVIE_SCALEDSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QMovie( 1 )->scaledSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QMovie( 1 )->scaledSize() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QPageSetupDialog.cpp b/harbour/contrib/hbqt/qtgui/QPageSetupDialog.cpp index cd245c3af9..8980dc8f99 100644 --- a/harbour/contrib/hbqt/qtgui/QPageSetupDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QPageSetupDialog.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -84,6 +84,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QPageSetupDialog > pq; } QGC_POINTER_QPageSetupDialog; @@ -92,48 +93,47 @@ QT_G_FUNC( hbqt_gcRelease_QPageSetupDialog ) { QGC_POINTER_QPageSetupDialog * p = ( QGC_POINTER_QPageSetupDialog * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPageSetupDialog p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPageSetupDialog ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QPageSetupDialog * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QPageSetupDialog * ) p->ph )->~QPageSetupDialog(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QPageSetupDialog * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPageSetupDialog ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QPageSetupDialog ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPageSetupDialog Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QPageSetupDialog Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QPageSetupDialog Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QPageSetupDialog Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QPageSetupDialog Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QPageSetupDialog( void * pObj ) +void * hbqt_gcAllocate_QPageSetupDialog( void * pObj, bool bNew ) { QGC_POINTER_QPageSetupDialog * p = ( QGC_POINTER_QPageSetupDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QPageSetupDialog ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QPageSetupDialog; - new( & p->pq ) QPointer< QPageSetupDialog >( ( QPageSetupDialog * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QPageSetupDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QPageSetupDialog >( ( QPageSetupDialog * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QPageSetupDialog ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -146,7 +146,7 @@ HB_FUNC( QT_QPAGESETUPDIALOG ) else pObj = ( QPageSetupDialog* ) new QPageSetupDialog( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QPageSetupDialog( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QPageSetupDialog( pObj, true ) ); } /* * virtual int exec () @@ -177,7 +177,7 @@ HB_FUNC( QT_QPAGESETUPDIALOG_OPTIONS ) */ HB_FUNC( QT_QPAGESETUPDIALOG_PRINTER ) { - hb_retptr( ( QPrinter* ) hbqt_par_QPageSetupDialog( 1 )->printer() ); + hb_retptrGC( hbqt_gcAllocate_QPrinter( hbqt_par_QPageSetupDialog( 1 )->printer(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QPaintDevice.cpp b/harbour/contrib/hbqt/qtgui/QPaintDevice.cpp index db1cf01baa..5391f14114 100644 --- a/harbour/contrib/hbqt/qtgui/QPaintDevice.cpp +++ b/harbour/contrib/hbqt/qtgui/QPaintDevice.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -78,11 +78,33 @@ * virtual ~QPaintDevice () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QPaintDevice; + QT_G_FUNC( hbqt_gcRelease_QPaintDevice ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QPaintDevice( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QPaintDevice; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QPaintDevice ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QPAINTDEVICE ) { } @@ -139,7 +161,7 @@ HB_FUNC( QT_QPAINTDEVICE_NUMCOLORS ) */ HB_FUNC( QT_QPAINTDEVICE_PAINTENGINE ) { - hb_retptr( ( QPaintEngine* ) hbqt_par_QPaintDevice( 1 )->paintEngine() ); + hb_retptrGC( hbqt_gcAllocate_QPaintEngine( hbqt_par_QPaintDevice( 1 )->paintEngine(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QPaintEngine.cpp b/harbour/contrib/hbqt/qtgui/QPaintEngine.cpp new file mode 100644 index 0000000000..4a9697cc34 --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/QPaintEngine.cpp @@ -0,0 +1,313 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009-2010 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ + +#include "hbapi.h" +#include "../hbqt.h" + +/*----------------------------------------------------------------------*/ +#if QT_VERSION >= 0x040500 +/*----------------------------------------------------------------------*/ + +/* + * enum DirtyFlag { DirtyPen, DirtyBrush, DirtyBrushOrigin, DirtyFont, ..., AllDirty } + * flags DirtyFlags + * enum PaintEngineFeature { AlphaBlend, Antialiasing, BlendModes, BrushStroke, ..., AllFeatures } + * flags PaintEngineFeatures + * enum PolygonDrawMode { OddEvenMode, WindingMode, ConvexMode, PolylineMode } + * enum Type { X11, Windows, MacPrinter, CoreGraphics, ..., MaxUser } + */ + +#include + +#include + + +/* + * QPaintEngine ( PaintEngineFeatures caps = 0 ) + * virtual ~QPaintEngine () + */ + +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QPaintEngine; + +QT_G_FUNC( hbqt_gcRelease_QPaintEngine ) +{ + HB_SYMBOL_UNUSED( Cargo ); +} + +void * hbqt_gcAllocate_QPaintEngine( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QPaintEngine; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QPaintEngine ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + +HB_FUNC( QT_QPAINTENGINE ) +{ +} +/* + * virtual bool begin ( QPaintDevice * pdev ) = 0 + */ +HB_FUNC( QT_QPAINTENGINE_BEGIN ) +{ + hb_retl( hbqt_par_QPaintEngine( 1 )->begin( hbqt_par_QPaintDevice( 2 ) ) ); +} + +/* + * virtual void drawEllipse ( const QRectF & rect ) + */ +HB_FUNC( QT_QPAINTENGINE_DRAWELLIPSE ) +{ + hbqt_par_QPaintEngine( 1 )->drawEllipse( *hbqt_par_QRectF( 2 ) ); +} + +/* + * virtual void drawEllipse ( const QRect & rect ) + */ +HB_FUNC( QT_QPAINTENGINE_DRAWELLIPSE_1 ) +{ + hbqt_par_QPaintEngine( 1 )->drawEllipse( *hbqt_par_QRect( 2 ) ); +} + +/* + * virtual void drawImage ( const QRectF & rectangle, const QImage & image, const QRectF & sr, Qt::ImageConversionFlags flags = Qt::AutoColor ) + */ +HB_FUNC( QT_QPAINTENGINE_DRAWIMAGE ) +{ + hbqt_par_QPaintEngine( 1 )->drawImage( *hbqt_par_QRectF( 2 ), *hbqt_par_QImage( 3 ), *hbqt_par_QRectF( 4 ), ( HB_ISNUM( 5 ) ? ( Qt::ImageConversionFlags ) hb_parni( 5 ) : ( Qt::ImageConversionFlags ) Qt::AutoColor ) ); +} + +/* + * virtual void drawLines ( const QLineF * lines, int lineCount ) + */ +HB_FUNC( QT_QPAINTENGINE_DRAWLINES ) +{ + hbqt_par_QPaintEngine( 1 )->drawLines( hbqt_par_QLineF( 2 ), hb_parni( 3 ) ); +} + +/* + * virtual void drawLines ( const QLine * lines, int lineCount ) + */ +HB_FUNC( QT_QPAINTENGINE_DRAWLINES_1 ) +{ + hbqt_par_QPaintEngine( 1 )->drawLines( hbqt_par_QLine( 2 ), hb_parni( 3 ) ); +} + +/* + * virtual void drawPath ( const QPainterPath & path ) + */ +HB_FUNC( QT_QPAINTENGINE_DRAWPATH ) +{ + hbqt_par_QPaintEngine( 1 )->drawPath( *hbqt_par_QPainterPath( 2 ) ); +} + +/* + * virtual void drawPixmap ( const QRectF & r, const QPixmap & pm, const QRectF & sr ) = 0 + */ +HB_FUNC( QT_QPAINTENGINE_DRAWPIXMAP ) +{ + hbqt_par_QPaintEngine( 1 )->drawPixmap( *hbqt_par_QRectF( 2 ), *hbqt_par_QPixmap( 3 ), *hbqt_par_QRectF( 4 ) ); +} + +/* + * virtual void drawPoints ( const QPointF * points, int pointCount ) + */ +HB_FUNC( QT_QPAINTENGINE_DRAWPOINTS ) +{ + hbqt_par_QPaintEngine( 1 )->drawPoints( hbqt_par_QPointF( 2 ), hb_parni( 3 ) ); +} + +/* + * virtual void drawPoints ( const QPoint * points, int pointCount ) + */ +HB_FUNC( QT_QPAINTENGINE_DRAWPOINTS_1 ) +{ + hbqt_par_QPaintEngine( 1 )->drawPoints( hbqt_par_QPoint( 2 ), hb_parni( 3 ) ); +} + +/* + * virtual void drawPolygon ( const QPointF * points, int pointCount, PolygonDrawMode mode ) + */ +HB_FUNC( QT_QPAINTENGINE_DRAWPOLYGON ) +{ + hbqt_par_QPaintEngine( 1 )->drawPolygon( hbqt_par_QPointF( 2 ), hb_parni( 3 ), ( QPaintEngine::PolygonDrawMode ) hb_parni( 4 ) ); +} + +/* + * virtual void drawPolygon ( const QPoint * points, int pointCount, PolygonDrawMode mode ) + */ +HB_FUNC( QT_QPAINTENGINE_DRAWPOLYGON_1 ) +{ + hbqt_par_QPaintEngine( 1 )->drawPolygon( hbqt_par_QPoint( 2 ), hb_parni( 3 ), ( QPaintEngine::PolygonDrawMode ) hb_parni( 4 ) ); +} + +/* + * virtual void drawRects ( const QRectF * rects, int rectCount ) + */ +HB_FUNC( QT_QPAINTENGINE_DRAWRECTS ) +{ + hbqt_par_QPaintEngine( 1 )->drawRects( hbqt_par_QRectF( 2 ), hb_parni( 3 ) ); +} + +/* + * virtual void drawRects ( const QRect * rects, int rectCount ) + */ +HB_FUNC( QT_QPAINTENGINE_DRAWRECTS_1 ) +{ + hbqt_par_QPaintEngine( 1 )->drawRects( hbqt_par_QRect( 2 ), hb_parni( 3 ) ); +} + +/* + * virtual void drawTextItem ( const QPointF & p, const QTextItem & textItem ) + */ +HB_FUNC( QT_QPAINTENGINE_DRAWTEXTITEM ) +{ + hbqt_par_QPaintEngine( 1 )->drawTextItem( *hbqt_par_QPointF( 2 ), *hbqt_par_QTextItem( 3 ) ); +} + +/* + * virtual void drawTiledPixmap ( const QRectF & rect, const QPixmap & pixmap, const QPointF & p ) + */ +HB_FUNC( QT_QPAINTENGINE_DRAWTILEDPIXMAP ) +{ + hbqt_par_QPaintEngine( 1 )->drawTiledPixmap( *hbqt_par_QRectF( 2 ), *hbqt_par_QPixmap( 3 ), *hbqt_par_QPointF( 4 ) ); +} + +/* + * virtual bool end () = 0 + */ +HB_FUNC( QT_QPAINTENGINE_END ) +{ + hb_retl( hbqt_par_QPaintEngine( 1 )->end() ); +} + +/* + * bool hasFeature ( PaintEngineFeatures feature ) const + */ +HB_FUNC( QT_QPAINTENGINE_HASFEATURE ) +{ + hb_retl( hbqt_par_QPaintEngine( 1 )->hasFeature( ( QPaintEngine::PaintEngineFeatures ) hb_parni( 2 ) ) ); +} + +/* + * bool isActive () const + */ +HB_FUNC( QT_QPAINTENGINE_ISACTIVE ) +{ + hb_retl( hbqt_par_QPaintEngine( 1 )->isActive() ); +} + +/* + * QPaintDevice * paintDevice () const + */ +HB_FUNC( QT_QPAINTENGINE_PAINTDEVICE ) +{ + hb_retptrGC( hbqt_gcAllocate_QPaintDevice( hbqt_par_QPaintEngine( 1 )->paintDevice(), false ) ); +} + +/* + * QPainter * painter () const + */ +HB_FUNC( QT_QPAINTENGINE_PAINTER ) +{ + hb_retptrGC( hbqt_gcAllocate_QPainter( hbqt_par_QPaintEngine( 1 )->painter(), false ) ); +} + +/* + * void setActive ( bool state ) + */ +HB_FUNC( QT_QPAINTENGINE_SETACTIVE ) +{ + hbqt_par_QPaintEngine( 1 )->setActive( hb_parl( 2 ) ); +} + +/* + * virtual Type type () const = 0 + */ +HB_FUNC( QT_QPAINTENGINE_TYPE ) +{ + hb_retni( ( QPaintEngine::Type ) hbqt_par_QPaintEngine( 1 )->type() ); +} + +/* + * virtual void updateState ( const QPaintEngineState & state ) = 0 + */ +HB_FUNC( QT_QPAINTENGINE_UPDATESTATE ) +{ + hbqt_par_QPaintEngine( 1 )->updateState( *hbqt_par_QPaintEngineState( 2 ) ); +} + + +/*----------------------------------------------------------------------*/ +#endif /* #if QT_VERSION >= 0x040500 */ +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QPaintEvent.cpp b/harbour/contrib/hbqt/qtgui/QPaintEvent.cpp index 1af1ca30c0..bd1c5c20ac 100644 --- a/harbour/contrib/hbqt/qtgui/QPaintEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QPaintEvent.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -76,32 +76,49 @@ * QPaintEvent ( const QRect & paintRect ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QPaintEvent; + QT_G_FUNC( hbqt_gcRelease_QPaintEvent ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPaintEvent p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPaintEvent ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QPaintEvent * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QPaintEvent Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QPaintEvent * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPaintEvent ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QPaintEvent Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QPaintEvent Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QPaintEvent Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QPaintEvent( void * pObj ) +void * hbqt_gcAllocate_QPaintEvent( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QPaintEvent; - HB_TRACE( HB_TR_DEBUG, ( " new_QPaintEvent %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QPaintEvent ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -123,14 +140,14 @@ HB_FUNC( QT_QPAINTEVENT ) } } - hb_retptrGC( hbqt_gcAllocate_QPaintEvent( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QPaintEvent( pObj, true ) ); } /* * const QRect & rect () const */ HB_FUNC( QT_QPAINTEVENT_RECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPaintEvent( 1 )->rect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPaintEvent( 1 )->rect() ), true ) ); } /* @@ -138,7 +155,7 @@ HB_FUNC( QT_QPAINTEVENT_RECT ) */ HB_FUNC( QT_QPAINTEVENT_REGION ) { - hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QPaintEvent( 1 )->region() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QPaintEvent( 1 )->region() ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QPainter.cpp b/harbour/contrib/hbqt/qtgui/QPainter.cpp index 487c835587..cbf7031e24 100644 --- a/harbour/contrib/hbqt/qtgui/QPainter.cpp +++ b/harbour/contrib/hbqt/qtgui/QPainter.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -96,32 +96,49 @@ * ~QPainter () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QPainter; + QT_G_FUNC( hbqt_gcRelease_QPainter ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPainter p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPainter ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QPainter * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QPainter Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QPainter * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPainter ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QPainter Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QPainter Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QPainter Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QPainter( void * pObj ) +void * hbqt_gcAllocate_QPainter( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QPainter; - HB_TRACE( HB_TR_DEBUG, ( " new_QPainter %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QPainter ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -138,14 +155,14 @@ HB_FUNC( QT_QPAINTER ) pObj = new QPainter() ; } - hb_retptrGC( hbqt_gcAllocate_QPainter( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QPainter( pObj, true ) ); } /* * const QBrush & background () const */ HB_FUNC( QT_QPAINTER_BACKGROUND ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPainter( 1 )->background() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPainter( 1 )->background() ), true ) ); } /* @@ -169,7 +186,7 @@ HB_FUNC( QT_QPAINTER_BEGIN ) */ HB_FUNC( QT_QPAINTER_BOUNDINGRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QPainter( 1 )->boundingRect( *hbqt_par_QRectF( 2 ), hb_parni( 3 ), hbqt_par_QString( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QPainter( 1 )->boundingRect( *hbqt_par_QRectF( 2 ), hb_parni( 3 ), hbqt_par_QString( 4 ) ) ), true ) ); } /* @@ -177,7 +194,7 @@ HB_FUNC( QT_QPAINTER_BOUNDINGRECT ) */ HB_FUNC( QT_QPAINTER_BOUNDINGRECT_1 ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPainter( 1 )->boundingRect( *hbqt_par_QRect( 2 ), hb_parni( 3 ), hbqt_par_QString( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPainter( 1 )->boundingRect( *hbqt_par_QRect( 2 ), hb_parni( 3 ), hbqt_par_QString( 4 ) ) ), true ) ); } /* @@ -185,7 +202,7 @@ HB_FUNC( QT_QPAINTER_BOUNDINGRECT_1 ) */ HB_FUNC( QT_QPAINTER_BOUNDINGRECT_2 ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPainter( 1 )->boundingRect( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), hb_parni( 6 ), hbqt_par_QString( 7 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPainter( 1 )->boundingRect( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), hb_parni( 6 ), hbqt_par_QString( 7 ) ) ), true ) ); } /* @@ -193,7 +210,7 @@ HB_FUNC( QT_QPAINTER_BOUNDINGRECT_2 ) */ HB_FUNC( QT_QPAINTER_BOUNDINGRECT_3 ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QPainter( 1 )->boundingRect( *hbqt_par_QRectF( 2 ), hbqt_par_QString( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QTextOption( 4 ) : QTextOption() ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QPainter( 1 )->boundingRect( *hbqt_par_QRectF( 2 ), hbqt_par_QString( 3 ), ( HB_ISPOINTER( 4 ) ? *hbqt_par_QTextOption( 4 ) : QTextOption() ) ) ), true ) ); } /* @@ -201,7 +218,7 @@ HB_FUNC( QT_QPAINTER_BOUNDINGRECT_3 ) */ HB_FUNC( QT_QPAINTER_BRUSH ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPainter( 1 )->brush() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPainter( 1 )->brush() ), true ) ); } /* @@ -209,7 +226,7 @@ HB_FUNC( QT_QPAINTER_BRUSH ) */ HB_FUNC( QT_QPAINTER_BRUSHORIGIN ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QPainter( 1 )->brushOrigin() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QPainter( 1 )->brushOrigin() ), true ) ); } /* @@ -217,7 +234,7 @@ HB_FUNC( QT_QPAINTER_BRUSHORIGIN ) */ HB_FUNC( QT_QPAINTER_CLIPPATH ) { - hb_retptrGC( hbqt_gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QPainter( 1 )->clipPath() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QPainter( 1 )->clipPath() ), true ) ); } /* @@ -225,7 +242,7 @@ HB_FUNC( QT_QPAINTER_CLIPPATH ) */ HB_FUNC( QT_QPAINTER_CLIPREGION ) { - hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QPainter( 1 )->clipRegion() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QPainter( 1 )->clipRegion() ), true ) ); } /* @@ -233,7 +250,7 @@ HB_FUNC( QT_QPAINTER_CLIPREGION ) */ HB_FUNC( QT_QPAINTER_COMBINEDMATRIX ) { - hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QPainter( 1 )->combinedMatrix() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QPainter( 1 )->combinedMatrix() ), true ) ); } /* @@ -241,7 +258,7 @@ HB_FUNC( QT_QPAINTER_COMBINEDMATRIX ) */ HB_FUNC( QT_QPAINTER_COMBINEDTRANSFORM ) { - hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QPainter( 1 )->combinedTransform() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QPainter( 1 )->combinedTransform() ), true ) ); } /* @@ -257,7 +274,7 @@ HB_FUNC( QT_QPAINTER_COMPOSITIONMODE ) */ HB_FUNC( QT_QPAINTER_DEVICE ) { - hb_retptr( ( QPaintDevice* ) hbqt_par_QPainter( 1 )->device() ); + hb_retptrGC( hbqt_gcAllocate_QPaintDevice( hbqt_par_QPainter( 1 )->device(), false ) ); } /* @@ -265,7 +282,7 @@ HB_FUNC( QT_QPAINTER_DEVICE ) */ HB_FUNC( QT_QPAINTER_DEVICEMATRIX ) { - hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QPainter( 1 )->deviceMatrix() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QPainter( 1 )->deviceMatrix() ), true ) ); } /* @@ -273,7 +290,7 @@ HB_FUNC( QT_QPAINTER_DEVICEMATRIX ) */ HB_FUNC( QT_QPAINTER_DEVICETRANSFORM ) { - hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QPainter( 1 )->deviceTransform() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QPainter( 1 )->deviceTransform() ), true ) ); } /* @@ -1089,7 +1106,7 @@ HB_FUNC( QT_QPAINTER_FILLRECT_11 ) */ HB_FUNC( QT_QPAINTER_FONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QPainter( 1 )->font() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QPainter( 1 )->font() ), true ) ); } /* @@ -1097,7 +1114,7 @@ HB_FUNC( QT_QPAINTER_FONT ) */ HB_FUNC( QT_QPAINTER_FONTINFO ) { - hb_retptrGC( hbqt_gcAllocate_QFontInfo( new QFontInfo( hbqt_par_QPainter( 1 )->fontInfo() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFontInfo( new QFontInfo( hbqt_par_QPainter( 1 )->fontInfo() ), true ) ); } /* @@ -1105,7 +1122,7 @@ HB_FUNC( QT_QPAINTER_FONTINFO ) */ HB_FUNC( QT_QPAINTER_FONTMETRICS ) { - hb_retptrGC( hbqt_gcAllocate_QFontMetrics( new QFontMetrics( hbqt_par_QPainter( 1 )->fontMetrics() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFontMetrics( new QFontMetrics( hbqt_par_QPainter( 1 )->fontMetrics() ), true ) ); } /* @@ -1153,7 +1170,7 @@ HB_FUNC( QT_QPAINTER_OPACITY ) */ HB_FUNC( QT_QPAINTER_PAINTENGINE ) { - hb_retptr( ( QPaintEngine* ) hbqt_par_QPainter( 1 )->paintEngine() ); + hb_retptrGC( hbqt_gcAllocate_QPaintEngine( hbqt_par_QPainter( 1 )->paintEngine(), false ) ); } /* @@ -1161,7 +1178,7 @@ HB_FUNC( QT_QPAINTER_PAINTENGINE ) */ HB_FUNC( QT_QPAINTER_PEN ) { - hb_retptrGC( hbqt_gcAllocate_QPen( new QPen( hbqt_par_QPainter( 1 )->pen() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPen( new QPen( hbqt_par_QPainter( 1 )->pen() ), true ) ); } /* @@ -1497,7 +1514,7 @@ HB_FUNC( QT_QPAINTER_TESTRENDERHINT ) */ HB_FUNC( QT_QPAINTER_TRANSFORM ) { - hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QPainter( 1 )->transform() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QPainter( 1 )->transform() ), true ) ); } /* @@ -1537,7 +1554,7 @@ HB_FUNC( QT_QPAINTER_VIEWTRANSFORMENABLED ) */ HB_FUNC( QT_QPAINTER_VIEWPORT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPainter( 1 )->viewport() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPainter( 1 )->viewport() ), true ) ); } /* @@ -1545,7 +1562,7 @@ HB_FUNC( QT_QPAINTER_VIEWPORT ) */ HB_FUNC( QT_QPAINTER_WINDOW ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPainter( 1 )->window() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPainter( 1 )->window() ), true ) ); } /* @@ -1553,7 +1570,7 @@ HB_FUNC( QT_QPAINTER_WINDOW ) */ HB_FUNC( QT_QPAINTER_WORLDMATRIX ) { - hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QPainter( 1 )->worldMatrix() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QPainter( 1 )->worldMatrix() ), true ) ); } /* @@ -1569,7 +1586,7 @@ HB_FUNC( QT_QPAINTER_WORLDMATRIXENABLED ) */ HB_FUNC( QT_QPAINTER_WORLDTRANSFORM ) { - hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QPainter( 1 )->worldTransform() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QPainter( 1 )->worldTransform() ), true ) ); } /* @@ -1577,7 +1594,7 @@ HB_FUNC( QT_QPAINTER_WORLDTRANSFORM ) */ HB_FUNC( QT_QPAINTER_REDIRECTED ) { - hb_retptr( ( QPaintDevice* ) hbqt_par_QPainter( 1 )->redirected( hbqt_par_QPaintDevice( 2 ), hbqt_par_QPoint( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPaintDevice( hbqt_par_QPainter( 1 )->redirected( hbqt_par_QPaintDevice( 2 ), hbqt_par_QPoint( 3 ) ), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QPainterPath.cpp b/harbour/contrib/hbqt/qtgui/QPainterPath.cpp index cbc65398f6..ffd13e147e 100644 --- a/harbour/contrib/hbqt/qtgui/QPainterPath.cpp +++ b/harbour/contrib/hbqt/qtgui/QPainterPath.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -97,32 +97,49 @@ * ~QPainterPath () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QPainterPath; + QT_G_FUNC( hbqt_gcRelease_QPainterPath ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPainterPath p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPainterPath ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QPainterPath * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QPainterPath Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QPainterPath * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPainterPath ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QPainterPath Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QPainterPath Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QPainterPath Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QPainterPath( void * pObj ) +void * hbqt_gcAllocate_QPainterPath( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QPainterPath; - HB_TRACE( HB_TR_DEBUG, ( " new_QPainterPath %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QPainterPath ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -132,7 +149,7 @@ HB_FUNC( QT_QPAINTERPATH ) pObj = new QPainterPath() ; - hb_retptrGC( hbqt_gcAllocate_QPainterPath( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QPainterPath( pObj, true ) ); } /* * void addEllipse ( const QRectF & boundingRectangle ) @@ -275,7 +292,7 @@ HB_FUNC( QT_QPAINTERPATH_ARCTO_1 ) */ HB_FUNC( QT_QPAINTERPATH_BOUNDINGRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QPainterPath( 1 )->boundingRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QPainterPath( 1 )->boundingRect() ), true ) ); } /* @@ -323,7 +340,7 @@ HB_FUNC( QT_QPAINTERPATH_CONTAINS_2 ) */ HB_FUNC( QT_QPAINTERPATH_CONTROLPOINTRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QPainterPath( 1 )->controlPointRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QPainterPath( 1 )->controlPointRect() ), true ) ); } /* @@ -347,7 +364,7 @@ HB_FUNC( QT_QPAINTERPATH_CUBICTO_1 ) */ HB_FUNC( QT_QPAINTERPATH_CURRENTPOSITION ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QPainterPath( 1 )->currentPosition() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QPainterPath( 1 )->currentPosition() ), true ) ); } /* @@ -371,7 +388,7 @@ HB_FUNC( QT_QPAINTERPATH_FILLRULE ) */ HB_FUNC( QT_QPAINTERPATH_INTERSECTED ) { - hb_retptrGC( hbqt_gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QPainterPath( 1 )->intersected( *hbqt_par_QPainterPath( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QPainterPath( 1 )->intersected( *hbqt_par_QPainterPath( 2 ) ) ), true ) ); } /* @@ -451,7 +468,7 @@ HB_FUNC( QT_QPAINTERPATH_PERCENTATLENGTH ) */ HB_FUNC( QT_QPAINTERPATH_POINTATPERCENT ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QPainterPath( 1 )->pointAtPercent( hb_parnd( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QPainterPath( 1 )->pointAtPercent( hb_parnd( 2 ) ) ), true ) ); } /* @@ -491,7 +508,7 @@ HB_FUNC( QT_QPAINTERPATH_SETFILLRULE ) */ HB_FUNC( QT_QPAINTERPATH_SIMPLIFIED ) { - hb_retptrGC( hbqt_gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QPainterPath( 1 )->simplified() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QPainterPath( 1 )->simplified() ), true ) ); } /* @@ -507,7 +524,7 @@ HB_FUNC( QT_QPAINTERPATH_SLOPEATPERCENT ) */ HB_FUNC( QT_QPAINTERPATH_SUBTRACTED ) { - hb_retptrGC( hbqt_gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QPainterPath( 1 )->subtracted( *hbqt_par_QPainterPath( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QPainterPath( 1 )->subtracted( *hbqt_par_QPainterPath( 2 ) ) ), true ) ); } /* @@ -515,7 +532,7 @@ HB_FUNC( QT_QPAINTERPATH_SUBTRACTED ) */ HB_FUNC( QT_QPAINTERPATH_TOFILLPOLYGON ) { - hb_retptrGC( hbqt_gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QPainterPath( 1 )->toFillPolygon( *hbqt_par_QTransform( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QPainterPath( 1 )->toFillPolygon( *hbqt_par_QTransform( 2 ) ) ), true ) ); } /* @@ -523,7 +540,7 @@ HB_FUNC( QT_QPAINTERPATH_TOFILLPOLYGON ) */ HB_FUNC( QT_QPAINTERPATH_TOFILLPOLYGON_1 ) { - hb_retptrGC( hbqt_gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QPainterPath( 1 )->toFillPolygon( ( HB_ISPOINTER( 2 ) ? *hbqt_par_QMatrix( 2 ) : QMatrix() ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QPainterPath( 1 )->toFillPolygon( ( HB_ISPOINTER( 2 ) ? *hbqt_par_QMatrix( 2 ) : QMatrix() ) ) ), true ) ); } /* @@ -531,7 +548,7 @@ HB_FUNC( QT_QPAINTERPATH_TOFILLPOLYGON_1 ) */ HB_FUNC( QT_QPAINTERPATH_TOREVERSED ) { - hb_retptrGC( hbqt_gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QPainterPath( 1 )->toReversed() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QPainterPath( 1 )->toReversed() ), true ) ); } /* @@ -539,7 +556,7 @@ HB_FUNC( QT_QPAINTERPATH_TOREVERSED ) */ HB_FUNC( QT_QPAINTERPATH_UNITED ) { - hb_retptrGC( hbqt_gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QPainterPath( 1 )->united( *hbqt_par_QPainterPath( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QPainterPath( 1 )->united( *hbqt_par_QPainterPath( 2 ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QPalette.cpp b/harbour/contrib/hbqt/qtgui/QPalette.cpp index 7db2588537..122a758b33 100644 --- a/harbour/contrib/hbqt/qtgui/QPalette.cpp +++ b/harbour/contrib/hbqt/qtgui/QPalette.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -86,32 +86,49 @@ * ~QPalette () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QPalette; + QT_G_FUNC( hbqt_gcRelease_QPalette ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPalette p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPalette ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QPalette * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QPalette Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QPalette * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPalette ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QPalette Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QPalette Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QPalette Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QPalette( void * pObj ) +void * hbqt_gcAllocate_QPalette( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QPalette; - HB_TRACE( HB_TR_DEBUG, ( " new_QPalette %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QPalette ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -136,14 +153,14 @@ HB_FUNC( QT_QPALETTE ) pObj = ( QPalette* ) new QPalette() ; } - hb_retptrGC( hbqt_gcAllocate_QPalette( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QPalette( pObj, true ) ); } /* * const QBrush & alternateBase () const */ HB_FUNC( QT_QPALETTE_ALTERNATEBASE ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->alternateBase() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->alternateBase() ), true ) ); } /* @@ -151,7 +168,7 @@ HB_FUNC( QT_QPALETTE_ALTERNATEBASE ) */ HB_FUNC( QT_QPALETTE_BASE ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->base() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->base() ), true ) ); } /* @@ -159,7 +176,7 @@ HB_FUNC( QT_QPALETTE_BASE ) */ HB_FUNC( QT_QPALETTE_BRIGHTTEXT ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->brightText() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->brightText() ), true ) ); } /* @@ -167,7 +184,7 @@ HB_FUNC( QT_QPALETTE_BRIGHTTEXT ) */ HB_FUNC( QT_QPALETTE_BRUSH ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->brush( ( QPalette::ColorGroup ) hb_parni( 2 ), ( QPalette::ColorRole ) hb_parni( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->brush( ( QPalette::ColorGroup ) hb_parni( 2 ), ( QPalette::ColorRole ) hb_parni( 3 ) ) ), true ) ); } /* @@ -175,7 +192,7 @@ HB_FUNC( QT_QPALETTE_BRUSH ) */ HB_FUNC( QT_QPALETTE_BRUSH_1 ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->brush( ( QPalette::ColorRole ) hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->brush( ( QPalette::ColorRole ) hb_parni( 2 ) ) ), true ) ); } /* @@ -183,7 +200,7 @@ HB_FUNC( QT_QPALETTE_BRUSH_1 ) */ HB_FUNC( QT_QPALETTE_BUTTON ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->button() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->button() ), true ) ); } /* @@ -191,7 +208,7 @@ HB_FUNC( QT_QPALETTE_BUTTON ) */ HB_FUNC( QT_QPALETTE_BUTTONTEXT ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->buttonText() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->buttonText() ), true ) ); } /* @@ -207,7 +224,7 @@ HB_FUNC( QT_QPALETTE_CACHEKEY ) */ HB_FUNC( QT_QPALETTE_COLOR ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QPalette( 1 )->color( ( QPalette::ColorGroup ) hb_parni( 2 ), ( QPalette::ColorRole ) hb_parni( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QPalette( 1 )->color( ( QPalette::ColorGroup ) hb_parni( 2 ), ( QPalette::ColorRole ) hb_parni( 3 ) ) ), true ) ); } /* @@ -215,7 +232,7 @@ HB_FUNC( QT_QPALETTE_COLOR ) */ HB_FUNC( QT_QPALETTE_COLOR_1 ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QPalette( 1 )->color( ( QPalette::ColorRole ) hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QPalette( 1 )->color( ( QPalette::ColorRole ) hb_parni( 2 ) ) ), true ) ); } /* @@ -231,7 +248,7 @@ HB_FUNC( QT_QPALETTE_CURRENTCOLORGROUP ) */ HB_FUNC( QT_QPALETTE_DARK ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->dark() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->dark() ), true ) ); } /* @@ -239,7 +256,7 @@ HB_FUNC( QT_QPALETTE_DARK ) */ HB_FUNC( QT_QPALETTE_HIGHLIGHT ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->highlight() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->highlight() ), true ) ); } /* @@ -247,7 +264,7 @@ HB_FUNC( QT_QPALETTE_HIGHLIGHT ) */ HB_FUNC( QT_QPALETTE_HIGHLIGHTEDTEXT ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->highlightedText() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->highlightedText() ), true ) ); } /* @@ -279,7 +296,7 @@ HB_FUNC( QT_QPALETTE_ISEQUAL ) */ HB_FUNC( QT_QPALETTE_LIGHT ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->light() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->light() ), true ) ); } /* @@ -287,7 +304,7 @@ HB_FUNC( QT_QPALETTE_LIGHT ) */ HB_FUNC( QT_QPALETTE_LINK ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->link() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->link() ), true ) ); } /* @@ -295,7 +312,7 @@ HB_FUNC( QT_QPALETTE_LINK ) */ HB_FUNC( QT_QPALETTE_LINKVISITED ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->linkVisited() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->linkVisited() ), true ) ); } /* @@ -303,7 +320,7 @@ HB_FUNC( QT_QPALETTE_LINKVISITED ) */ HB_FUNC( QT_QPALETTE_MID ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->mid() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->mid() ), true ) ); } /* @@ -311,7 +328,7 @@ HB_FUNC( QT_QPALETTE_MID ) */ HB_FUNC( QT_QPALETTE_MIDLIGHT ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->midlight() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->midlight() ), true ) ); } /* @@ -319,7 +336,7 @@ HB_FUNC( QT_QPALETTE_MIDLIGHT ) */ HB_FUNC( QT_QPALETTE_RESOLVE ) { - hb_retptrGC( hbqt_gcAllocate_QPalette( new QPalette( hbqt_par_QPalette( 1 )->resolve( *hbqt_par_QPalette( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPalette( new QPalette( hbqt_par_QPalette( 1 )->resolve( *hbqt_par_QPalette( 2 ) ) ), true ) ); } /* @@ -375,7 +392,7 @@ HB_FUNC( QT_QPALETTE_SETCURRENTCOLORGROUP ) */ HB_FUNC( QT_QPALETTE_SHADOW ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->shadow() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->shadow() ), true ) ); } /* @@ -383,7 +400,7 @@ HB_FUNC( QT_QPALETTE_SHADOW ) */ HB_FUNC( QT_QPALETTE_TEXT ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->text() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->text() ), true ) ); } /* @@ -391,7 +408,7 @@ HB_FUNC( QT_QPALETTE_TEXT ) */ HB_FUNC( QT_QPALETTE_TOOLTIPBASE ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->toolTipBase() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->toolTipBase() ), true ) ); } /* @@ -399,7 +416,7 @@ HB_FUNC( QT_QPALETTE_TOOLTIPBASE ) */ HB_FUNC( QT_QPALETTE_TOOLTIPTEXT ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->toolTipText() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->toolTipText() ), true ) ); } /* @@ -407,7 +424,7 @@ HB_FUNC( QT_QPALETTE_TOOLTIPTEXT ) */ HB_FUNC( QT_QPALETTE_WINDOW ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->window() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->window() ), true ) ); } /* @@ -415,7 +432,7 @@ HB_FUNC( QT_QPALETTE_WINDOW ) */ HB_FUNC( QT_QPALETTE_WINDOWTEXT ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->windowText() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPalette( 1 )->windowText() ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QPen.cpp b/harbour/contrib/hbqt/qtgui/QPen.cpp index f05ad8beff..885d1c45ab 100644 --- a/harbour/contrib/hbqt/qtgui/QPen.cpp +++ b/harbour/contrib/hbqt/qtgui/QPen.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -90,32 +90,49 @@ * ~QPen () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QPen; + QT_G_FUNC( hbqt_gcRelease_QPen ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPen p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPen ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QPen * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QPen Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QPen * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPen ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QPen Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QPen Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QPen Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QPen( void * pObj ) +void * hbqt_gcAllocate_QPen( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QPen; - HB_TRACE( HB_TR_DEBUG, ( " new_QPen %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QPen ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -157,14 +174,14 @@ HB_FUNC( QT_QPEN ) pObj = ( QPen* ) new QPen() ; } - hb_retptrGC( hbqt_gcAllocate_QPen( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QPen( pObj, true ) ); } /* * QBrush brush () const */ HB_FUNC( QT_QPEN_BRUSH ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPen( 1 )->brush() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QPen( 1 )->brush() ), true ) ); } /* @@ -180,7 +197,7 @@ HB_FUNC( QT_QPEN_CAPSTYLE ) */ HB_FUNC( QT_QPEN_COLOR ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QPen( 1 )->color() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QPen( 1 )->color() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QPicture.cpp b/harbour/contrib/hbqt/qtgui/QPicture.cpp index 886facc85d..60c7d30b9b 100644 --- a/harbour/contrib/hbqt/qtgui/QPicture.cpp +++ b/harbour/contrib/hbqt/qtgui/QPicture.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -77,32 +77,49 @@ * ~QPicture () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QPicture; + QT_G_FUNC( hbqt_gcRelease_QPicture ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPicture p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPicture ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QPicture * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QPicture Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QPicture * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPicture ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QPicture Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QPicture Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QPicture Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QPicture( void * pObj ) +void * hbqt_gcAllocate_QPicture( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QPicture; - HB_TRACE( HB_TR_DEBUG, ( " new_QPicture %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QPicture ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -123,14 +140,14 @@ HB_FUNC( QT_QPICTURE ) pObj = new QPicture() ; } - hb_retptrGC( hbqt_gcAllocate_QPicture( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QPicture( pObj, true ) ); } /* * QRect boundingRect () const */ HB_FUNC( QT_QPICTURE_BOUNDINGRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPicture( 1 )->boundingRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPicture( 1 )->boundingRect() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QPixmap.cpp b/harbour/contrib/hbqt/qtgui/QPixmap.cpp index b53e80bb64..d332c9c51c 100644 --- a/harbour/contrib/hbqt/qtgui/QPixmap.cpp +++ b/harbour/contrib/hbqt/qtgui/QPixmap.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -86,32 +86,49 @@ * ~QPixmap () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QPixmap; + QT_G_FUNC( hbqt_gcRelease_QPixmap ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPixmap p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPixmap ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QPixmap * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QPixmap Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QPixmap * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPixmap ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QPixmap Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QPixmap Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QPixmap Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QPixmap( void * pObj ) +void * hbqt_gcAllocate_QPixmap( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QPixmap; - HB_TRACE( HB_TR_DEBUG, ( " new_QPixmap %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QPixmap ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -136,14 +153,14 @@ HB_FUNC( QT_QPIXMAP ) pObj = new QPixmap() ; } - hb_retptrGC( hbqt_gcAllocate_QPixmap( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( pObj, true ) ); } /* * QPixmap alphaChannel () const */ HB_FUNC( QT_QPIXMAP_ALPHACHANNEL ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->alphaChannel() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->alphaChannel() ), true ) ); } /* @@ -159,7 +176,7 @@ HB_FUNC( QT_QPIXMAP_CACHEKEY ) */ HB_FUNC( QT_QPIXMAP_COPY ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->copy( ( HB_ISPOINTER( 2 ) ? *hbqt_par_QRect( 2 ) : QRect() ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->copy( ( HB_ISPOINTER( 2 ) ? *hbqt_par_QRect( 2 ) : QRect() ) ) ), true ) ); } /* @@ -167,7 +184,7 @@ HB_FUNC( QT_QPIXMAP_COPY ) */ HB_FUNC( QT_QPIXMAP_COPY_1 ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->copy( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->copy( hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ) ) ), true ) ); } /* @@ -175,7 +192,7 @@ HB_FUNC( QT_QPIXMAP_COPY_1 ) */ HB_FUNC( QT_QPIXMAP_CREATEHEURISTICMASK ) { - hb_retptrGC( hbqt_gcAllocate_QBitmap( new QBitmap( hbqt_par_QPixmap( 1 )->createHeuristicMask( hb_parl( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBitmap( new QBitmap( hbqt_par_QPixmap( 1 )->createHeuristicMask( hb_parl( 2 ) ) ), true ) ); } /* @@ -183,7 +200,7 @@ HB_FUNC( QT_QPIXMAP_CREATEHEURISTICMASK ) */ HB_FUNC( QT_QPIXMAP_CREATEMASKFROMCOLOR ) { - hb_retptrGC( hbqt_gcAllocate_QBitmap( new QBitmap( hbqt_par_QPixmap( 1 )->createMaskFromColor( *hbqt_par_QColor( 2 ), ( Qt::MaskMode ) hb_parni( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBitmap( new QBitmap( hbqt_par_QPixmap( 1 )->createMaskFromColor( *hbqt_par_QColor( 2 ), ( Qt::MaskMode ) hb_parni( 3 ) ) ), true ) ); } /* @@ -191,7 +208,7 @@ HB_FUNC( QT_QPIXMAP_CREATEMASKFROMCOLOR ) */ HB_FUNC( QT_QPIXMAP_CREATEMASKFROMCOLOR_1 ) { - hb_retptrGC( hbqt_gcAllocate_QBitmap( new QBitmap( hbqt_par_QPixmap( 1 )->createMaskFromColor( *hbqt_par_QColor( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBitmap( new QBitmap( hbqt_par_QPixmap( 1 )->createMaskFromColor( *hbqt_par_QColor( 2 ) ) ), true ) ); } /* @@ -295,7 +312,7 @@ HB_FUNC( QT_QPIXMAP_LOADFROMDATA ) */ HB_FUNC( QT_QPIXMAP_MASK ) { - hb_retptrGC( hbqt_gcAllocate_QBitmap( new QBitmap( hbqt_par_QPixmap( 1 )->mask() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBitmap( new QBitmap( hbqt_par_QPixmap( 1 )->mask() ), true ) ); } /* @@ -303,7 +320,7 @@ HB_FUNC( QT_QPIXMAP_MASK ) */ HB_FUNC( QT_QPIXMAP_RECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPixmap( 1 )->rect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPixmap( 1 )->rect() ), true ) ); } /* @@ -327,7 +344,7 @@ HB_FUNC( QT_QPIXMAP_SAVE_1 ) */ HB_FUNC( QT_QPIXMAP_SCALED ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->scaled( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISNUM( 4 ) ? ( Qt::AspectRatioMode ) hb_parni( 4 ) : ( Qt::AspectRatioMode ) Qt::IgnoreAspectRatio ), ( HB_ISNUM( 5 ) ? ( Qt::TransformationMode ) hb_parni( 5 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->scaled( hb_parni( 2 ), hb_parni( 3 ), ( HB_ISNUM( 4 ) ? ( Qt::AspectRatioMode ) hb_parni( 4 ) : ( Qt::AspectRatioMode ) Qt::IgnoreAspectRatio ), ( HB_ISNUM( 5 ) ? ( Qt::TransformationMode ) hb_parni( 5 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), true ) ); } /* @@ -335,7 +352,7 @@ HB_FUNC( QT_QPIXMAP_SCALED ) */ HB_FUNC( QT_QPIXMAP_SCALED_1 ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->scaled( *hbqt_par_QSize( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::AspectRatioMode ) hb_parni( 3 ) : ( Qt::AspectRatioMode ) Qt::IgnoreAspectRatio ), ( HB_ISNUM( 4 ) ? ( Qt::TransformationMode ) hb_parni( 4 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->scaled( *hbqt_par_QSize( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::AspectRatioMode ) hb_parni( 3 ) : ( Qt::AspectRatioMode ) Qt::IgnoreAspectRatio ), ( HB_ISNUM( 4 ) ? ( Qt::TransformationMode ) hb_parni( 4 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), true ) ); } /* @@ -343,7 +360,7 @@ HB_FUNC( QT_QPIXMAP_SCALED_1 ) */ HB_FUNC( QT_QPIXMAP_SCALEDTOHEIGHT ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->scaledToHeight( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->scaledToHeight( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), true ) ); } /* @@ -351,7 +368,7 @@ HB_FUNC( QT_QPIXMAP_SCALEDTOHEIGHT ) */ HB_FUNC( QT_QPIXMAP_SCALEDTOWIDTH ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->scaledToWidth( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->scaledToWidth( hb_parni( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), true ) ); } /* @@ -375,7 +392,7 @@ HB_FUNC( QT_QPIXMAP_SETMASK ) */ HB_FUNC( QT_QPIXMAP_SIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QPixmap( 1 )->size() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QPixmap( 1 )->size() ), true ) ); } /* @@ -383,7 +400,7 @@ HB_FUNC( QT_QPIXMAP_SIZE ) */ HB_FUNC( QT_QPIXMAP_TOIMAGE ) { - hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QPixmap( 1 )->toImage() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QImage( new QImage( hbqt_par_QPixmap( 1 )->toImage() ), true ) ); } /* @@ -391,7 +408,7 @@ HB_FUNC( QT_QPIXMAP_TOIMAGE ) */ HB_FUNC( QT_QPIXMAP_TRANSFORMED ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->transformed( *hbqt_par_QTransform( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->transformed( *hbqt_par_QTransform( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), true ) ); } /* @@ -399,7 +416,7 @@ HB_FUNC( QT_QPIXMAP_TRANSFORMED ) */ HB_FUNC( QT_QPIXMAP_TRANSFORMED_1 ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->transformed( *hbqt_par_QMatrix( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->transformed( *hbqt_par_QMatrix( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::TransformationMode ) hb_parni( 3 ) : ( Qt::TransformationMode ) Qt::FastTransformation ) ) ), true ) ); } /* @@ -423,7 +440,7 @@ HB_FUNC( QT_QPIXMAP_DEFAULTDEPTH ) */ HB_FUNC( QT_QPIXMAP_FROMIMAGE ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->fromImage( *hbqt_par_QImage( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::ImageConversionFlags ) hb_parni( 3 ) : ( Qt::ImageConversionFlags ) Qt::AutoColor ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->fromImage( *hbqt_par_QImage( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::ImageConversionFlags ) hb_parni( 3 ) : ( Qt::ImageConversionFlags ) Qt::AutoColor ) ) ), true ) ); } /* @@ -431,7 +448,7 @@ HB_FUNC( QT_QPIXMAP_FROMIMAGE ) */ HB_FUNC( QT_QPIXMAP_GRABWIDGET ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->grabWidget( hbqt_par_QWidget( 2 ), *hbqt_par_QRect( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->grabWidget( hbqt_par_QWidget( 2 ), *hbqt_par_QRect( 3 ) ) ), true ) ); } /* @@ -439,7 +456,7 @@ HB_FUNC( QT_QPIXMAP_GRABWIDGET ) */ HB_FUNC( QT_QPIXMAP_GRABWIDGET_1 ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->grabWidget( hbqt_par_QWidget( 2 ), hb_parni( 3 ), hb_parni( 4 ), ( HB_ISNUM( 5 ) ? hb_parni( 5 ) : -1 ), ( HB_ISNUM( 6 ) ? hb_parni( 6 ) : -1 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QPixmap( 1 )->grabWidget( hbqt_par_QWidget( 2 ), hb_parni( 3 ), hb_parni( 4 ), ( HB_ISNUM( 5 ) ? hb_parni( 5 ) : -1 ), ( HB_ISNUM( 6 ) ? hb_parni( 6 ) : -1 ) ) ), true ) ); } /* @@ -447,7 +464,7 @@ HB_FUNC( QT_QPIXMAP_GRABWIDGET_1 ) */ HB_FUNC( QT_QPIXMAP_TRUEMATRIX ) { - hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QPixmap( 1 )->trueMatrix( *hbqt_par_QTransform( 2 ), hb_parni( 3 ), hb_parni( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QPixmap( 1 )->trueMatrix( *hbqt_par_QTransform( 2 ), hb_parni( 3 ), hb_parni( 4 ) ) ), true ) ); } /* @@ -455,7 +472,7 @@ HB_FUNC( QT_QPIXMAP_TRUEMATRIX ) */ HB_FUNC( QT_QPIXMAP_TRUEMATRIX_1 ) { - hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QPixmap( 1 )->trueMatrix( *hbqt_par_QMatrix( 2 ), hb_parni( 3 ), hb_parni( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QPixmap( 1 )->trueMatrix( *hbqt_par_QMatrix( 2 ), hb_parni( 3 ), hb_parni( 4 ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QPlainTextEdit.cpp b/harbour/contrib/hbqt/qtgui/QPlainTextEdit.cpp index 29a5d079e8..3be7c30608 100644 --- a/harbour/contrib/hbqt/qtgui/QPlainTextEdit.cpp +++ b/harbour/contrib/hbqt/qtgui/QPlainTextEdit.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -99,6 +99,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QPlainTextEdit > pq; } QGC_POINTER_QPlainTextEdit; @@ -107,48 +108,47 @@ QT_G_FUNC( hbqt_gcRelease_QPlainTextEdit ) { QGC_POINTER_QPlainTextEdit * p = ( QGC_POINTER_QPlainTextEdit * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPlainTextEdit p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPlainTextEdit ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QPlainTextEdit * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QPlainTextEdit * ) p->ph )->~QPlainTextEdit(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QPlainTextEdit * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPlainTextEdit ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QPlainTextEdit ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPlainTextEdit Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QPlainTextEdit Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QPlainTextEdit Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QPlainTextEdit Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QPlainTextEdit Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QPlainTextEdit( void * pObj ) +void * hbqt_gcAllocate_QPlainTextEdit( void * pObj, bool bNew ) { QGC_POINTER_QPlainTextEdit * p = ( QGC_POINTER_QPlainTextEdit * ) hb_gcAllocate( sizeof( QGC_POINTER_QPlainTextEdit ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QPlainTextEdit; - new( & p->pq ) QPointer< QPlainTextEdit >( ( QPlainTextEdit * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QPlainTextEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QPlainTextEdit >( ( QPlainTextEdit * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QPlainTextEdit ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -173,7 +173,7 @@ HB_FUNC( QT_QPLAINTEXTEDIT ) pObj = new QPlainTextEdit() ; } - hb_retptrGC( hbqt_gcAllocate_QPlainTextEdit( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QPlainTextEdit( pObj, true ) ); } /* * bool backgroundVisible () const @@ -212,7 +212,7 @@ HB_FUNC( QT_QPLAINTEXTEDIT_CENTERONSCROLL ) */ HB_FUNC( QT_QPLAINTEXTEDIT_CREATESTANDARDCONTEXTMENU ) { - hb_retptr( ( QMenu* ) hbqt_par_QPlainTextEdit( 1 )->createStandardContextMenu() ); + hb_retptrGC( hbqt_gcAllocate_QMenu( hbqt_par_QPlainTextEdit( 1 )->createStandardContextMenu(), false ) ); } /* @@ -220,7 +220,7 @@ HB_FUNC( QT_QPLAINTEXTEDIT_CREATESTANDARDCONTEXTMENU ) */ HB_FUNC( QT_QPLAINTEXTEDIT_CURRENTCHARFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QPlainTextEdit( 1 )->currentCharFormat() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QPlainTextEdit( 1 )->currentCharFormat() ), true ) ); } /* @@ -228,7 +228,7 @@ HB_FUNC( QT_QPLAINTEXTEDIT_CURRENTCHARFORMAT ) */ HB_FUNC( QT_QPLAINTEXTEDIT_CURSORFORPOSITION ) { - hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QPlainTextEdit( 1 )->cursorForPosition( *hbqt_par_QPoint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QPlainTextEdit( 1 )->cursorForPosition( *hbqt_par_QPoint( 2 ) ) ), true ) ); } /* @@ -236,7 +236,7 @@ HB_FUNC( QT_QPLAINTEXTEDIT_CURSORFORPOSITION ) */ HB_FUNC( QT_QPLAINTEXTEDIT_CURSORRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPlainTextEdit( 1 )->cursorRect( *hbqt_par_QTextCursor( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPlainTextEdit( 1 )->cursorRect( *hbqt_par_QTextCursor( 2 ) ) ), true ) ); } /* @@ -244,7 +244,7 @@ HB_FUNC( QT_QPLAINTEXTEDIT_CURSORRECT ) */ HB_FUNC( QT_QPLAINTEXTEDIT_CURSORRECT_1 ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPlainTextEdit( 1 )->cursorRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPlainTextEdit( 1 )->cursorRect() ), true ) ); } /* @@ -260,7 +260,7 @@ HB_FUNC( QT_QPLAINTEXTEDIT_CURSORWIDTH ) */ HB_FUNC( QT_QPLAINTEXTEDIT_DOCUMENT ) { - hb_retptr( ( QTextDocument* ) hbqt_par_QPlainTextEdit( 1 )->document() ); + hb_retptrGC( hbqt_gcAllocate_QTextDocument( hbqt_par_QPlainTextEdit( 1 )->document(), false ) ); } /* @@ -316,7 +316,7 @@ HB_FUNC( QT_QPLAINTEXTEDIT_LINEWRAPMODE ) */ HB_FUNC( QT_QPLAINTEXTEDIT_LOADRESOURCE ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QPlainTextEdit( 1 )->loadResource( hb_parni( 2 ), *hbqt_par_QUrl( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QPlainTextEdit( 1 )->loadResource( hb_parni( 2 ), *hbqt_par_QUrl( 3 ) ) ), true ) ); } /* @@ -508,7 +508,7 @@ HB_FUNC( QT_QPLAINTEXTEDIT_TABSTOPWIDTH ) */ HB_FUNC( QT_QPLAINTEXTEDIT_TEXTCURSOR ) { - hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QPlainTextEdit( 1 )->textCursor() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QPlainTextEdit( 1 )->textCursor() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QPolygon.cpp b/harbour/contrib/hbqt/qtgui/QPolygon.cpp index 6ae2fc31e6..b0a2414adf 100644 --- a/harbour/contrib/hbqt/qtgui/QPolygon.cpp +++ b/harbour/contrib/hbqt/qtgui/QPolygon.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,32 +79,49 @@ * ~QPolygon () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QPolygon; + QT_G_FUNC( hbqt_gcRelease_QPolygon ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPolygon p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPolygon ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QPolygon * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QPolygon Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QPolygon * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPolygon ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QPolygon Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QPolygon Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QPolygon Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QPolygon( void * pObj ) +void * hbqt_gcAllocate_QPolygon( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QPolygon; - HB_TRACE( HB_TR_DEBUG, ( " new_QPolygon %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QPolygon ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -114,14 +131,14 @@ HB_FUNC( QT_QPOLYGON ) pObj = new QPolygon() ; - hb_retptrGC( hbqt_gcAllocate_QPolygon( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QPolygon( pObj, true ) ); } /* * QRect boundingRect () const */ HB_FUNC( QT_QPOLYGON_BOUNDINGRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPolygon( 1 )->boundingRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPolygon( 1 )->boundingRect() ), true ) ); } /* @@ -137,7 +154,7 @@ HB_FUNC( QT_QPOLYGON_CONTAINSPOINT ) */ HB_FUNC( QT_QPOLYGON_INTERSECTED ) { - hb_retptrGC( hbqt_gcAllocate_QPolygon( new QPolygon( hbqt_par_QPolygon( 1 )->intersected( *hbqt_par_QPolygon( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPolygon( new QPolygon( hbqt_par_QPolygon( 1 )->intersected( *hbqt_par_QPolygon( 2 ) ) ), true ) ); } /* @@ -159,7 +176,7 @@ HB_FUNC( QT_QPOLYGON_POINT ) */ HB_FUNC( QT_QPOLYGON_POINT_1 ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QPolygon( 1 )->point( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QPolygon( 1 )->point( hb_parni( 2 ) ) ), true ) ); } /* @@ -203,7 +220,7 @@ HB_FUNC( QT_QPOLYGON_SETPOINTS ) */ HB_FUNC( QT_QPOLYGON_SUBTRACTED ) { - hb_retptrGC( hbqt_gcAllocate_QPolygon( new QPolygon( hbqt_par_QPolygon( 1 )->subtracted( *hbqt_par_QPolygon( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPolygon( new QPolygon( hbqt_par_QPolygon( 1 )->subtracted( *hbqt_par_QPolygon( 2 ) ) ), true ) ); } /* @@ -227,7 +244,7 @@ HB_FUNC( QT_QPOLYGON_TRANSLATE_1 ) */ HB_FUNC( QT_QPOLYGON_UNITED ) { - hb_retptrGC( hbqt_gcAllocate_QPolygon( new QPolygon( hbqt_par_QPolygon( 1 )->united( *hbqt_par_QPolygon( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPolygon( new QPolygon( hbqt_par_QPolygon( 1 )->united( *hbqt_par_QPolygon( 2 ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QPolygonF.cpp b/harbour/contrib/hbqt/qtgui/QPolygonF.cpp index bfa1206b0b..3da549fa83 100644 --- a/harbour/contrib/hbqt/qtgui/QPolygonF.cpp +++ b/harbour/contrib/hbqt/qtgui/QPolygonF.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,32 +80,49 @@ * ~QPolygonF () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QPolygonF; + QT_G_FUNC( hbqt_gcRelease_QPolygonF ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPolygonF p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPolygonF ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QPolygonF * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QPolygonF Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QPolygonF * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPolygonF ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QPolygonF Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QPolygonF Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QPolygonF Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QPolygonF( void * pObj ) +void * hbqt_gcAllocate_QPolygonF( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QPolygonF; - HB_TRACE( HB_TR_DEBUG, ( " new_QPolygonF %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QPolygonF ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -115,14 +132,14 @@ HB_FUNC( QT_QPOLYGONF ) pObj = new QPolygonF() ; - hb_retptrGC( hbqt_gcAllocate_QPolygonF( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QPolygonF( pObj, true ) ); } /* * QRectF boundingRect () const */ HB_FUNC( QT_QPOLYGONF_BOUNDINGRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QPolygonF( 1 )->boundingRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QPolygonF( 1 )->boundingRect() ), true ) ); } /* @@ -138,7 +155,7 @@ HB_FUNC( QT_QPOLYGONF_CONTAINSPOINT ) */ HB_FUNC( QT_QPOLYGONF_INTERSECTED ) { - hb_retptrGC( hbqt_gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QPolygonF( 1 )->intersected( *hbqt_par_QPolygonF( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QPolygonF( 1 )->intersected( *hbqt_par_QPolygonF( 2 ) ) ), true ) ); } /* @@ -154,7 +171,7 @@ HB_FUNC( QT_QPOLYGONF_ISCLOSED ) */ HB_FUNC( QT_QPOLYGONF_SUBTRACTED ) { - hb_retptrGC( hbqt_gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QPolygonF( 1 )->subtracted( *hbqt_par_QPolygonF( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QPolygonF( 1 )->subtracted( *hbqt_par_QPolygonF( 2 ) ) ), true ) ); } /* @@ -162,7 +179,7 @@ HB_FUNC( QT_QPOLYGONF_SUBTRACTED ) */ HB_FUNC( QT_QPOLYGONF_TOPOLYGON ) { - hb_retptrGC( hbqt_gcAllocate_QPolygon( new QPolygon( hbqt_par_QPolygonF( 1 )->toPolygon() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPolygon( new QPolygon( hbqt_par_QPolygonF( 1 )->toPolygon() ), true ) ); } /* @@ -186,7 +203,7 @@ HB_FUNC( QT_QPOLYGONF_TRANSLATE_1 ) */ HB_FUNC( QT_QPOLYGONF_UNITED ) { - hb_retptrGC( hbqt_gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QPolygonF( 1 )->united( *hbqt_par_QPolygonF( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QPolygonF( 1 )->united( *hbqt_par_QPolygonF( 2 ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QPrintDialog.cpp b/harbour/contrib/hbqt/qtgui/QPrintDialog.cpp index f2890b63ee..84fe27d78f 100644 --- a/harbour/contrib/hbqt/qtgui/QPrintDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QPrintDialog.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -85,6 +85,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QPrintDialog > pq; } QGC_POINTER_QPrintDialog; @@ -93,48 +94,47 @@ QT_G_FUNC( hbqt_gcRelease_QPrintDialog ) { QGC_POINTER_QPrintDialog * p = ( QGC_POINTER_QPrintDialog * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPrintDialog p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPrintDialog ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QPrintDialog * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QPrintDialog * ) p->ph )->~QPrintDialog(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QPrintDialog * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPrintDialog ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QPrintDialog ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPrintDialog Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QPrintDialog Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QPrintDialog Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QPrintDialog Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QPrintDialog Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QPrintDialog( void * pObj ) +void * hbqt_gcAllocate_QPrintDialog( void * pObj, bool bNew ) { QGC_POINTER_QPrintDialog * p = ( QGC_POINTER_QPrintDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QPrintDialog ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QPrintDialog; - new( & p->pq ) QPointer< QPrintDialog >( ( QPrintDialog * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QPrintDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QPrintDialog >( ( QPrintDialog * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QPrintDialog ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -144,7 +144,7 @@ HB_FUNC( QT_QPRINTDIALOG ) pObj = ( QPrintDialog* ) new QPrintDialog ( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QPrintDialog( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QPrintDialog( pObj, true ) ); } /* * virtual void done ( int result ) @@ -175,7 +175,7 @@ HB_FUNC( QT_QPRINTDIALOG_OPTIONS ) */ HB_FUNC( QT_QPRINTDIALOG_PRINTER ) { - hb_retptr( ( QPrinter* ) hbqt_par_QPrintDialog( 1 )->printer() ); + hb_retptrGC( hbqt_gcAllocate_QPrinter( hbqt_par_QPrintDialog( 1 )->printer(), false ) ); } /* @@ -183,7 +183,7 @@ HB_FUNC( QT_QPRINTDIALOG_PRINTER ) */ HB_FUNC( QT_QPRINTDIALOG_PRINTER_1 ) { - hb_retptr( ( QPrinter* ) hbqt_par_QPrintDialog( 1 )->printer() ); + hb_retptrGC( hbqt_gcAllocate_QPrinter( hbqt_par_QPrintDialog( 1 )->printer(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QPrintEngine.cpp b/harbour/contrib/hbqt/qtgui/QPrintEngine.cpp index 5d683e0a3c..67fff9d544 100644 --- a/harbour/contrib/hbqt/qtgui/QPrintEngine.cpp +++ b/harbour/contrib/hbqt/qtgui/QPrintEngine.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,11 +79,33 @@ * virtual ~QPrintEngine () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QPrintEngine; + QT_G_FUNC( hbqt_gcRelease_QPrintEngine ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QPrintEngine( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QPrintEngine; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QPrintEngine ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QPRINTENGINE ) { } @@ -124,7 +146,7 @@ HB_FUNC( QT_QPRINTENGINE_PRINTERSTATE ) */ HB_FUNC( QT_QPRINTENGINE_PROPERTY ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QPrintEngine( 1 )->property( ( QPrintEngine::PrintEnginePropertyKey ) hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QPrintEngine( 1 )->property( ( QPrintEngine::PrintEnginePropertyKey ) hb_parni( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QPrintPreviewDialog.cpp b/harbour/contrib/hbqt/qtgui/QPrintPreviewDialog.cpp index 5467b819b8..4173a326b5 100644 --- a/harbour/contrib/hbqt/qtgui/QPrintPreviewDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QPrintPreviewDialog.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,6 +80,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QPrintPreviewDialog > pq; } QGC_POINTER_QPrintPreviewDialog; @@ -88,48 +89,47 @@ QT_G_FUNC( hbqt_gcRelease_QPrintPreviewDialog ) { QGC_POINTER_QPrintPreviewDialog * p = ( QGC_POINTER_QPrintPreviewDialog * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPrintPreviewDialog p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPrintPreviewDialog ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QPrintPreviewDialog * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QPrintPreviewDialog * ) p->ph )->~QPrintPreviewDialog(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QPrintPreviewDialog * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPrintPreviewDialog ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QPrintPreviewDialog ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPrintPreviewDialog Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QPrintPreviewDialog Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QPrintPreviewDialog Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QPrintPreviewDialog Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QPrintPreviewDialog Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QPrintPreviewDialog( void * pObj ) +void * hbqt_gcAllocate_QPrintPreviewDialog( void * pObj, bool bNew ) { QGC_POINTER_QPrintPreviewDialog * p = ( QGC_POINTER_QPrintPreviewDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QPrintPreviewDialog ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QPrintPreviewDialog; - new( & p->pq ) QPointer< QPrintPreviewDialog >( ( QPrintPreviewDialog * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QPrintPreviewDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QPrintPreviewDialog >( ( QPrintPreviewDialog * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QPrintPreviewDialog ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -142,7 +142,7 @@ HB_FUNC( QT_QPRINTPREVIEWDIALOG ) else pObj = new QPrintPreviewDialog( hbqt_par_QWidget( 1 ), ( Qt::WindowFlags ) hb_parni( 2 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QPrintPreviewDialog( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QPrintPreviewDialog( pObj, true ) ); } /* * void open ( QObject * receiver, const char * member ) @@ -157,7 +157,7 @@ HB_FUNC( QT_QPRINTPREVIEWDIALOG_OPEN ) */ HB_FUNC( QT_QPRINTPREVIEWDIALOG_PRINTER ) { - hb_retptr( ( QPrinter* ) hbqt_par_QPrintPreviewDialog( 1 )->printer() ); + hb_retptrGC( hbqt_gcAllocate_QPrinter( hbqt_par_QPrintPreviewDialog( 1 )->printer(), false ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QPrinter.cpp b/harbour/contrib/hbqt/qtgui/QPrinter.cpp index bebabbe5ef..66d6bdb2da 100644 --- a/harbour/contrib/hbqt/qtgui/QPrinter.cpp +++ b/harbour/contrib/hbqt/qtgui/QPrinter.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -108,32 +108,49 @@ * ~QPrinter () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QPrinter; + QT_G_FUNC( hbqt_gcRelease_QPrinter ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPrinter p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPrinter ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QPrinter * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QPrinter Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QPrinter * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPrinter ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QPrinter Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QPrinter Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QPrinter Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QPrinter( void * pObj ) +void * hbqt_gcAllocate_QPrinter( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QPrinter; - HB_TRACE( HB_TR_DEBUG, ( " new_QPrinter %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QPrinter ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -143,7 +160,7 @@ HB_FUNC( QT_QPRINTER ) pObj = ( QPrinter* ) new QPrinter() ; - hb_retptrGC( hbqt_gcAllocate_QPrinter( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QPrinter( pObj, true ) ); } /* * bool abort () @@ -304,7 +321,7 @@ HB_FUNC( QT_QPRINTER_PAGEORDER ) */ HB_FUNC( QT_QPRINTER_PAGERECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPrinter( 1 )->pageRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPrinter( 1 )->pageRect() ), true ) ); } /* @@ -312,7 +329,7 @@ HB_FUNC( QT_QPRINTER_PAGERECT ) */ HB_FUNC( QT_QPRINTER_PAGERECT_1 ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QPrinter( 1 )->pageRect( ( QPrinter::Unit ) hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QPrinter( 1 )->pageRect( ( QPrinter::Unit ) hb_parni( 2 ) ) ), true ) ); } /* @@ -320,7 +337,7 @@ HB_FUNC( QT_QPRINTER_PAGERECT_1 ) */ HB_FUNC( QT_QPRINTER_PAINTENGINE ) { - hb_retptr( ( QPaintEngine* ) hbqt_par_QPrinter( 1 )->paintEngine() ); + hb_retptrGC( hbqt_gcAllocate_QPaintEngine( hbqt_par_QPrinter( 1 )->paintEngine(), false ) ); } /* @@ -328,7 +345,7 @@ HB_FUNC( QT_QPRINTER_PAINTENGINE ) */ HB_FUNC( QT_QPRINTER_PAPERRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPrinter( 1 )->paperRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QPrinter( 1 )->paperRect() ), true ) ); } /* @@ -336,7 +353,7 @@ HB_FUNC( QT_QPRINTER_PAPERRECT ) */ HB_FUNC( QT_QPRINTER_PAPERRECT_1 ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QPrinter( 1 )->paperRect( ( QPrinter::Unit ) hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QPrinter( 1 )->paperRect( ( QPrinter::Unit ) hb_parni( 2 ) ) ), true ) ); } /* @@ -352,7 +369,7 @@ HB_FUNC( QT_QPRINTER_PAPERSIZE ) */ HB_FUNC( QT_QPRINTER_PAPERSIZE_1 ) { - hb_retptrGC( hbqt_gcAllocate_QSizeF( new QSizeF( hbqt_par_QPrinter( 1 )->paperSize( ( QPrinter::Unit ) hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSizeF( new QSizeF( hbqt_par_QPrinter( 1 )->paperSize( ( QPrinter::Unit ) hb_parni( 2 ) ) ), true ) ); } /* @@ -368,7 +385,7 @@ HB_FUNC( QT_QPRINTER_PAPERSOURCE ) */ HB_FUNC( QT_QPRINTER_PRINTENGINE ) { - hb_retptr( ( QPrintEngine* ) hbqt_par_QPrinter( 1 )->printEngine() ); + hb_retptrGC( hbqt_gcAllocate_QPrintEngine( hbqt_par_QPrinter( 1 )->printEngine(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QProgressBar.cpp b/harbour/contrib/hbqt/qtgui/QProgressBar.cpp index fbe632f0b9..09a254f8f2 100644 --- a/harbour/contrib/hbqt/qtgui/QProgressBar.cpp +++ b/harbour/contrib/hbqt/qtgui/QProgressBar.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -82,6 +82,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QProgressBar > pq; } QGC_POINTER_QProgressBar; @@ -90,48 +91,47 @@ QT_G_FUNC( hbqt_gcRelease_QProgressBar ) { QGC_POINTER_QProgressBar * p = ( QGC_POINTER_QProgressBar * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QProgressBar p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QProgressBar ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QProgressBar * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QProgressBar * ) p->ph )->~QProgressBar(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QProgressBar * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QProgressBar ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QProgressBar ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QProgressBar Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QProgressBar Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QProgressBar Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QProgressBar Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QProgressBar Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QProgressBar( void * pObj ) +void * hbqt_gcAllocate_QProgressBar( void * pObj, bool bNew ) { QGC_POINTER_QProgressBar * p = ( QGC_POINTER_QProgressBar * ) hb_gcAllocate( sizeof( QGC_POINTER_QProgressBar ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QProgressBar; - new( & p->pq ) QPointer< QProgressBar >( ( QProgressBar * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QProgressBar %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QProgressBar >( ( QProgressBar * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QProgressBar ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -141,7 +141,7 @@ HB_FUNC( QT_QPROGRESSBAR ) pObj = ( QProgressBar* ) new QProgressBar( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QProgressBar( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QProgressBar( pObj, true ) ); } /* * Qt::Alignment alignment () const diff --git a/harbour/contrib/hbqt/qtgui/QProgressDialog.cpp b/harbour/contrib/hbqt/qtgui/QProgressDialog.cpp index 028b14929e..eca9cb36d7 100644 --- a/harbour/contrib/hbqt/qtgui/QProgressDialog.cpp +++ b/harbour/contrib/hbqt/qtgui/QProgressDialog.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,6 +80,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QProgressDialog > pq; } QGC_POINTER_QProgressDialog; @@ -88,48 +89,47 @@ QT_G_FUNC( hbqt_gcRelease_QProgressDialog ) { QGC_POINTER_QProgressDialog * p = ( QGC_POINTER_QProgressDialog * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QProgressDialog p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QProgressDialog ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QProgressDialog * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QProgressDialog * ) p->ph )->~QProgressDialog(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QProgressDialog * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QProgressDialog ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QProgressDialog ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QProgressDialog Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QProgressDialog Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QProgressDialog Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QProgressDialog Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QProgressDialog Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QProgressDialog( void * pObj ) +void * hbqt_gcAllocate_QProgressDialog( void * pObj, bool bNew ) { QGC_POINTER_QProgressDialog * p = ( QGC_POINTER_QProgressDialog * ) hb_gcAllocate( sizeof( QGC_POINTER_QProgressDialog ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QProgressDialog; - new( & p->pq ) QPointer< QProgressDialog >( ( QProgressDialog * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QProgressDialog %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QProgressDialog >( ( QProgressDialog * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QProgressDialog ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -139,7 +139,7 @@ HB_FUNC( QT_QPROGRESSDIALOG ) pObj = new QProgressDialog( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QProgressDialog( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QProgressDialog( pObj, true ) ); } /* * bool autoClose () const @@ -242,7 +242,7 @@ HB_FUNC( QT_QPROGRESSDIALOG_SETLABEL ) */ HB_FUNC( QT_QPROGRESSDIALOG_SIZEHINT ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QProgressDialog( 1 )->sizeHint() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QProgressDialog( 1 )->sizeHint() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QPushButton.cpp b/harbour/contrib/hbqt/qtgui/QPushButton.cpp index a361f76d46..1c9d9c7e85 100644 --- a/harbour/contrib/hbqt/qtgui/QPushButton.cpp +++ b/harbour/contrib/hbqt/qtgui/QPushButton.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,6 +81,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QPushButton > pq; } QGC_POINTER_QPushButton; @@ -89,48 +90,47 @@ QT_G_FUNC( hbqt_gcRelease_QPushButton ) { QGC_POINTER_QPushButton * p = ( QGC_POINTER_QPushButton * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPushButton p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPushButton ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QPushButton * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QPushButton * ) p->ph )->~QPushButton(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QPushButton * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QPushButton ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QPushButton ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QPushButton Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QPushButton Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QPushButton Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QPushButton Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QPushButton Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QPushButton( void * pObj ) +void * hbqt_gcAllocate_QPushButton( void * pObj, bool bNew ) { QGC_POINTER_QPushButton * p = ( QGC_POINTER_QPushButton * ) hb_gcAllocate( sizeof( QGC_POINTER_QPushButton ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QPushButton; - new( & p->pq ) QPointer< QPushButton >( ( QPushButton * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QPushButton %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QPushButton >( ( QPushButton * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QPushButton ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -140,7 +140,7 @@ HB_FUNC( QT_QPUSHBUTTON ) pObj = ( QPushButton* ) new QPushButton( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QPushButton( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QPushButton( pObj, true ) ); } /* * bool autoDefault () const @@ -171,7 +171,7 @@ HB_FUNC( QT_QPUSHBUTTON_ISFLAT ) */ HB_FUNC( QT_QPUSHBUTTON_MENU ) { - hb_retptr( ( QMenu* ) hbqt_par_QPushButton( 1 )->menu() ); + hb_retptrGC( hbqt_gcAllocate_QMenu( hbqt_par_QPushButton( 1 )->menu(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QRadialGradient.cpp b/harbour/contrib/hbqt/qtgui/QRadialGradient.cpp index 336437569b..7947839fd6 100644 --- a/harbour/contrib/hbqt/qtgui/QRadialGradient.cpp +++ b/harbour/contrib/hbqt/qtgui/QRadialGradient.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -85,32 +85,49 @@ * QRadialGradient ( qreal cx, qreal cy, qreal radius ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QRadialGradient; + QT_G_FUNC( hbqt_gcRelease_QRadialGradient ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QRadialGradient p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QRadialGradient ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QRadialGradient * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QRadialGradient Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QRadialGradient * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QRadialGradient ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QRadialGradient Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QRadialGradient Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QRadialGradient Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QRadialGradient( void * pObj ) +void * hbqt_gcAllocate_QRadialGradient( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QRadialGradient; - HB_TRACE( HB_TR_DEBUG, ( " new_QRadialGradient %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QRadialGradient ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -139,14 +156,14 @@ HB_FUNC( QT_QRADIALGRADIENT ) pObj = ( QRadialGradient* ) new QRadialGradient() ; } - hb_retptrGC( hbqt_gcAllocate_QRadialGradient( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QRadialGradient( pObj, true ) ); } /* * QPointF center () const */ HB_FUNC( QT_QRADIALGRADIENT_CENTER ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QRadialGradient( 1 )->center() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QRadialGradient( 1 )->center() ), true ) ); } /* @@ -154,7 +171,7 @@ HB_FUNC( QT_QRADIALGRADIENT_CENTER ) */ HB_FUNC( QT_QRADIALGRADIENT_FOCALPOINT ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QRadialGradient( 1 )->focalPoint() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QRadialGradient( 1 )->focalPoint() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QRadioButton.cpp b/harbour/contrib/hbqt/qtgui/QRadioButton.cpp index a22a21a7f6..9be51831c7 100644 --- a/harbour/contrib/hbqt/qtgui/QRadioButton.cpp +++ b/harbour/contrib/hbqt/qtgui/QRadioButton.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QRadioButton > pq; } QGC_POINTER_QRadioButton; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QRadioButton ) { QGC_POINTER_QRadioButton * p = ( QGC_POINTER_QRadioButton * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QRadioButton p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QRadioButton ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QRadioButton * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QRadioButton * ) p->ph )->~QRadioButton(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QRadioButton * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QRadioButton ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QRadioButton ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QRadioButton Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QRadioButton Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QRadioButton Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QRadioButton Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QRadioButton Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QRadioButton( void * pObj ) +void * hbqt_gcAllocate_QRadioButton( void * pObj, bool bNew ) { QGC_POINTER_QRadioButton * p = ( QGC_POINTER_QRadioButton * ) hb_gcAllocate( sizeof( QGC_POINTER_QRadioButton ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QRadioButton; - new( & p->pq ) QPointer< QRadioButton >( ( QRadioButton * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QRadioButton %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QRadioButton >( ( QRadioButton * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QRadioButton ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -141,7 +141,7 @@ HB_FUNC( QT_QRADIOBUTTON ) else pObj = ( QRadioButton* ) new QRadioButton( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QRadioButton( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QRadioButton( pObj, true ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QRegion.cpp b/harbour/contrib/hbqt/qtgui/QRegion.cpp index 0fd53c2907..5435255a65 100644 --- a/harbour/contrib/hbqt/qtgui/QRegion.cpp +++ b/harbour/contrib/hbqt/qtgui/QRegion.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -98,32 +98,49 @@ * ~QRegion () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QRegion; + QT_G_FUNC( hbqt_gcRelease_QRegion ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QRegion p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QRegion ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QRegion * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QRegion Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QRegion * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QRegion ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QRegion Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QRegion Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QRegion Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QRegion( void * pObj ) +void * hbqt_gcAllocate_QRegion( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QRegion; - HB_TRACE( HB_TR_DEBUG, ( " new_QRegion %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QRegion ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -167,14 +184,14 @@ HB_FUNC( QT_QREGION ) pObj = ( QRegion* ) new QRegion() ; } - hb_retptrGC( hbqt_gcAllocate_QRegion( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QRegion( pObj, true ) ); } /* * QRect boundingRect () const */ HB_FUNC( QT_QREGION_BOUNDINGRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QRegion( 1 )->boundingRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QRegion( 1 )->boundingRect() ), true ) ); } /* @@ -198,7 +215,7 @@ HB_FUNC( QT_QREGION_CONTAINS_1 ) */ HB_FUNC( QT_QREGION_INTERSECTED ) { - hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->intersected( *hbqt_par_QRegion( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->intersected( *hbqt_par_QRegion( 2 ) ) ), true ) ); } /* @@ -206,7 +223,7 @@ HB_FUNC( QT_QREGION_INTERSECTED ) */ HB_FUNC( QT_QREGION_INTERSECTED_1 ) { - hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->intersected( *hbqt_par_QRect( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->intersected( *hbqt_par_QRect( 2 ) ) ), true ) ); } /* @@ -254,7 +271,7 @@ HB_FUNC( QT_QREGION_SETRECTS ) */ HB_FUNC( QT_QREGION_SUBTRACTED ) { - hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->subtracted( *hbqt_par_QRegion( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->subtracted( *hbqt_par_QRegion( 2 ) ) ), true ) ); } /* @@ -278,7 +295,7 @@ HB_FUNC( QT_QREGION_TRANSLATE_1 ) */ HB_FUNC( QT_QREGION_TRANSLATED ) { - hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->translated( hb_parni( 2 ), hb_parni( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->translated( hb_parni( 2 ), hb_parni( 3 ) ) ), true ) ); } /* @@ -286,7 +303,7 @@ HB_FUNC( QT_QREGION_TRANSLATED ) */ HB_FUNC( QT_QREGION_TRANSLATED_1 ) { - hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->translated( *hbqt_par_QPoint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->translated( *hbqt_par_QPoint( 2 ) ) ), true ) ); } /* @@ -294,7 +311,7 @@ HB_FUNC( QT_QREGION_TRANSLATED_1 ) */ HB_FUNC( QT_QREGION_UNITED ) { - hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->united( *hbqt_par_QRegion( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->united( *hbqt_par_QRegion( 2 ) ) ), true ) ); } /* @@ -302,7 +319,7 @@ HB_FUNC( QT_QREGION_UNITED ) */ HB_FUNC( QT_QREGION_UNITED_1 ) { - hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->united( *hbqt_par_QRect( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->united( *hbqt_par_QRect( 2 ) ) ), true ) ); } /* @@ -310,7 +327,7 @@ HB_FUNC( QT_QREGION_UNITED_1 ) */ HB_FUNC( QT_QREGION_XORED ) { - hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->xored( *hbqt_par_QRegion( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QRegion( 1 )->xored( *hbqt_par_QRegion( 2 ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QResizeEvent.cpp b/harbour/contrib/hbqt/qtgui/QResizeEvent.cpp index 45afeac8d3..8acfa06d4c 100644 --- a/harbour/contrib/hbqt/qtgui/QResizeEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QResizeEvent.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -75,11 +75,33 @@ * QResizeEvent ( const QSize & size, const QSize & oldSize ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QResizeEvent; + QT_G_FUNC( hbqt_gcRelease_QResizeEvent ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QResizeEvent( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QResizeEvent; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QResizeEvent ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QRESIZEEVENT ) { } @@ -88,7 +110,7 @@ HB_FUNC( QT_QRESIZEEVENT ) */ HB_FUNC( QT_QRESIZEEVENT_OLDSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QResizeEvent( 1 )->oldSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QResizeEvent( 1 )->oldSize() ), true ) ); } /* @@ -96,7 +118,7 @@ HB_FUNC( QT_QRESIZEEVENT_OLDSIZE ) */ HB_FUNC( QT_QRESIZEEVENT_SIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QResizeEvent( 1 )->size() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QResizeEvent( 1 )->size() ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QScrollArea.cpp b/harbour/contrib/hbqt/qtgui/QScrollArea.cpp index 7a4f196b9b..7f4884babd 100644 --- a/harbour/contrib/hbqt/qtgui/QScrollArea.cpp +++ b/harbour/contrib/hbqt/qtgui/QScrollArea.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QScrollArea > pq; } QGC_POINTER_QScrollArea; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QScrollArea ) { QGC_POINTER_QScrollArea * p = ( QGC_POINTER_QScrollArea * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QScrollArea p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QScrollArea ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QScrollArea * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QScrollArea * ) p->ph )->~QScrollArea(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QScrollArea * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QScrollArea ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QScrollArea ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QScrollArea Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QScrollArea Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QScrollArea Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QScrollArea Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QScrollArea Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QScrollArea( void * pObj ) +void * hbqt_gcAllocate_QScrollArea( void * pObj, bool bNew ) { QGC_POINTER_QScrollArea * p = ( QGC_POINTER_QScrollArea * ) hb_gcAllocate( sizeof( QGC_POINTER_QScrollArea ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QScrollArea; - new( & p->pq ) QPointer< QScrollArea >( ( QScrollArea * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QScrollArea %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QScrollArea >( ( QScrollArea * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QScrollArea ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -138,7 +138,7 @@ HB_FUNC( QT_QSCROLLAREA ) pObj = ( QScrollArea* ) new QScrollArea( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QScrollArea( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QScrollArea( pObj, true ) ); } /* * Qt::Alignment alignment () const @@ -193,7 +193,7 @@ HB_FUNC( QT_QSCROLLAREA_SETWIDGETRESIZABLE ) */ HB_FUNC( QT_QSCROLLAREA_TAKEWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QScrollArea( 1 )->takeWidget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QScrollArea( 1 )->takeWidget(), false ) ); } /* @@ -201,7 +201,7 @@ HB_FUNC( QT_QSCROLLAREA_TAKEWIDGET ) */ HB_FUNC( QT_QSCROLLAREA_WIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QScrollArea( 1 )->widget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QScrollArea( 1 )->widget(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QScrollBar.cpp b/harbour/contrib/hbqt/qtgui/QScrollBar.cpp index 84bd9ddf47..06bb6c0627 100644 --- a/harbour/contrib/hbqt/qtgui/QScrollBar.cpp +++ b/harbour/contrib/hbqt/qtgui/QScrollBar.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,6 +80,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QScrollBar > pq; } QGC_POINTER_QScrollBar; @@ -88,48 +89,47 @@ QT_G_FUNC( hbqt_gcRelease_QScrollBar ) { QGC_POINTER_QScrollBar * p = ( QGC_POINTER_QScrollBar * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QScrollBar p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QScrollBar ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QScrollBar * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QScrollBar * ) p->ph )->~QScrollBar(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QScrollBar * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QScrollBar ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QScrollBar ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QScrollBar Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QScrollBar Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QScrollBar Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QScrollBar Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QScrollBar Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QScrollBar( void * pObj ) +void * hbqt_gcAllocate_QScrollBar( void * pObj, bool bNew ) { QGC_POINTER_QScrollBar * p = ( QGC_POINTER_QScrollBar * ) hb_gcAllocate( sizeof( QGC_POINTER_QScrollBar ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QScrollBar; - new( & p->pq ) QPointer< QScrollBar >( ( QScrollBar * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QScrollBar %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QScrollBar >( ( QScrollBar * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QScrollBar ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -139,7 +139,7 @@ HB_FUNC( QT_QSCROLLBAR ) pObj = ( QScrollBar* ) new QScrollBar( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QScrollBar( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QScrollBar( pObj, true ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QSessionManager.cpp b/harbour/contrib/hbqt/qtgui/QSessionManager.cpp index 43aa0c88ca..4c5111202a 100644 --- a/harbour/contrib/hbqt/qtgui/QSessionManager.cpp +++ b/harbour/contrib/hbqt/qtgui/QSessionManager.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,11 +79,35 @@ * */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QSessionManager > pq; +} QGC_POINTER_QSessionManager; + QT_G_FUNC( hbqt_gcRelease_QSessionManager ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QSessionManager( void * pObj, bool bNew ) +{ + QGC_POINTER_QSessionManager * p = ( QGC_POINTER_QSessionManager * ) hb_gcAllocate( sizeof( QGC_POINTER_QSessionManager ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QSessionManager; + + if( bNew ) + { + new( & p->pq ) QPointer< QSessionManager >( ( QSessionManager * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QSessionManager ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QSESSIONMANAGER ) { } @@ -116,7 +140,7 @@ HB_FUNC( QT_QSESSIONMANAGER_CANCEL ) */ HB_FUNC( QT_QSESSIONMANAGER_DISCARDCOMMAND ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QSessionManager( 1 )->discardCommand() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QSessionManager( 1 )->discardCommand() ), true ) ); } /* @@ -148,7 +172,7 @@ HB_FUNC( QT_QSESSIONMANAGER_REQUESTPHASE2 ) */ HB_FUNC( QT_QSESSIONMANAGER_RESTARTCOMMAND ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QSessionManager( 1 )->restartCommand() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QSessionManager( 1 )->restartCommand() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QSizeGrip.cpp b/harbour/contrib/hbqt/qtgui/QSizeGrip.cpp index 4739d97fa6..b378e12748 100644 --- a/harbour/contrib/hbqt/qtgui/QSizeGrip.cpp +++ b/harbour/contrib/hbqt/qtgui/QSizeGrip.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QSizeGrip > pq; } QGC_POINTER_QSizeGrip; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QSizeGrip ) { QGC_POINTER_QSizeGrip * p = ( QGC_POINTER_QSizeGrip * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSizeGrip p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSizeGrip ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QSizeGrip * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QSizeGrip * ) p->ph )->~QSizeGrip(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QSizeGrip * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QSizeGrip ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QSizeGrip ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSizeGrip Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QSizeGrip Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QSizeGrip Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QSizeGrip Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QSizeGrip Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QSizeGrip( void * pObj ) +void * hbqt_gcAllocate_QSizeGrip( void * pObj, bool bNew ) { QGC_POINTER_QSizeGrip * p = ( QGC_POINTER_QSizeGrip * ) hb_gcAllocate( sizeof( QGC_POINTER_QSizeGrip ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QSizeGrip; - new( & p->pq ) QPointer< QSizeGrip >( ( QSizeGrip * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QSizeGrip %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QSizeGrip >( ( QSizeGrip * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QSizeGrip ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -138,7 +138,7 @@ HB_FUNC( QT_QSIZEGRIP ) pObj = ( QSizeGrip* ) new QSizeGrip( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QSizeGrip( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QSizeGrip( pObj, true ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QSizePolicy.cpp b/harbour/contrib/hbqt/qtgui/QSizePolicy.cpp index 89cae5b746..31d3dbad6c 100644 --- a/harbour/contrib/hbqt/qtgui/QSizePolicy.cpp +++ b/harbour/contrib/hbqt/qtgui/QSizePolicy.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -84,32 +84,49 @@ * QSizePolicy ( Policy horizontal, Policy vertical, ControlType type ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QSizePolicy; + QT_G_FUNC( hbqt_gcRelease_QSizePolicy ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSizePolicy p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSizePolicy ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QSizePolicy * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QSizePolicy Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QSizePolicy * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QSizePolicy ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QSizePolicy Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QSizePolicy Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QSizePolicy Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QSizePolicy( void * pObj ) +void * hbqt_gcAllocate_QSizePolicy( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QSizePolicy; - HB_TRACE( HB_TR_DEBUG, ( " new_QSizePolicy %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QSizePolicy ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -119,7 +136,7 @@ HB_FUNC( QT_QSIZEPOLICY ) pObj = ( QSizePolicy* ) new QSizePolicy() ; - hb_retptrGC( hbqt_gcAllocate_QSizePolicy( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QSizePolicy( pObj, true ) ); } /* * ControlType controlType () const diff --git a/harbour/contrib/hbqt/qtgui/QSlider.cpp b/harbour/contrib/hbqt/qtgui/QSlider.cpp index 655ee56876..8a99ffe57e 100644 --- a/harbour/contrib/hbqt/qtgui/QSlider.cpp +++ b/harbour/contrib/hbqt/qtgui/QSlider.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -84,6 +84,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QSlider > pq; } QGC_POINTER_QSlider; @@ -92,48 +93,47 @@ QT_G_FUNC( hbqt_gcRelease_QSlider ) { QGC_POINTER_QSlider * p = ( QGC_POINTER_QSlider * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSlider p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSlider ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QSlider * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QSlider * ) p->ph )->~QSlider(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QSlider * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QSlider ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QSlider ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSlider Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QSlider Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QSlider Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QSlider Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QSlider Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QSlider( void * pObj ) +void * hbqt_gcAllocate_QSlider( void * pObj, bool bNew ) { QGC_POINTER_QSlider * p = ( QGC_POINTER_QSlider * ) hb_gcAllocate( sizeof( QGC_POINTER_QSlider ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QSlider; - new( & p->pq ) QPointer< QSlider >( ( QSlider * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QSlider %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QSlider >( ( QSlider * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QSlider ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -146,7 +146,7 @@ HB_FUNC( QT_QSLIDER ) else pObj = ( QSlider* ) new QSlider( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QSlider( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QSlider( pObj, true ) ); } /* * void setTickInterval ( int ti ) diff --git a/harbour/contrib/hbqt/qtgui/QSound.cpp b/harbour/contrib/hbqt/qtgui/QSound.cpp index 2738a8c49f..03ab6fe2f0 100644 --- a/harbour/contrib/hbqt/qtgui/QSound.cpp +++ b/harbour/contrib/hbqt/qtgui/QSound.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QSound > pq; } QGC_POINTER_QSound; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QSound ) { QGC_POINTER_QSound * p = ( QGC_POINTER_QSound * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSound p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSound ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QSound * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QSound * ) p->ph )->~QSound(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QSound * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QSound ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QSound ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSound Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QSound Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QSound Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QSound Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QSound Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QSound( void * pObj ) +void * hbqt_gcAllocate_QSound( void * pObj, bool bNew ) { QGC_POINTER_QSound * p = ( QGC_POINTER_QSound * ) hb_gcAllocate( sizeof( QGC_POINTER_QSound ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QSound; - new( & p->pq ) QPointer< QSound >( ( QSound * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QSound %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QSound >( ( QSound * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QSound ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -138,7 +138,7 @@ HB_FUNC( QT_QSOUND ) pObj = ( QSound* ) new QSound( hbqt_par_QString( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QSound( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QSound( pObj, true ) ); } /* * QString fileName () const diff --git a/harbour/contrib/hbqt/qtgui/QSpacerItem.cpp b/harbour/contrib/hbqt/qtgui/QSpacerItem.cpp index d64c7a21fc..7238b2d0db 100644 --- a/harbour/contrib/hbqt/qtgui/QSpacerItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QSpacerItem.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -75,32 +75,49 @@ * */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QSpacerItem; + QT_G_FUNC( hbqt_gcRelease_QSpacerItem ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSpacerItem p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSpacerItem ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QSpacerItem * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QSpacerItem Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QSpacerItem * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QSpacerItem ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QSpacerItem Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QSpacerItem Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QSpacerItem Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QSpacerItem( void * pObj ) +void * hbqt_gcAllocate_QSpacerItem( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QSpacerItem; - HB_TRACE( HB_TR_DEBUG, ( " new_QSpacerItem %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QSpacerItem ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -113,7 +130,7 @@ HB_FUNC( QT_QSPACERITEM ) pObj = new QSpacerItem( *hbqt_par_QSpacerItem( 1 ) ) ; } - hb_retptrGC( hbqt_gcAllocate_QSpacerItem( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QSpacerItem( pObj, true ) ); } /* * void changeSize ( int w, int h, QSizePolicy::Policy hPolicy = QSizePolicy::Minimum, QSizePolicy::Policy vPolicy = QSizePolicy::Minimum ) @@ -136,7 +153,7 @@ HB_FUNC( QT_QSPACERITEM_ISEMPTY ) */ HB_FUNC( QT_QSPACERITEM_SPACERITEM ) { - hb_retptr( ( QSpacerItem* ) hbqt_par_QSpacerItem( 1 )->spacerItem() ); + hb_retptrGC( hbqt_gcAllocate_QSpacerItem( hbqt_par_QSpacerItem( 1 )->spacerItem(), false ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QSpinBox.cpp b/harbour/contrib/hbqt/qtgui/QSpinBox.cpp index d06bef7a40..eff6322a3a 100644 --- a/harbour/contrib/hbqt/qtgui/QSpinBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QSpinBox.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -78,6 +78,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QSpinBox > pq; } QGC_POINTER_QSpinBox; @@ -86,48 +87,47 @@ QT_G_FUNC( hbqt_gcRelease_QSpinBox ) { QGC_POINTER_QSpinBox * p = ( QGC_POINTER_QSpinBox * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSpinBox p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSpinBox ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QSpinBox * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QSpinBox * ) p->ph )->~QSpinBox(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QSpinBox * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QSpinBox ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QSpinBox ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSpinBox Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QSpinBox Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QSpinBox Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QSpinBox Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QSpinBox Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QSpinBox( void * pObj ) +void * hbqt_gcAllocate_QSpinBox( void * pObj, bool bNew ) { QGC_POINTER_QSpinBox * p = ( QGC_POINTER_QSpinBox * ) hb_gcAllocate( sizeof( QGC_POINTER_QSpinBox ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QSpinBox; - new( & p->pq ) QPointer< QSpinBox >( ( QSpinBox * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QSpinBox %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QSpinBox >( ( QSpinBox * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QSpinBox ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -137,7 +137,7 @@ HB_FUNC( QT_QSPINBOX ) pObj = ( QSpinBox* ) new QSpinBox( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QSpinBox( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QSpinBox( pObj, true ) ); } /* * QString cleanText () const diff --git a/harbour/contrib/hbqt/qtgui/QSplashScreen.cpp b/harbour/contrib/hbqt/qtgui/QSplashScreen.cpp index 1d622aa6d1..8977b88954 100644 --- a/harbour/contrib/hbqt/qtgui/QSplashScreen.cpp +++ b/harbour/contrib/hbqt/qtgui/QSplashScreen.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,6 +80,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QSplashScreen > pq; } QGC_POINTER_QSplashScreen; @@ -88,48 +89,47 @@ QT_G_FUNC( hbqt_gcRelease_QSplashScreen ) { QGC_POINTER_QSplashScreen * p = ( QGC_POINTER_QSplashScreen * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSplashScreen p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSplashScreen ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QSplashScreen * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QSplashScreen * ) p->ph )->~QSplashScreen(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QSplashScreen * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QSplashScreen ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QSplashScreen ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSplashScreen Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QSplashScreen Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QSplashScreen Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QSplashScreen Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QSplashScreen Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QSplashScreen( void * pObj ) +void * hbqt_gcAllocate_QSplashScreen( void * pObj, bool bNew ) { QGC_POINTER_QSplashScreen * p = ( QGC_POINTER_QSplashScreen * ) hb_gcAllocate( sizeof( QGC_POINTER_QSplashScreen ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QSplashScreen; - new( & p->pq ) QPointer< QSplashScreen >( ( QSplashScreen * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QSplashScreen %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QSplashScreen >( ( QSplashScreen * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QSplashScreen ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -139,7 +139,7 @@ HB_FUNC( QT_QSPLASHSCREEN ) pObj = new QSplashScreen( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QSplashScreen( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QSplashScreen( pObj, true ) ); } /* * void finish ( QWidget * mainWin ) @@ -154,7 +154,7 @@ HB_FUNC( QT_QSPLASHSCREEN_FINISH ) */ HB_FUNC( QT_QSPLASHSCREEN_PIXMAP ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QSplashScreen( 1 )->pixmap() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QSplashScreen( 1 )->pixmap() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QSplitter.cpp b/harbour/contrib/hbqt/qtgui/QSplitter.cpp index 7f727c5e0f..b5110b6382 100644 --- a/harbour/contrib/hbqt/qtgui/QSplitter.cpp +++ b/harbour/contrib/hbqt/qtgui/QSplitter.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -67,13 +67,17 @@ /*----------------------------------------------------------------------*/ /* - * Constructed[ 21/23 [ 91.30% ] ] + * Constructed[ 20/23 [ 86.96% ] ] * * *** Unconvered Prototypes *** * ----------------------------- * * void setSizes ( const QList & list ) * QList sizes () const + * + * *** Commented out protos which construct fine but do not compile *** + * + * //QSplitterHandle * handle ( int index ) const */ #include @@ -90,6 +94,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QSplitter > pq; } QGC_POINTER_QSplitter; @@ -98,48 +103,47 @@ QT_G_FUNC( hbqt_gcRelease_QSplitter ) { QGC_POINTER_QSplitter * p = ( QGC_POINTER_QSplitter * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSplitter p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSplitter ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QSplitter * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QSplitter * ) p->ph )->~QSplitter(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QSplitter * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QSplitter ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QSplitter ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSplitter Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QSplitter Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QSplitter Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QSplitter Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QSplitter Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QSplitter( void * pObj ) +void * hbqt_gcAllocate_QSplitter( void * pObj, bool bNew ) { QGC_POINTER_QSplitter * p = ( QGC_POINTER_QSplitter * ) hb_gcAllocate( sizeof( QGC_POINTER_QSplitter ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QSplitter; - new( & p->pq ) QPointer< QSplitter >( ( QSplitter * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QSplitter %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QSplitter >( ( QSplitter * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QSplitter ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -152,7 +156,7 @@ HB_FUNC( QT_QSPLITTER ) else pObj = ( QSplitter* ) new QSplitter( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QSplitter( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QSplitter( pObj, true ) ); } /* * void addWidget ( QWidget * widget ) @@ -192,14 +196,6 @@ HB_FUNC( QT_QSPLITTER_GETRANGE ) hb_storni( iMax, 4 ); } -/* - * QSplitterHandle * handle ( int index ) const - */ -HB_FUNC( QT_QSPLITTER_HANDLE ) -{ - hb_retptr( ( QSplitterHandle* ) hbqt_par_QSplitter( 1 )->handle( hb_parni( 2 ) ) ); -} - /* * int handleWidth () const */ @@ -269,7 +265,7 @@ HB_FUNC( QT_QSPLITTER_RESTORESTATE ) */ HB_FUNC( QT_QSPLITTER_SAVESTATE ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QSplitter( 1 )->saveState() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QSplitter( 1 )->saveState() ), true ) ); } /* @@ -325,7 +321,7 @@ HB_FUNC( QT_QSPLITTER_SETSTRETCHFACTOR ) */ HB_FUNC( QT_QSPLITTER_WIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QSplitter( 1 )->widget( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QSplitter( 1 )->widget( hb_parni( 2 ) ), false ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStandardItem.cpp b/harbour/contrib/hbqt/qtgui/QStandardItem.cpp index 2bdcb79d15..4708921408 100644 --- a/harbour/contrib/hbqt/qtgui/QStandardItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QStandardItem.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -99,32 +99,49 @@ * virtual ~QStandardItem () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStandardItem; + QT_G_FUNC( hbqt_gcRelease_QStandardItem ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStandardItem p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStandardItem ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStandardItem * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStandardItem Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStandardItem * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStandardItem ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStandardItem Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStandardItem Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStandardItem Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStandardItem( void * pObj ) +void * hbqt_gcAllocate_QStandardItem( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStandardItem; - HB_TRACE( HB_TR_DEBUG, ( " new_QStandardItem %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStandardItem ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -134,7 +151,7 @@ HB_FUNC( QT_QSTANDARDITEM ) pObj = ( QStandardItem* ) new QStandardItem() ; - hb_retptrGC( hbqt_gcAllocate_QStandardItem( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStandardItem( pObj, true ) ); } /* * QString accessibleDescription () const @@ -165,7 +182,7 @@ HB_FUNC( QT_QSTANDARDITEM_APPENDROW ) */ HB_FUNC( QT_QSTANDARDITEM_BACKGROUND ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QStandardItem( 1 )->background() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QStandardItem( 1 )->background() ), true ) ); } /* @@ -181,7 +198,7 @@ HB_FUNC( QT_QSTANDARDITEM_CHECKSTATE ) */ HB_FUNC( QT_QSTANDARDITEM_CHILD ) { - hb_retptr( ( QStandardItem* ) hbqt_par_QStandardItem( 1 )->child( hb_parni( 2 ), hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStandardItem( hbqt_par_QStandardItem( 1 )->child( hb_parni( 2 ), hb_parni( 3 ) ), false ) ); } /* @@ -189,7 +206,7 @@ HB_FUNC( QT_QSTANDARDITEM_CHILD ) */ HB_FUNC( QT_QSTANDARDITEM_CLONE ) { - hb_retptr( ( QStandardItem* ) hbqt_par_QStandardItem( 1 )->clone() ); + hb_retptrGC( hbqt_gcAllocate_QStandardItem( hbqt_par_QStandardItem( 1 )->clone(), false ) ); } /* @@ -213,7 +230,7 @@ HB_FUNC( QT_QSTANDARDITEM_COLUMNCOUNT ) */ HB_FUNC( QT_QSTANDARDITEM_DATA ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QStandardItem( 1 )->data( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : Qt::UserRole + 1 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QStandardItem( 1 )->data( ( HB_ISNUM( 2 ) ? hb_parni( 2 ) : Qt::UserRole + 1 ) ) ), true ) ); } /* @@ -229,7 +246,7 @@ HB_FUNC( QT_QSTANDARDITEM_FLAGS ) */ HB_FUNC( QT_QSTANDARDITEM_FONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QStandardItem( 1 )->font() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QStandardItem( 1 )->font() ), true ) ); } /* @@ -237,7 +254,7 @@ HB_FUNC( QT_QSTANDARDITEM_FONT ) */ HB_FUNC( QT_QSTANDARDITEM_FOREGROUND ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QStandardItem( 1 )->foreground() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QStandardItem( 1 )->foreground() ), true ) ); } /* @@ -253,7 +270,7 @@ HB_FUNC( QT_QSTANDARDITEM_HASCHILDREN ) */ HB_FUNC( QT_QSTANDARDITEM_ICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStandardItem( 1 )->icon() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStandardItem( 1 )->icon() ), true ) ); } /* @@ -261,7 +278,7 @@ HB_FUNC( QT_QSTANDARDITEM_ICON ) */ HB_FUNC( QT_QSTANDARDITEM_INDEX ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QStandardItem( 1 )->index() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QStandardItem( 1 )->index() ), true ) ); } /* @@ -349,7 +366,7 @@ HB_FUNC( QT_QSTANDARDITEM_ISTRISTATE ) */ HB_FUNC( QT_QSTANDARDITEM_MODEL ) { - hb_retptr( ( QStandardItemModel* ) hbqt_par_QStandardItem( 1 )->model() ); + hb_retptrGC( hbqt_gcAllocate_QStandardItemModel( hbqt_par_QStandardItem( 1 )->model(), false ) ); } /* @@ -357,7 +374,7 @@ HB_FUNC( QT_QSTANDARDITEM_MODEL ) */ HB_FUNC( QT_QSTANDARDITEM_PARENT ) { - hb_retptr( ( QStandardItem* ) hbqt_par_QStandardItem( 1 )->parent() ); + hb_retptrGC( hbqt_gcAllocate_QStandardItem( hbqt_par_QStandardItem( 1 )->parent(), false ) ); } /* @@ -629,7 +646,7 @@ HB_FUNC( QT_QSTANDARDITEM_SETWHATSTHIS ) */ HB_FUNC( QT_QSTANDARDITEM_SIZEHINT ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStandardItem( 1 )->sizeHint() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStandardItem( 1 )->sizeHint() ), true ) ); } /* @@ -653,7 +670,7 @@ HB_FUNC( QT_QSTANDARDITEM_STATUSTIP ) */ HB_FUNC( QT_QSTANDARDITEM_TAKECHILD ) { - hb_retptr( ( QStandardItem* ) hbqt_par_QStandardItem( 1 )->takeChild( hb_parni( 2 ), hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStandardItem( hbqt_par_QStandardItem( 1 )->takeChild( hb_parni( 2 ), hb_parni( 3 ) ), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStandardItemModel.cpp b/harbour/contrib/hbqt/qtgui/QStandardItemModel.cpp index ba79bcf020..fd6208e0b2 100644 --- a/harbour/contrib/hbqt/qtgui/QStandardItemModel.cpp +++ b/harbour/contrib/hbqt/qtgui/QStandardItemModel.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -67,7 +67,7 @@ /*----------------------------------------------------------------------*/ /* - * Constructed[ 26/33 [ 78.79% ] ] + * Constructed[ 25/33 [ 75.76% ] ] * * *** Unconvered Prototypes *** * ----------------------------- @@ -79,6 +79,10 @@ * void insertRow ( int row, const QList & items ) * QList takeColumn ( int column ) * QList takeRow ( int row ) + * + * *** Commented out protos which construct fine but do not compile *** + * + * // const QStandardItem * itemPrototype () const */ #include @@ -95,6 +99,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QStandardItemModel > pq; } QGC_POINTER_QStandardItemModel; @@ -103,48 +108,47 @@ QT_G_FUNC( hbqt_gcRelease_QStandardItemModel ) { QGC_POINTER_QStandardItemModel * p = ( QGC_POINTER_QStandardItemModel * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStandardItemModel p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStandardItemModel ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QStandardItemModel * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QStandardItemModel * ) p->ph )->~QStandardItemModel(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QStandardItemModel * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStandardItemModel ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QStandardItemModel ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStandardItemModel Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QStandardItemModel Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStandardItemModel Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStandardItemModel Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStandardItemModel Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStandardItemModel( void * pObj ) +void * hbqt_gcAllocate_QStandardItemModel( void * pObj, bool bNew ) { QGC_POINTER_QStandardItemModel * p = ( QGC_POINTER_QStandardItemModel * ) hb_gcAllocate( sizeof( QGC_POINTER_QStandardItemModel ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStandardItemModel; - new( & p->pq ) QPointer< QStandardItemModel >( ( QStandardItemModel * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QStandardItemModel %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QStandardItemModel >( ( QStandardItemModel * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QStandardItemModel ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -154,7 +158,7 @@ HB_FUNC( QT_QSTANDARDITEMMODEL ) pObj = ( QStandardItemModel* ) new QStandardItemModel( hbqt_par_QObject( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QStandardItemModel( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStandardItemModel( pObj, true ) ); } /* * void appendRow ( QStandardItem * item ) @@ -177,7 +181,7 @@ HB_FUNC( QT_QSTANDARDITEMMODEL_CLEAR ) */ HB_FUNC( QT_QSTANDARDITEMMODEL_HORIZONTALHEADERITEM ) { - hb_retptr( ( QStandardItem* ) hbqt_par_QStandardItemModel( 1 )->horizontalHeaderItem( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStandardItem( hbqt_par_QStandardItemModel( 1 )->horizontalHeaderItem( hb_parni( 2 ) ), false ) ); } /* @@ -185,7 +189,7 @@ HB_FUNC( QT_QSTANDARDITEMMODEL_HORIZONTALHEADERITEM ) */ HB_FUNC( QT_QSTANDARDITEMMODEL_INDEXFROMITEM ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QStandardItemModel( 1 )->indexFromItem( hbqt_par_QStandardItem( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QStandardItemModel( 1 )->indexFromItem( hbqt_par_QStandardItem( 2 ) ) ), true ) ); } /* @@ -217,7 +221,7 @@ HB_FUNC( QT_QSTANDARDITEMMODEL_INSERTROW_1 ) */ HB_FUNC( QT_QSTANDARDITEMMODEL_INVISIBLEROOTITEM ) { - hb_retptr( ( QStandardItem* ) hbqt_par_QStandardItemModel( 1 )->invisibleRootItem() ); + hb_retptrGC( hbqt_gcAllocate_QStandardItem( hbqt_par_QStandardItemModel( 1 )->invisibleRootItem(), false ) ); } /* @@ -225,7 +229,7 @@ HB_FUNC( QT_QSTANDARDITEMMODEL_INVISIBLEROOTITEM ) */ HB_FUNC( QT_QSTANDARDITEMMODEL_ITEM ) { - hb_retptr( ( QStandardItem* ) hbqt_par_QStandardItemModel( 1 )->item( hb_parni( 2 ), hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStandardItem( hbqt_par_QStandardItemModel( 1 )->item( hb_parni( 2 ), hb_parni( 3 ) ), false ) ); } /* @@ -233,15 +237,7 @@ HB_FUNC( QT_QSTANDARDITEMMODEL_ITEM ) */ HB_FUNC( QT_QSTANDARDITEMMODEL_ITEMFROMINDEX ) { - hb_retptr( ( QStandardItem* ) hbqt_par_QStandardItemModel( 1 )->itemFromIndex( *hbqt_par_QModelIndex( 2 ) ) ); -} - -/* - * const QStandardItem * itemPrototype () const - */ -HB_FUNC( QT_QSTANDARDITEMMODEL_ITEMPROTOTYPE ) -{ - hb_retptr( ( QStandardItem* ) hbqt_par_QStandardItemModel( 1 )->itemPrototype() ); + hb_retptrGC( hbqt_gcAllocate_QStandardItem( hbqt_par_QStandardItemModel( 1 )->itemFromIndex( *hbqt_par_QModelIndex( 2 ) ), false ) ); } /* @@ -337,7 +333,7 @@ HB_FUNC( QT_QSTANDARDITEMMODEL_SORTROLE ) */ HB_FUNC( QT_QSTANDARDITEMMODEL_TAKEHORIZONTALHEADERITEM ) { - hb_retptr( ( QStandardItem* ) hbqt_par_QStandardItemModel( 1 )->takeHorizontalHeaderItem( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStandardItem( hbqt_par_QStandardItemModel( 1 )->takeHorizontalHeaderItem( hb_parni( 2 ) ), false ) ); } /* @@ -345,7 +341,7 @@ HB_FUNC( QT_QSTANDARDITEMMODEL_TAKEHORIZONTALHEADERITEM ) */ HB_FUNC( QT_QSTANDARDITEMMODEL_TAKEITEM ) { - hb_retptr( ( QStandardItem* ) hbqt_par_QStandardItemModel( 1 )->takeItem( hb_parni( 2 ), hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStandardItem( hbqt_par_QStandardItemModel( 1 )->takeItem( hb_parni( 2 ), hb_parni( 3 ) ), false ) ); } /* @@ -353,7 +349,7 @@ HB_FUNC( QT_QSTANDARDITEMMODEL_TAKEITEM ) */ HB_FUNC( QT_QSTANDARDITEMMODEL_TAKEVERTICALHEADERITEM ) { - hb_retptr( ( QStandardItem* ) hbqt_par_QStandardItemModel( 1 )->takeVerticalHeaderItem( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStandardItem( hbqt_par_QStandardItemModel( 1 )->takeVerticalHeaderItem( hb_parni( 2 ) ), false ) ); } /* @@ -361,7 +357,7 @@ HB_FUNC( QT_QSTANDARDITEMMODEL_TAKEVERTICALHEADERITEM ) */ HB_FUNC( QT_QSTANDARDITEMMODEL_VERTICALHEADERITEM ) { - hb_retptr( ( QStandardItem* ) hbqt_par_QStandardItemModel( 1 )->verticalHeaderItem( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStandardItem( hbqt_par_QStandardItemModel( 1 )->verticalHeaderItem( hb_parni( 2 ) ), false ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStatusBar.cpp b/harbour/contrib/hbqt/qtgui/QStatusBar.cpp index f84c72a09f..a77b3b5da5 100644 --- a/harbour/contrib/hbqt/qtgui/QStatusBar.cpp +++ b/harbour/contrib/hbqt/qtgui/QStatusBar.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QStatusBar > pq; } QGC_POINTER_QStatusBar; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QStatusBar ) { QGC_POINTER_QStatusBar * p = ( QGC_POINTER_QStatusBar * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStatusBar p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStatusBar ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QStatusBar * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QStatusBar * ) p->ph )->~QStatusBar(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QStatusBar * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStatusBar ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QStatusBar ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStatusBar Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QStatusBar Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStatusBar Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStatusBar Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStatusBar Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStatusBar( void * pObj ) +void * hbqt_gcAllocate_QStatusBar( void * pObj, bool bNew ) { QGC_POINTER_QStatusBar * p = ( QGC_POINTER_QStatusBar * ) hb_gcAllocate( sizeof( QGC_POINTER_QStatusBar ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStatusBar; - new( & p->pq ) QPointer< QStatusBar >( ( QStatusBar * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QStatusBar %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QStatusBar >( ( QStatusBar * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QStatusBar ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -138,7 +138,7 @@ HB_FUNC( QT_QSTATUSBAR ) pObj = ( QStatusBar* ) new QStatusBar( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QStatusBar( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStatusBar( pObj, true ) ); } /* * void addPermanentWidget ( QWidget * widget, int stretch = 0 ) diff --git a/harbour/contrib/hbqt/qtgui/QStringListModel.cpp b/harbour/contrib/hbqt/qtgui/QStringListModel.cpp index e3b982e850..cf30f032d7 100644 --- a/harbour/contrib/hbqt/qtgui/QStringListModel.cpp +++ b/harbour/contrib/hbqt/qtgui/QStringListModel.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QStringListModel > pq; } QGC_POINTER_QStringListModel; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QStringListModel ) { QGC_POINTER_QStringListModel * p = ( QGC_POINTER_QStringListModel * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStringListModel p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStringListModel ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QStringListModel * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QStringListModel * ) p->ph )->~QStringListModel(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QStringListModel * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStringListModel ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QStringListModel ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStringListModel Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QStringListModel Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStringListModel Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStringListModel Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStringListModel Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStringListModel( void * pObj ) +void * hbqt_gcAllocate_QStringListModel( void * pObj, bool bNew ) { QGC_POINTER_QStringListModel * p = ( QGC_POINTER_QStringListModel * ) hb_gcAllocate( sizeof( QGC_POINTER_QStringListModel ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStringListModel; - new( & p->pq ) QPointer< QStringListModel >( ( QStringListModel * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QStringListModel %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QStringListModel >( ( QStringListModel * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QStringListModel ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -138,14 +138,14 @@ HB_FUNC( QT_QSTRINGLISTMODEL ) pObj = ( QStringListModel* ) new QStringListModel() ; - hb_retptrGC( hbqt_gcAllocate_QStringListModel( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStringListModel( pObj, true ) ); } /* * virtual QVariant data ( const QModelIndex & index, int role ) const */ HB_FUNC( QT_QSTRINGLISTMODEL_DATA ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QStringListModel( 1 )->data( *hbqt_par_QModelIndex( 2 ), hb_parni( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QStringListModel( 1 )->data( *hbqt_par_QModelIndex( 2 ), hb_parni( 3 ) ) ), true ) ); } /* @@ -201,7 +201,7 @@ HB_FUNC( QT_QSTRINGLISTMODEL_SETSTRINGLIST ) */ HB_FUNC( QT_QSTRINGLISTMODEL_STRINGLIST ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QStringListModel( 1 )->stringList() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QStringListModel( 1 )->stringList() ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStyle.cpp b/harbour/contrib/hbqt/qtgui/QStyle.cpp index 96e4256cc9..af113a25bf 100644 --- a/harbour/contrib/hbqt/qtgui/QStyle.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyle.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -91,11 +91,35 @@ * virtual ~QStyle () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QStyle > pq; +} QGC_POINTER_QStyle; + QT_G_FUNC( hbqt_gcRelease_QStyle ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QStyle( void * pObj, bool bNew ) +{ + QGC_POINTER_QStyle * p = ( QGC_POINTER_QStyle * ) hb_gcAllocate( sizeof( QGC_POINTER_QStyle ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QStyle; + + if( bNew ) + { + new( & p->pq ) QPointer< QStyle >( ( QStyle * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyle ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QSTYLE ) { } @@ -152,7 +176,7 @@ HB_FUNC( QT_QSTYLE_DRAWPRIMITIVE ) */ HB_FUNC( QT_QSTYLE_GENERATEDICONPIXMAP ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QStyle( 1 )->generatedIconPixmap( ( QIcon::Mode ) hb_parni( 2 ), *hbqt_par_QPixmap( 3 ), hbqt_par_QStyleOption( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QStyle( 1 )->generatedIconPixmap( ( QIcon::Mode ) hb_parni( 2 ), *hbqt_par_QPixmap( 3 ), hbqt_par_QStyleOption( 4 ) ) ), true ) ); } /* @@ -168,7 +192,7 @@ HB_FUNC( QT_QSTYLE_HITTESTCOMPLEXCONTROL ) */ HB_FUNC( QT_QSTYLE_ITEMPIXMAPRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyle( 1 )->itemPixmapRect( *hbqt_par_QRect( 2 ), hb_parni( 3 ), *hbqt_par_QPixmap( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyle( 1 )->itemPixmapRect( *hbqt_par_QRect( 2 ), hb_parni( 3 ), *hbqt_par_QPixmap( 4 ) ) ), true ) ); } /* @@ -176,7 +200,7 @@ HB_FUNC( QT_QSTYLE_ITEMPIXMAPRECT ) */ HB_FUNC( QT_QSTYLE_ITEMTEXTRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyle( 1 )->itemTextRect( *hbqt_par_QFontMetrics( 2 ), *hbqt_par_QRect( 3 ), hb_parni( 4 ), hb_parl( 5 ), QStyle::tr( hb_parc( 6 ) ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyle( 1 )->itemTextRect( *hbqt_par_QFontMetrics( 2 ), *hbqt_par_QRect( 3 ), hb_parni( 4 ), hb_parl( 5 ), QStyle::tr( hb_parc( 6 ) ) ) ), true ) ); } /* @@ -224,7 +248,7 @@ HB_FUNC( QT_QSTYLE_POLISH_2 ) */ HB_FUNC( QT_QSTYLE_SIZEFROMCONTENTS ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStyle( 1 )->sizeFromContents( ( QStyle::ContentsType ) hb_parni( 2 ), hbqt_par_QStyleOption( 3 ), *hbqt_par_QSize( 4 ), hbqt_par_QWidget( 5 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStyle( 1 )->sizeFromContents( ( QStyle::ContentsType ) hb_parni( 2 ), hbqt_par_QStyleOption( 3 ), *hbqt_par_QSize( 4 ), hbqt_par_QWidget( 5 ) ) ), true ) ); } /* @@ -232,7 +256,7 @@ HB_FUNC( QT_QSTYLE_SIZEFROMCONTENTS ) */ HB_FUNC( QT_QSTYLE_STANDARDICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStyle( 1 )->standardIcon( ( QStyle::StandardPixmap ) hb_parni( 2 ), hbqt_par_QStyleOption( 3 ), hbqt_par_QWidget( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStyle( 1 )->standardIcon( ( QStyle::StandardPixmap ) hb_parni( 2 ), hbqt_par_QStyleOption( 3 ), hbqt_par_QWidget( 4 ) ) ), true ) ); } /* @@ -240,7 +264,7 @@ HB_FUNC( QT_QSTYLE_STANDARDICON ) */ HB_FUNC( QT_QSTYLE_STANDARDPALETTE ) { - hb_retptrGC( hbqt_gcAllocate_QPalette( new QPalette( hbqt_par_QStyle( 1 )->standardPalette() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPalette( new QPalette( hbqt_par_QStyle( 1 )->standardPalette() ), true ) ); } /* @@ -256,7 +280,7 @@ HB_FUNC( QT_QSTYLE_STYLEHINT ) */ HB_FUNC( QT_QSTYLE_SUBCONTROLRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyle( 1 )->subControlRect( ( QStyle::ComplexControl ) hb_parni( 2 ), hbqt_par_QStyleOptionComplex( 3 ), ( QStyle::SubControl ) hb_parni( 4 ), hbqt_par_QWidget( 5 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyle( 1 )->subControlRect( ( QStyle::ComplexControl ) hb_parni( 2 ), hbqt_par_QStyleOptionComplex( 3 ), ( QStyle::SubControl ) hb_parni( 4 ), hbqt_par_QWidget( 5 ) ) ), true ) ); } /* @@ -264,7 +288,7 @@ HB_FUNC( QT_QSTYLE_SUBCONTROLRECT ) */ HB_FUNC( QT_QSTYLE_SUBELEMENTRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyle( 1 )->subElementRect( ( QStyle::SubElement ) hb_parni( 2 ), hbqt_par_QStyleOption( 3 ), hbqt_par_QWidget( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyle( 1 )->subElementRect( ( QStyle::SubElement ) hb_parni( 2 ), hbqt_par_QStyleOption( 3 ), hbqt_par_QWidget( 4 ) ) ), true ) ); } /* @@ -288,7 +312,7 @@ HB_FUNC( QT_QSTYLE_UNPOLISH_1 ) */ HB_FUNC( QT_QSTYLE_ALIGNEDRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyle( 1 )->alignedRect( ( Qt::LayoutDirection ) hb_parni( 2 ), ( Qt::Alignment ) hb_parni( 3 ), *hbqt_par_QSize( 4 ), *hbqt_par_QRect( 5 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyle( 1 )->alignedRect( ( Qt::LayoutDirection ) hb_parni( 2 ), ( Qt::Alignment ) hb_parni( 3 ), *hbqt_par_QSize( 4 ), *hbqt_par_QRect( 5 ) ) ), true ) ); } /* @@ -320,7 +344,7 @@ HB_FUNC( QT_QSTYLE_VISUALALIGNMENT ) */ HB_FUNC( QT_QSTYLE_VISUALPOS ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QStyle( 1 )->visualPos( ( Qt::LayoutDirection ) hb_parni( 2 ), *hbqt_par_QRect( 3 ), *hbqt_par_QPoint( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QStyle( 1 )->visualPos( ( Qt::LayoutDirection ) hb_parni( 2 ), *hbqt_par_QRect( 3 ), *hbqt_par_QPoint( 4 ) ) ), true ) ); } /* @@ -328,7 +352,7 @@ HB_FUNC( QT_QSTYLE_VISUALPOS ) */ HB_FUNC( QT_QSTYLE_VISUALRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyle( 1 )->visualRect( ( Qt::LayoutDirection ) hb_parni( 2 ), *hbqt_par_QRect( 3 ), *hbqt_par_QRect( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyle( 1 )->visualRect( ( Qt::LayoutDirection ) hb_parni( 2 ), *hbqt_par_QRect( 3 ), *hbqt_par_QRect( 4 ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStyleFactory.cpp b/harbour/contrib/hbqt/qtgui/QStyleFactory.cpp index 268728f749..e4db1a9d74 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleFactory.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleFactory.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -75,32 +75,49 @@ * */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleFactory; + QT_G_FUNC( hbqt_gcRelease_QStyleFactory ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleFactory p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleFactory ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleFactory * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleFactory Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleFactory * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleFactory ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleFactory Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleFactory Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleFactory Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleFactory( void * pObj ) +void * hbqt_gcAllocate_QStyleFactory( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleFactory; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleFactory %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleFactory ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -110,14 +127,14 @@ HB_FUNC( QT_QSTYLEFACTORY ) pObj = new QStyleFactory() ; - hb_retptrGC( hbqt_gcAllocate_QStyleFactory( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleFactory( pObj, true ) ); } /* * QStyle * create ( const QString & key ) */ HB_FUNC( QT_QSTYLEFACTORY_CREATE ) { - hb_retptr( ( QStyle* ) hbqt_par_QStyleFactory( 1 )->create( hbqt_par_QString( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStyle( hbqt_par_QStyleFactory( 1 )->create( hbqt_par_QString( 2 ) ), false ) ); } /* @@ -125,7 +142,7 @@ HB_FUNC( QT_QSTYLEFACTORY_CREATE ) */ HB_FUNC( QT_QSTYLEFACTORY_KEYS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QStyleFactory( 1 )->keys() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QStyleFactory( 1 )->keys() ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStyleHintReturn.cpp b/harbour/contrib/hbqt/qtgui/QStyleHintReturn.cpp index 7c4bbe3810..b8416643a2 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleHintReturn.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleHintReturn.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -72,6 +72,16 @@ * enum StyleOptionVersion { Version } */ +/* + * Constructed[ 0/2 [ 0.00% ] ] + * + * *** Unconvered Prototypes *** + * ----------------------------- + * + * int type + * int version + */ + #include #include @@ -81,11 +91,33 @@ * QStyleHintReturn ( int version = QStyleOption::Version, int type = SH_Default ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleHintReturn; + QT_G_FUNC( hbqt_gcRelease_QStyleHintReturn ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QStyleHintReturn( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QStyleHintReturn; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleHintReturn ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QSTYLEHINTRETURN ) { } diff --git a/harbour/contrib/hbqt/qtgui/QStyleHintReturnMask.cpp b/harbour/contrib/hbqt/qtgui/QStyleHintReturnMask.cpp index 45dcc19bde..32b1428520 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleHintReturnMask.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleHintReturnMask.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -69,7 +69,15 @@ /* * enum StyleOptionType { Type } * enum StyleOptionVersion { Version } - * Public Functions + */ + +/* + * Constructed[ 0/1 [ 0.00% ] ] + * + * *** Unconvered Prototypes *** + * ----------------------------- + * + * QRegion region */ #include @@ -81,11 +89,33 @@ * QStyleHintReturnMask () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleHintReturnMask; + QT_G_FUNC( hbqt_gcRelease_QStyleHintReturnMask ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QStyleHintReturnMask( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QStyleHintReturnMask; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleHintReturnMask ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QSTYLEHINTRETURNMASK ) { } diff --git a/harbour/contrib/hbqt/qtgui/QStyleHintReturnVariant.cpp b/harbour/contrib/hbqt/qtgui/QStyleHintReturnVariant.cpp index 2e69ac0c9b..d9908a21ee 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleHintReturnVariant.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleHintReturnVariant.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -72,6 +72,15 @@ * Public Functions */ +/* + * Constructed[ 0/1 [ 0.00% ] ] + * + * *** Unconvered Prototypes *** + * ----------------------------- + * + * QVariant variant + */ + #include #include @@ -81,11 +90,33 @@ * QStyleHintReturnVariant () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleHintReturnVariant; + QT_G_FUNC( hbqt_gcRelease_QStyleHintReturnVariant ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QStyleHintReturnVariant( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QStyleHintReturnVariant; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleHintReturnVariant ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QSTYLEHINTRETURNVARIANT ) { } diff --git a/harbour/contrib/hbqt/qtgui/QStyleOption.cpp b/harbour/contrib/hbqt/qtgui/QStyleOption.cpp index aa203301dd..a2d774af8a 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOption.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOption.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -83,32 +83,49 @@ * ~QStyleOption () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOption; + QT_G_FUNC( hbqt_gcRelease_QStyleOption ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOption p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOption ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOption * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOption Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOption * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOption ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOption Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOption Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOption Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOption( void * pObj ) +void * hbqt_gcAllocate_QStyleOption( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOption; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOption %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOption ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -118,7 +135,7 @@ HB_FUNC( QT_QSTYLEOPTION ) pObj = ( QStyleOption* ) new QStyleOption() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOption( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOption( pObj, true ) ); } /* * void initFrom ( const QWidget * widget ) @@ -141,7 +158,7 @@ HB_FUNC( QT_QSTYLEOPTION_DIRECTION ) */ HB_FUNC( QT_QSTYLEOPTION_FONTMETRICS ) { - hb_retptrGC( hbqt_gcAllocate_QFontMetrics( new QFontMetrics( hbqt_par_QStyleOption( 1 )->fontMetrics ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFontMetrics( new QFontMetrics( hbqt_par_QStyleOption( 1 )->fontMetrics ), true ) ); } /* @@ -149,7 +166,7 @@ HB_FUNC( QT_QSTYLEOPTION_FONTMETRICS ) */ HB_FUNC( QT_QSTYLEOPTION_PALETTE ) { - hb_retptrGC( hbqt_gcAllocate_QPalette( new QPalette( hbqt_par_QStyleOption( 1 )->palette ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPalette( new QPalette( hbqt_par_QStyleOption( 1 )->palette ), true ) ); } /* @@ -157,7 +174,7 @@ HB_FUNC( QT_QSTYLEOPTION_PALETTE ) */ HB_FUNC( QT_QSTYLEOPTION_RECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyleOption( 1 )->rect ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyleOption( 1 )->rect ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionButton.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionButton.cpp index c53691803d..2752bf3d40 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionButton.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionButton.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -83,32 +83,49 @@ * QStyleOptionButton ( const QStyleOptionButton & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionButton; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionButton ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionButton p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionButton ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionButton * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionButton Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionButton * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionButton ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionButton Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionButton Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionButton Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionButton( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionButton( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionButton; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionButton %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionButton ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -118,7 +135,7 @@ HB_FUNC( QT_QSTYLEOPTIONBUTTON ) pObj = ( QStyleOptionButton* ) new QStyleOptionButton() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionButton( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionButton( pObj, true ) ); } /* * ButtonFeatures features @@ -133,7 +150,7 @@ HB_FUNC( QT_QSTYLEOPTIONBUTTON_FEATURES ) */ HB_FUNC( QT_QSTYLEOPTIONBUTTON_ICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionButton( 1 )->icon ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionButton( 1 )->icon ), true ) ); } /* @@ -141,7 +158,7 @@ HB_FUNC( QT_QSTYLEOPTIONBUTTON_ICON ) */ HB_FUNC( QT_QSTYLEOPTIONBUTTON_ICONSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionButton( 1 )->iconSize ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionButton( 1 )->iconSize ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionComboBox.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionComboBox.cpp index 02153bfec2..45c50145c1 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionComboBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionComboBox.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,32 +81,49 @@ * QStyleOptionComboBox ( const QStyleOptionComboBox & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionComboBox; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionComboBox ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionComboBox p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionComboBox ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionComboBox * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionComboBox Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionComboBox * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionComboBox ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionComboBox Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionComboBox Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionComboBox Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionComboBox( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionComboBox( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionComboBox; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionComboBox %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionComboBox ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -116,14 +133,14 @@ HB_FUNC( QT_QSTYLEOPTIONCOMBOBOX ) pObj = ( QStyleOptionComboBox* ) new QStyleOptionComboBox() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionComboBox( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionComboBox( pObj, true ) ); } /* * QIcon currentIcon */ HB_FUNC( QT_QSTYLEOPTIONCOMBOBOX_CURRENTICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionComboBox( 1 )->currentIcon ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionComboBox( 1 )->currentIcon ), true ) ); } /* @@ -155,7 +172,7 @@ HB_FUNC( QT_QSTYLEOPTIONCOMBOBOX_FRAME ) */ HB_FUNC( QT_QSTYLEOPTIONCOMBOBOX_ICONSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionComboBox( 1 )->iconSize ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionComboBox( 1 )->iconSize ), true ) ); } /* @@ -163,7 +180,7 @@ HB_FUNC( QT_QSTYLEOPTIONCOMBOBOX_ICONSIZE ) */ HB_FUNC( QT_QSTYLEOPTIONCOMBOBOX_POPUPRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyleOptionComboBox( 1 )->popupRect ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyleOptionComboBox( 1 )->popupRect ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionComplex.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionComplex.cpp index 07ddded0b9..4dc03491c1 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionComplex.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionComplex.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,32 +81,49 @@ * QStyleOptionComplex ( const QStyleOptionComplex & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionComplex; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionComplex ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionComplex p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionComplex ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionComplex * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionComplex Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionComplex * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionComplex ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionComplex Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionComplex Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionComplex Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionComplex( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionComplex( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionComplex; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionComplex %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionComplex ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -116,7 +133,7 @@ HB_FUNC( QT_QSTYLEOPTIONCOMPLEX ) pObj = ( QStyleOptionComplex* ) new QStyleOptionComplex() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionComplex( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionComplex( pObj, true ) ); } /* * QStyle::SubControls activeSubControls diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionDockWidget.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionDockWidget.cpp index 291fc6d96c..f1f02e818f 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionDockWidget.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionDockWidget.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,32 +81,49 @@ * QStyleOptionDockWidget ( const QStyleOptionDockWidget & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionDockWidget; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionDockWidget ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionDockWidget p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionDockWidget ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionDockWidget * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionDockWidget Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionDockWidget * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionDockWidget ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionDockWidget Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionDockWidget Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionDockWidget Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionDockWidget( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionDockWidget( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionDockWidget; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionDockWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionDockWidget ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -116,7 +133,7 @@ HB_FUNC( QT_QSTYLEOPTIONDOCKWIDGET ) pObj = ( QStyleOptionDockWidget* ) new QStyleOptionDockWidget() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionDockWidget( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionDockWidget( pObj, true ) ); } /* * bool closable diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionFocusRect.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionFocusRect.cpp index f57d43c377..b408cd102c 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionFocusRect.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionFocusRect.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,32 +81,49 @@ * QStyleOptionFocusRect ( const QStyleOptionFocusRect & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionFocusRect; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionFocusRect ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionFocusRect p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionFocusRect ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionFocusRect * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionFocusRect Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionFocusRect * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionFocusRect ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionFocusRect Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionFocusRect Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionFocusRect Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionFocusRect( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionFocusRect( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionFocusRect; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionFocusRect %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionFocusRect ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -116,14 +133,14 @@ HB_FUNC( QT_QSTYLEOPTIONFOCUSRECT ) pObj = ( QStyleOptionFocusRect* ) new QStyleOptionFocusRect() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionFocusRect( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionFocusRect( pObj, true ) ); } /* * QColor backgroundColor */ HB_FUNC( QT_QSTYLEOPTIONFOCUSRECT_BACKGROUNDCOLOR ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QStyleOptionFocusRect( 1 )->backgroundColor ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QStyleOptionFocusRect( 1 )->backgroundColor ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionFrame.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionFrame.cpp index 9276706552..6e4e1031dd 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionFrame.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionFrame.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,32 +81,49 @@ * QStyleOptionFrame ( const QStyleOptionFrame & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionFrame; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionFrame ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionFrame p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionFrame ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionFrame * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionFrame Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionFrame * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionFrame ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionFrame Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionFrame Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionFrame Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionFrame( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionFrame( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionFrame; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionFrame ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -116,7 +133,7 @@ HB_FUNC( QT_QSTYLEOPTIONFRAME ) pObj = ( QStyleOptionFrame* ) new QStyleOptionFrame() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionFrame( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionFrame( pObj, true ) ); } /* * int lineWidth diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionGroupBox.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionGroupBox.cpp index b80cefa226..586126cc25 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionGroupBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionGroupBox.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,32 +81,49 @@ * QStyleOptionGroupBox ( const QStyleOptionGroupBox & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionGroupBox; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionGroupBox ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionGroupBox p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionGroupBox ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionGroupBox * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionGroupBox Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionGroupBox * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionGroupBox ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionGroupBox Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionGroupBox Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionGroupBox Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionGroupBox( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionGroupBox( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionGroupBox; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionGroupBox %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionGroupBox ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -116,7 +133,7 @@ HB_FUNC( QT_QSTYLEOPTIONGROUPBOX ) pObj = ( QStyleOptionGroupBox* ) new QStyleOptionGroupBox() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionGroupBox( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionGroupBox( pObj, true ) ); } /* * QStyleOptionFrameV2::FrameFeatures features @@ -163,7 +180,7 @@ HB_FUNC( QT_QSTYLEOPTIONGROUPBOX_TEXTALIGNMENT ) */ HB_FUNC( QT_QSTYLEOPTIONGROUPBOX_TEXTCOLOR ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QStyleOptionGroupBox( 1 )->textColor ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QStyleOptionGroupBox( 1 )->textColor ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionHeader.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionHeader.cpp index 915a04fb91..dfbf985ade 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionHeader.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionHeader.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -84,32 +84,49 @@ * QStyleOptionHeader ( const QStyleOptionHeader & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionHeader; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionHeader ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionHeader p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionHeader ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionHeader * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionHeader Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionHeader * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionHeader ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionHeader Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionHeader Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionHeader Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionHeader( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionHeader( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionHeader; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionHeader %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionHeader ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -119,14 +136,14 @@ HB_FUNC( QT_QSTYLEOPTIONHEADER ) pObj = ( QStyleOptionHeader* ) new QStyleOptionHeader() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionHeader( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionHeader( pObj, true ) ); } /* * QIcon icon */ HB_FUNC( QT_QSTYLEOPTIONHEADER_ICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionHeader( 1 )->icon ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionHeader( 1 )->icon ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionMenuItem.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionMenuItem.cpp index 8a1f4cf251..fa2d20524d 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionMenuItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionMenuItem.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -83,32 +83,49 @@ * QStyleOptionMenuItem ( const QStyleOptionMenuItem & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionMenuItem; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionMenuItem ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionMenuItem p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionMenuItem ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionMenuItem * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionMenuItem Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionMenuItem * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionMenuItem ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionMenuItem Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionMenuItem Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionMenuItem Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionMenuItem( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionMenuItem( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionMenuItem; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionMenuItem %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionMenuItem ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -118,7 +135,7 @@ HB_FUNC( QT_QSTYLEOPTIONMENUITEM ) pObj = ( QStyleOptionMenuItem* ) new QStyleOptionMenuItem() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionMenuItem( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionMenuItem( pObj, true ) ); } /* * CheckType checkType @@ -141,7 +158,7 @@ HB_FUNC( QT_QSTYLEOPTIONMENUITEM_CHECKED ) */ HB_FUNC( QT_QSTYLEOPTIONMENUITEM_FONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QStyleOptionMenuItem( 1 )->font ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QStyleOptionMenuItem( 1 )->font ), true ) ); } /* @@ -149,7 +166,7 @@ HB_FUNC( QT_QSTYLEOPTIONMENUITEM_FONT ) */ HB_FUNC( QT_QSTYLEOPTIONMENUITEM_ICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionMenuItem( 1 )->icon ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionMenuItem( 1 )->icon ), true ) ); } /* @@ -181,7 +198,7 @@ HB_FUNC( QT_QSTYLEOPTIONMENUITEM_MENUITEMTYPE ) */ HB_FUNC( QT_QSTYLEOPTIONMENUITEM_MENURECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyleOptionMenuItem( 1 )->menuRect ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyleOptionMenuItem( 1 )->menuRect ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionProgressBar.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionProgressBar.cpp index d089ad843f..1837fe91fb 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionProgressBar.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionProgressBar.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -82,32 +82,49 @@ * QStyleOptionProgressBar ( const QStyleOptionProgressBar & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionProgressBar; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionProgressBar ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionProgressBar p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionProgressBar ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionProgressBar * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionProgressBar Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionProgressBar * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionProgressBar ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionProgressBar Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionProgressBar Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionProgressBar Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionProgressBar( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionProgressBar( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionProgressBar; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionProgressBar %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionProgressBar ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -117,7 +134,7 @@ HB_FUNC( QT_QSTYLEOPTIONPROGRESSBAR ) pObj = ( QStyleOptionProgressBar* ) new QStyleOptionProgressBar() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionProgressBar( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionProgressBar( pObj, true ) ); } /* * int maximum diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionSizeGrip.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionSizeGrip.cpp index 6737db588b..a3f3246175 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionSizeGrip.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionSizeGrip.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,32 +81,49 @@ * QStyleOptionSizeGrip ( const QStyleOptionSizeGrip & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionSizeGrip; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionSizeGrip ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionSizeGrip p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionSizeGrip ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionSizeGrip * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionSizeGrip Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionSizeGrip * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionSizeGrip ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionSizeGrip Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionSizeGrip Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionSizeGrip Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionSizeGrip( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionSizeGrip( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionSizeGrip; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionSizeGrip %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionSizeGrip ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -116,7 +133,7 @@ HB_FUNC( QT_QSTYLEOPTIONSIZEGRIP ) pObj = ( QStyleOptionSizeGrip* ) new QStyleOptionSizeGrip() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionSizeGrip( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionSizeGrip( pObj, true ) ); } /* * Qt::Corner corner diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionSlider.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionSlider.cpp index a70429536b..0a9a4910b6 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionSlider.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionSlider.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,32 +81,49 @@ * QStyleOptionSlider ( const QStyleOptionSlider & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionSlider; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionSlider ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionSlider p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionSlider ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionSlider * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionSlider Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionSlider * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionSlider ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionSlider Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionSlider Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionSlider Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionSlider( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionSlider( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionSlider; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionSlider %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionSlider ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -116,7 +133,7 @@ HB_FUNC( QT_QSTYLEOPTIONSLIDER ) pObj = ( QStyleOptionSlider* ) new QStyleOptionSlider() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionSlider( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionSlider( pObj, true ) ); } /* * bool dialWrapping diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionSpinBox.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionSpinBox.cpp index 757425aecf..bc23bc8af4 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionSpinBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionSpinBox.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,32 +81,49 @@ * QStyleOptionSpinBox ( const QStyleOptionSpinBox & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionSpinBox; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionSpinBox ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionSpinBox p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionSpinBox ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionSpinBox * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionSpinBox Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionSpinBox * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionSpinBox ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionSpinBox Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionSpinBox Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionSpinBox Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionSpinBox( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionSpinBox( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionSpinBox; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionSpinBox %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionSpinBox ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -116,7 +133,7 @@ HB_FUNC( QT_QSTYLEOPTIONSPINBOX ) pObj = ( QStyleOptionSpinBox* ) new QStyleOptionSpinBox() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionSpinBox( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionSpinBox( pObj, true ) ); } /* * QAbstractSpinBox::ButtonSymbols buttonSymbols diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionTab.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionTab.cpp index b96e255fda..2b241b8f37 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionTab.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionTab.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -85,32 +85,49 @@ * QStyleOptionTab ( const QStyleOptionTab & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionTab; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionTab ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionTab p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionTab ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionTab * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionTab Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionTab * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionTab ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionTab Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionTab Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionTab Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionTab( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionTab( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionTab; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionTab %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionTab ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -120,7 +137,7 @@ HB_FUNC( QT_QSTYLEOPTIONTAB ) pObj = ( QStyleOptionTab* ) new QStyleOptionTab() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionTab( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionTab( pObj, true ) ); } /* * CornerWidgets cornerWidgets @@ -135,7 +152,7 @@ HB_FUNC( QT_QSTYLEOPTIONTAB_CORNERWIDGETS ) */ HB_FUNC( QT_QSTYLEOPTIONTAB_ICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionTab( 1 )->icon ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionTab( 1 )->icon ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionTabBarBase.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionTabBarBase.cpp index 9c628404ca..e41548df56 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionTabBarBase.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionTabBarBase.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,32 +81,49 @@ * QStyleOptionTabBarBase ( const QStyleOptionTabBarBase & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionTabBarBase; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionTabBarBase ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionTabBarBase p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionTabBarBase ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionTabBarBase * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionTabBarBase Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionTabBarBase * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionTabBarBase ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionTabBarBase Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionTabBarBase Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionTabBarBase Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionTabBarBase( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionTabBarBase( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionTabBarBase; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionTabBarBase %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionTabBarBase ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -116,14 +133,14 @@ HB_FUNC( QT_QSTYLEOPTIONTABBARBASE ) pObj = ( QStyleOptionTabBarBase* ) new QStyleOptionTabBarBase() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionTabBarBase( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionTabBarBase( pObj, true ) ); } /* * QRect selectedTabRect */ HB_FUNC( QT_QSTYLEOPTIONTABBARBASE_SELECTEDTABRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyleOptionTabBarBase( 1 )->selectedTabRect ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyleOptionTabBarBase( 1 )->selectedTabRect ), true ) ); } /* @@ -139,7 +156,7 @@ HB_FUNC( QT_QSTYLEOPTIONTABBARBASE_SHAPE ) */ HB_FUNC( QT_QSTYLEOPTIONTABBARBASE_TABBARRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyleOptionTabBarBase( 1 )->tabBarRect ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QStyleOptionTabBarBase( 1 )->tabBarRect ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionTabWidgetFrame.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionTabWidgetFrame.cpp index 3dbf0335bb..36d26627ec 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionTabWidgetFrame.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionTabWidgetFrame.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,32 +81,49 @@ * QStyleOptionTabWidgetFrame ( const QStyleOptionTabWidgetFrame & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionTabWidgetFrame; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionTabWidgetFrame ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionTabWidgetFrame p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionTabWidgetFrame ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionTabWidgetFrame * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionTabWidgetFrame Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionTabWidgetFrame * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionTabWidgetFrame ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionTabWidgetFrame Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionTabWidgetFrame Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionTabWidgetFrame Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionTabWidgetFrame( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionTabWidgetFrame( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionTabWidgetFrame; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionTabWidgetFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionTabWidgetFrame ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -116,14 +133,14 @@ HB_FUNC( QT_QSTYLEOPTIONTABWIDGETFRAME ) pObj = ( QStyleOptionTabWidgetFrame* ) new QStyleOptionTabWidgetFrame() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionTabWidgetFrame( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionTabWidgetFrame( pObj, true ) ); } /* * QSize leftCornerWidgetSize */ HB_FUNC( QT_QSTYLEOPTIONTABWIDGETFRAME_LEFTCORNERWIDGETSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionTabWidgetFrame( 1 )->leftCornerWidgetSize ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionTabWidgetFrame( 1 )->leftCornerWidgetSize ), true ) ); } /* @@ -147,7 +164,7 @@ HB_FUNC( QT_QSTYLEOPTIONTABWIDGETFRAME_MIDLINEWIDTH ) */ HB_FUNC( QT_QSTYLEOPTIONTABWIDGETFRAME_RIGHTCORNERWIDGETSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionTabWidgetFrame( 1 )->rightCornerWidgetSize ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionTabWidgetFrame( 1 )->rightCornerWidgetSize ), true ) ); } /* @@ -163,7 +180,7 @@ HB_FUNC( QT_QSTYLEOPTIONTABWIDGETFRAME_SHAPE ) */ HB_FUNC( QT_QSTYLEOPTIONTABWIDGETFRAME_TABBARSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionTabWidgetFrame( 1 )->tabBarSize ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionTabWidgetFrame( 1 )->tabBarSize ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionTitleBar.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionTitleBar.cpp index aad54ccb93..e35a077a56 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionTitleBar.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionTitleBar.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,32 +81,49 @@ * QStyleOptionTitleBar ( const QStyleOptionTitleBar & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionTitleBar; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionTitleBar ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionTitleBar p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionTitleBar ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionTitleBar * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionTitleBar Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionTitleBar * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionTitleBar ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionTitleBar Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionTitleBar Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionTitleBar Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionTitleBar( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionTitleBar( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionTitleBar; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionTitleBar %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionTitleBar ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -116,14 +133,14 @@ HB_FUNC( QT_QSTYLEOPTIONTITLEBAR ) pObj = ( QStyleOptionTitleBar* ) new QStyleOptionTitleBar() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionTitleBar( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionTitleBar( pObj, true ) ); } /* * QIcon icon */ HB_FUNC( QT_QSTYLEOPTIONTITLEBAR_ICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionTitleBar( 1 )->icon ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionTitleBar( 1 )->icon ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionToolBar.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionToolBar.cpp index 16e0eebae1..e0f81654d2 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionToolBar.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionToolBar.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -84,32 +84,49 @@ * QStyleOptionToolBar ( const QStyleOptionToolBar & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionToolBar; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionToolBar ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionToolBar p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionToolBar ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionToolBar * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionToolBar Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionToolBar * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionToolBar ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionToolBar Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionToolBar Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionToolBar Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionToolBar( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionToolBar( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionToolBar; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionToolBar %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionToolBar ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -119,7 +136,7 @@ HB_FUNC( QT_QSTYLEOPTIONTOOLBAR ) pObj = ( QStyleOptionToolBar* ) new QStyleOptionToolBar() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionToolBar( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionToolBar( pObj, true ) ); } /* * ToolBarFeatures features diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionToolBox.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionToolBox.cpp index 35905e2da8..3936f835e9 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionToolBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionToolBox.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,32 +81,49 @@ * QStyleOptionToolBox ( const QStyleOptionToolBox & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionToolBox; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionToolBox ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionToolBox p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionToolBox ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionToolBox * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionToolBox Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionToolBox * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionToolBox ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionToolBox Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionToolBox Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionToolBox Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionToolBox( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionToolBox( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionToolBox; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionToolBox %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionToolBox ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -116,14 +133,14 @@ HB_FUNC( QT_QSTYLEOPTIONTOOLBOX ) pObj = ( QStyleOptionToolBox* ) new QStyleOptionToolBox() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionToolBox( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionToolBox( pObj, true ) ); } /* * QIcon icon */ HB_FUNC( QT_QSTYLEOPTIONTOOLBOX_ICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionToolBox( 1 )->icon ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionToolBox( 1 )->icon ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionToolButton.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionToolButton.cpp index 65a6eabe70..9156f516aa 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionToolButton.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionToolButton.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -83,32 +83,49 @@ * QStyleOptionToolButton ( const QStyleOptionToolButton & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionToolButton; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionToolButton ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionToolButton p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionToolButton ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionToolButton * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionToolButton Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionToolButton * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionToolButton ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionToolButton Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionToolButton Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionToolButton Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionToolButton( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionToolButton( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionToolButton; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionToolButton %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionToolButton ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -118,7 +135,7 @@ HB_FUNC( QT_QSTYLEOPTIONTOOLBUTTON ) pObj = ( QStyleOptionToolButton* ) new QStyleOptionToolButton() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionToolButton( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionToolButton( pObj, true ) ); } /* * Qt::ArrowType arrowType @@ -141,7 +158,7 @@ HB_FUNC( QT_QSTYLEOPTIONTOOLBUTTON_FEATURES ) */ HB_FUNC( QT_QSTYLEOPTIONTOOLBUTTON_FONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QStyleOptionToolButton( 1 )->font ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QStyleOptionToolButton( 1 )->font ), true ) ); } /* @@ -149,7 +166,7 @@ HB_FUNC( QT_QSTYLEOPTIONTOOLBUTTON_FONT ) */ HB_FUNC( QT_QSTYLEOPTIONTOOLBUTTON_ICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionToolButton( 1 )->icon ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QStyleOptionToolButton( 1 )->icon ), true ) ); } /* @@ -157,7 +174,7 @@ HB_FUNC( QT_QSTYLEOPTIONTOOLBUTTON_ICON ) */ HB_FUNC( QT_QSTYLEOPTIONTOOLBUTTON_ICONSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionToolButton( 1 )->iconSize ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionToolButton( 1 )->iconSize ), true ) ); } /* @@ -165,7 +182,7 @@ HB_FUNC( QT_QSTYLEOPTIONTOOLBUTTON_ICONSIZE ) */ HB_FUNC( QT_QSTYLEOPTIONTOOLBUTTON_POS ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QStyleOptionToolButton( 1 )->pos ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QStyleOptionToolButton( 1 )->pos ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStyleOptionViewItem.cpp b/harbour/contrib/hbqt/qtgui/QStyleOptionViewItem.cpp index b163a2ceb2..d9980e633b 100644 --- a/harbour/contrib/hbqt/qtgui/QStyleOptionViewItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyleOptionViewItem.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -82,32 +82,49 @@ * QStyleOptionViewItem ( const QStyleOptionViewItem & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStyleOptionViewItem; + QT_G_FUNC( hbqt_gcRelease_QStyleOptionViewItem ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionViewItem p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyleOptionViewItem ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStyleOptionViewItem * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStyleOptionViewItem Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStyleOptionViewItem * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyleOptionViewItem ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyleOptionViewItem Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyleOptionViewItem Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyleOptionViewItem Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyleOptionViewItem( void * pObj ) +void * hbqt_gcAllocate_QStyleOptionViewItem( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyleOptionViewItem; - HB_TRACE( HB_TR_DEBUG, ( " new_QStyleOptionViewItem %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyleOptionViewItem ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -117,7 +134,7 @@ HB_FUNC( QT_QSTYLEOPTIONVIEWITEM ) pObj = ( QStyleOptionViewItem* ) new QStyleOptionViewItem() ; - hb_retptrGC( hbqt_gcAllocate_QStyleOptionViewItem( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyleOptionViewItem( pObj, true ) ); } /* * Qt::Alignment decorationAlignment @@ -140,7 +157,7 @@ HB_FUNC( QT_QSTYLEOPTIONVIEWITEM_DECORATIONPOSITION ) */ HB_FUNC( QT_QSTYLEOPTIONVIEWITEM_DECORATIONSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionViewItem( 1 )->decorationSize ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStyleOptionViewItem( 1 )->decorationSize ), true ) ); } /* @@ -156,7 +173,7 @@ HB_FUNC( QT_QSTYLEOPTIONVIEWITEM_DISPLAYALIGNMENT ) */ HB_FUNC( QT_QSTYLEOPTIONVIEWITEM_FONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QStyleOptionViewItem( 1 )->font ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QStyleOptionViewItem( 1 )->font ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QStylePainter.cpp b/harbour/contrib/hbqt/qtgui/QStylePainter.cpp index bec6a03c30..e1fb74e136 100644 --- a/harbour/contrib/hbqt/qtgui/QStylePainter.cpp +++ b/harbour/contrib/hbqt/qtgui/QStylePainter.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -77,32 +77,49 @@ * QStylePainter ( QPaintDevice * pd, QWidget * widget ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QStylePainter; + QT_G_FUNC( hbqt_gcRelease_QStylePainter ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStylePainter p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStylePainter ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QStylePainter * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QStylePainter Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QStylePainter * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStylePainter ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStylePainter Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStylePainter Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStylePainter Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStylePainter( void * pObj ) +void * hbqt_gcAllocate_QStylePainter( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStylePainter; - HB_TRACE( HB_TR_DEBUG, ( " new_QStylePainter %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QStylePainter ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -112,7 +129,7 @@ HB_FUNC( QT_QSTYLEPAINTER ) pObj = ( QStylePainter* ) new QStylePainter() ; - hb_retptrGC( hbqt_gcAllocate_QStylePainter( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStylePainter( pObj, true ) ); } /* * bool begin ( QWidget * widget ) @@ -175,7 +192,7 @@ HB_FUNC( QT_QSTYLEPAINTER_DRAWPRIMITIVE ) */ HB_FUNC( QT_QSTYLEPAINTER_STYLE ) { - hb_retptr( ( QStyle* ) hbqt_par_QStylePainter( 1 )->style() ); + hb_retptrGC( hbqt_gcAllocate_QStyle( hbqt_par_QStylePainter( 1 )->style(), false ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QStyledItemDelegate.cpp b/harbour/contrib/hbqt/qtgui/QStyledItemDelegate.cpp index ac5cb54722..cbe0cbbbe0 100644 --- a/harbour/contrib/hbqt/qtgui/QStyledItemDelegate.cpp +++ b/harbour/contrib/hbqt/qtgui/QStyledItemDelegate.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QStyledItemDelegate > pq; } QGC_POINTER_QStyledItemDelegate; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QStyledItemDelegate ) { QGC_POINTER_QStyledItemDelegate * p = ( QGC_POINTER_QStyledItemDelegate * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyledItemDelegate p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyledItemDelegate ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QStyledItemDelegate * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QStyledItemDelegate * ) p->ph )->~QStyledItemDelegate(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QStyledItemDelegate * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QStyledItemDelegate ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QStyledItemDelegate ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QStyledItemDelegate Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QStyledItemDelegate Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QStyledItemDelegate Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QStyledItemDelegate Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QStyledItemDelegate Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QStyledItemDelegate( void * pObj ) +void * hbqt_gcAllocate_QStyledItemDelegate( void * pObj, bool bNew ) { QGC_POINTER_QStyledItemDelegate * p = ( QGC_POINTER_QStyledItemDelegate * ) hb_gcAllocate( sizeof( QGC_POINTER_QStyledItemDelegate ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QStyledItemDelegate; - new( & p->pq ) QPointer< QStyledItemDelegate >( ( QStyledItemDelegate * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QStyledItemDelegate %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QStyledItemDelegate >( ( QStyledItemDelegate * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QStyledItemDelegate ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -138,14 +138,14 @@ HB_FUNC( QT_QSTYLEDITEMDELEGATE ) pObj = ( QStyledItemDelegate* ) new QStyledItemDelegate( hbqt_par_QObject( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QStyledItemDelegate( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QStyledItemDelegate( pObj, true ) ); } /* * virtual QWidget * createEditor ( QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const */ HB_FUNC( QT_QSTYLEDITEMDELEGATE_CREATEEDITOR ) { - hb_retptr( ( QWidget* ) hbqt_par_QStyledItemDelegate( 1 )->createEditor( hbqt_par_QWidget( 2 ), *hbqt_par_QStyleOptionViewItem( 3 ), *hbqt_par_QModelIndex( 4 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QStyledItemDelegate( 1 )->createEditor( hbqt_par_QWidget( 2 ), *hbqt_par_QStyleOptionViewItem( 3 ), *hbqt_par_QModelIndex( 4 ) ), false ) ); } /* @@ -185,7 +185,7 @@ HB_FUNC( QT_QSTYLEDITEMDELEGATE_SETMODELDATA ) */ HB_FUNC( QT_QSTYLEDITEMDELEGATE_SIZEHINT ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStyledItemDelegate( 1 )->sizeHint( *hbqt_par_QStyleOptionViewItem( 2 ), *hbqt_par_QModelIndex( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QStyledItemDelegate( 1 )->sizeHint( *hbqt_par_QStyleOptionViewItem( 2 ), *hbqt_par_QModelIndex( 3 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QSyntaxHighlighter.cpp b/harbour/contrib/hbqt/qtgui/QSyntaxHighlighter.cpp index 34d765f052..9f9db82af5 100644 --- a/harbour/contrib/hbqt/qtgui/QSyntaxHighlighter.cpp +++ b/harbour/contrib/hbqt/qtgui/QSyntaxHighlighter.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,6 +81,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QSyntaxHighlighter > pq; } QGC_POINTER_QSyntaxHighlighter; @@ -89,48 +90,47 @@ QT_G_FUNC( hbqt_gcRelease_QSyntaxHighlighter ) { QGC_POINTER_QSyntaxHighlighter * p = ( QGC_POINTER_QSyntaxHighlighter * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSyntaxHighlighter p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSyntaxHighlighter ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QSyntaxHighlighter * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QSyntaxHighlighter * ) p->ph )->~QSyntaxHighlighter(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QSyntaxHighlighter * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QSyntaxHighlighter ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QSyntaxHighlighter ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSyntaxHighlighter Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QSyntaxHighlighter Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QSyntaxHighlighter Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QSyntaxHighlighter Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QSyntaxHighlighter Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QSyntaxHighlighter( void * pObj ) +void * hbqt_gcAllocate_QSyntaxHighlighter( void * pObj, bool bNew ) { QGC_POINTER_QSyntaxHighlighter * p = ( QGC_POINTER_QSyntaxHighlighter * ) hb_gcAllocate( sizeof( QGC_POINTER_QSyntaxHighlighter ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QSyntaxHighlighter; - new( & p->pq ) QPointer< QSyntaxHighlighter >( ( QSyntaxHighlighter * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QSyntaxHighlighter %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QSyntaxHighlighter >( ( QSyntaxHighlighter * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QSyntaxHighlighter ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -143,14 +143,14 @@ HB_FUNC( QT_QSYNTAXHIGHLIGHTER ) pObj = new HBQSyntaxHighlighter( hbqt_par_QTextDocument( 1 ) ) ; } - hb_retptrGC( hbqt_gcAllocate_QSyntaxHighlighter( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QSyntaxHighlighter( pObj, true ) ); } /* * QTextDocument * document () const */ HB_FUNC( QT_QSYNTAXHIGHLIGHTER_DOCUMENT ) { - hb_retptr( ( QTextDocument* ) hbqt_par_QSyntaxHighlighter( 1 )->document() ); + hb_retptrGC( hbqt_gcAllocate_QTextDocument( hbqt_par_QSyntaxHighlighter( 1 )->document(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QSystemTrayIcon.cpp b/harbour/contrib/hbqt/qtgui/QSystemTrayIcon.cpp index 89612fee5a..b7f08aa162 100644 --- a/harbour/contrib/hbqt/qtgui/QSystemTrayIcon.cpp +++ b/harbour/contrib/hbqt/qtgui/QSystemTrayIcon.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -85,6 +85,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QSystemTrayIcon > pq; } QGC_POINTER_QSystemTrayIcon; @@ -93,48 +94,47 @@ QT_G_FUNC( hbqt_gcRelease_QSystemTrayIcon ) { QGC_POINTER_QSystemTrayIcon * p = ( QGC_POINTER_QSystemTrayIcon * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSystemTrayIcon p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSystemTrayIcon ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QSystemTrayIcon * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QSystemTrayIcon * ) p->ph )->~QSystemTrayIcon(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QSystemTrayIcon * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QSystemTrayIcon ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QSystemTrayIcon ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QSystemTrayIcon Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QSystemTrayIcon Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QSystemTrayIcon Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QSystemTrayIcon Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QSystemTrayIcon Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QSystemTrayIcon( void * pObj ) +void * hbqt_gcAllocate_QSystemTrayIcon( void * pObj, bool bNew ) { QGC_POINTER_QSystemTrayIcon * p = ( QGC_POINTER_QSystemTrayIcon * ) hb_gcAllocate( sizeof( QGC_POINTER_QSystemTrayIcon ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QSystemTrayIcon; - new( & p->pq ) QPointer< QSystemTrayIcon >( ( QSystemTrayIcon * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QSystemTrayIcon %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QSystemTrayIcon >( ( QSystemTrayIcon * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QSystemTrayIcon ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -144,14 +144,14 @@ HB_FUNC( QT_QSYSTEMTRAYICON ) pObj = ( QSystemTrayIcon* ) new QSystemTrayIcon( hbqt_par_QObject( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QSystemTrayIcon( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QSystemTrayIcon( pObj, true ) ); } /* * QMenu * contextMenu () const */ HB_FUNC( QT_QSYSTEMTRAYICON_CONTEXTMENU ) { - hb_retptr( ( QMenu* ) hbqt_par_QSystemTrayIcon( 1 )->contextMenu() ); + hb_retptrGC( hbqt_gcAllocate_QMenu( hbqt_par_QSystemTrayIcon( 1 )->contextMenu(), false ) ); } /* @@ -159,7 +159,7 @@ HB_FUNC( QT_QSYSTEMTRAYICON_CONTEXTMENU ) */ HB_FUNC( QT_QSYSTEMTRAYICON_GEOMETRY ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QSystemTrayIcon( 1 )->geometry() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QSystemTrayIcon( 1 )->geometry() ), true ) ); } /* @@ -167,7 +167,7 @@ HB_FUNC( QT_QSYSTEMTRAYICON_GEOMETRY ) */ HB_FUNC( QT_QSYSTEMTRAYICON_ICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QSystemTrayIcon( 1 )->icon() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QSystemTrayIcon( 1 )->icon() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTabBar.cpp b/harbour/contrib/hbqt/qtgui/QTabBar.cpp index 6fab008a90..b3389e9cd3 100644 --- a/harbour/contrib/hbqt/qtgui/QTabBar.cpp +++ b/harbour/contrib/hbqt/qtgui/QTabBar.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -86,6 +86,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QTabBar > pq; } QGC_POINTER_QTabBar; @@ -94,48 +95,47 @@ QT_G_FUNC( hbqt_gcRelease_QTabBar ) { QGC_POINTER_QTabBar * p = ( QGC_POINTER_QTabBar * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTabBar p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTabBar ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QTabBar * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QTabBar * ) p->ph )->~QTabBar(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QTabBar * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTabBar ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QTabBar ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTabBar Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QTabBar Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTabBar Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTabBar Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTabBar Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTabBar( void * pObj ) +void * hbqt_gcAllocate_QTabBar( void * pObj, bool bNew ) { QGC_POINTER_QTabBar * p = ( QGC_POINTER_QTabBar * ) hb_gcAllocate( sizeof( QGC_POINTER_QTabBar ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTabBar; - new( & p->pq ) QPointer< QTabBar >( ( QTabBar * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QTabBar %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QTabBar >( ( QTabBar * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QTabBar ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -145,7 +145,7 @@ HB_FUNC( QT_QTABBAR ) pObj = ( QTabBar* ) new QTabBar( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QTabBar( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTabBar( pObj, true ) ); } /* * int addTab ( const QString & text ) @@ -208,7 +208,7 @@ HB_FUNC( QT_QTABBAR_EXPANDING ) */ HB_FUNC( QT_QTABBAR_ICONSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QTabBar( 1 )->iconSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QTabBar( 1 )->iconSize() ), true ) ); } /* @@ -416,7 +416,7 @@ HB_FUNC( QT_QTABBAR_TABAT ) */ HB_FUNC( QT_QTABBAR_TABBUTTON ) { - hb_retptr( ( QWidget* ) hbqt_par_QTabBar( 1 )->tabButton( hb_parni( 2 ), ( QTabBar::ButtonPosition ) hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QTabBar( 1 )->tabButton( hb_parni( 2 ), ( QTabBar::ButtonPosition ) hb_parni( 3 ) ), false ) ); } /* @@ -424,7 +424,7 @@ HB_FUNC( QT_QTABBAR_TABBUTTON ) */ HB_FUNC( QT_QTABBAR_TABDATA ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QTabBar( 1 )->tabData( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QTabBar( 1 )->tabData( hb_parni( 2 ) ) ), true ) ); } /* @@ -432,7 +432,7 @@ HB_FUNC( QT_QTABBAR_TABDATA ) */ HB_FUNC( QT_QTABBAR_TABICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QTabBar( 1 )->tabIcon( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QTabBar( 1 )->tabIcon( hb_parni( 2 ) ) ), true ) ); } /* @@ -440,7 +440,7 @@ HB_FUNC( QT_QTABBAR_TABICON ) */ HB_FUNC( QT_QTABBAR_TABRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QTabBar( 1 )->tabRect( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QTabBar( 1 )->tabRect( hb_parni( 2 ) ) ), true ) ); } /* @@ -456,7 +456,7 @@ HB_FUNC( QT_QTABBAR_TABTEXT ) */ HB_FUNC( QT_QTABBAR_TABTEXTCOLOR ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QTabBar( 1 )->tabTextColor( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QTabBar( 1 )->tabTextColor( hb_parni( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTabWidget.cpp b/harbour/contrib/hbqt/qtgui/QTabWidget.cpp index be9b10da8a..d838722791 100644 --- a/harbour/contrib/hbqt/qtgui/QTabWidget.cpp +++ b/harbour/contrib/hbqt/qtgui/QTabWidget.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -84,6 +84,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QTabWidget > pq; } QGC_POINTER_QTabWidget; @@ -92,48 +93,47 @@ QT_G_FUNC( hbqt_gcRelease_QTabWidget ) { QGC_POINTER_QTabWidget * p = ( QGC_POINTER_QTabWidget * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTabWidget p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTabWidget ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QTabWidget * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QTabWidget * ) p->ph )->~QTabWidget(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QTabWidget * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTabWidget ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QTabWidget ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTabWidget Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QTabWidget Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTabWidget Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTabWidget Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTabWidget Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTabWidget( void * pObj ) +void * hbqt_gcAllocate_QTabWidget( void * pObj, bool bNew ) { QGC_POINTER_QTabWidget * p = ( QGC_POINTER_QTabWidget * ) hb_gcAllocate( sizeof( QGC_POINTER_QTabWidget ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTabWidget; - new( & p->pq ) QPointer< QTabWidget >( ( QTabWidget * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QTabWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QTabWidget >( ( QTabWidget * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QTabWidget ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -143,7 +143,7 @@ HB_FUNC( QT_QTABWIDGET ) pObj = ( QTabWidget* ) new QTabWidget( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QTabWidget( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTabWidget( pObj, true ) ); } /* * int addTab ( QWidget * page, const QString & label ) @@ -174,7 +174,7 @@ HB_FUNC( QT_QTABWIDGET_CLEAR ) */ HB_FUNC( QT_QTABWIDGET_CORNERWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QTabWidget( 1 )->cornerWidget( ( HB_ISNUM( 2 ) ? ( Qt::Corner ) hb_parni( 2 ) : ( Qt::Corner ) Qt::TopRightCorner ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QTabWidget( 1 )->cornerWidget( ( HB_ISNUM( 2 ) ? ( Qt::Corner ) hb_parni( 2 ) : ( Qt::Corner ) Qt::TopRightCorner ) ), false ) ); } /* @@ -198,7 +198,7 @@ HB_FUNC( QT_QTABWIDGET_CURRENTINDEX ) */ HB_FUNC( QT_QTABWIDGET_CURRENTWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QTabWidget( 1 )->currentWidget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QTabWidget( 1 )->currentWidget(), false ) ); } /* @@ -222,7 +222,7 @@ HB_FUNC( QT_QTABWIDGET_ELIDEMODE ) */ HB_FUNC( QT_QTABWIDGET_ICONSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QTabWidget( 1 )->iconSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QTabWidget( 1 )->iconSize() ), true ) ); } /* @@ -390,7 +390,7 @@ HB_FUNC( QT_QTABWIDGET_SETUSESSCROLLBUTTONS ) */ HB_FUNC( QT_QTABWIDGET_TABICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QTabWidget( 1 )->tabIcon( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QTabWidget( 1 )->tabIcon( hb_parni( 2 ) ) ), true ) ); } /* @@ -454,7 +454,7 @@ HB_FUNC( QT_QTABWIDGET_USESSCROLLBUTTONS ) */ HB_FUNC( QT_QTABWIDGET_WIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QTabWidget( 1 )->widget( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QTabWidget( 1 )->widget( hb_parni( 2 ) ), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTableView.cpp b/harbour/contrib/hbqt/qtgui/QTableView.cpp index ee27642376..671a444b20 100644 --- a/harbour/contrib/hbqt/qtgui/QTableView.cpp +++ b/harbour/contrib/hbqt/qtgui/QTableView.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,6 +81,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QTableView > pq; } QGC_POINTER_QTableView; @@ -89,48 +90,47 @@ QT_G_FUNC( hbqt_gcRelease_QTableView ) { QGC_POINTER_QTableView * p = ( QGC_POINTER_QTableView * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTableView p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTableView ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QTableView * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QTableView * ) p->ph )->~QTableView(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QTableView * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTableView ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QTableView ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTableView Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QTableView Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTableView Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTableView Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTableView Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTableView( void * pObj ) +void * hbqt_gcAllocate_QTableView( void * pObj, bool bNew ) { QGC_POINTER_QTableView * p = ( QGC_POINTER_QTableView * ) hb_gcAllocate( sizeof( QGC_POINTER_QTableView ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTableView; - new( & p->pq ) QPointer< QTableView >( ( QTableView * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QTableView %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QTableView >( ( QTableView * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QTableView ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -140,7 +140,7 @@ HB_FUNC( QT_QTABLEVIEW ) pObj = ( QTableView* ) new QTableView( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QTableView( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTableView( pObj, true ) ); } /* * void clearSpans () @@ -195,7 +195,7 @@ HB_FUNC( QT_QTABLEVIEW_GRIDSTYLE ) */ HB_FUNC( QT_QTABLEVIEW_HORIZONTALHEADER ) { - hb_retptr( ( QHeaderView* ) hbqt_par_QTableView( 1 )->horizontalHeader() ); + hb_retptrGC( hbqt_gcAllocate_QHeaderView( hbqt_par_QTableView( 1 )->horizontalHeader(), false ) ); } /* @@ -203,7 +203,7 @@ HB_FUNC( QT_QTABLEVIEW_HORIZONTALHEADER ) */ HB_FUNC( QT_QTABLEVIEW_INDEXAT ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QTableView( 1 )->indexAt( *hbqt_par_QPoint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QTableView( 1 )->indexAt( *hbqt_par_QPoint( 2 ) ) ), true ) ); } /* @@ -379,7 +379,7 @@ HB_FUNC( QT_QTABLEVIEW_SORTBYCOLUMN ) */ HB_FUNC( QT_QTABLEVIEW_VERTICALHEADER ) { - hb_retptr( ( QHeaderView* ) hbqt_par_QTableView( 1 )->verticalHeader() ); + hb_retptrGC( hbqt_gcAllocate_QHeaderView( hbqt_par_QTableView( 1 )->verticalHeader(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTableWidget.cpp b/harbour/contrib/hbqt/qtgui/QTableWidget.cpp index fa429e88e1..ae8b62c272 100644 --- a/harbour/contrib/hbqt/qtgui/QTableWidget.cpp +++ b/harbour/contrib/hbqt/qtgui/QTableWidget.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -91,6 +91,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QTableWidget > pq; } QGC_POINTER_QTableWidget; @@ -99,48 +100,47 @@ QT_G_FUNC( hbqt_gcRelease_QTableWidget ) { QGC_POINTER_QTableWidget * p = ( QGC_POINTER_QTableWidget * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTableWidget p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTableWidget ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QTableWidget * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QTableWidget * ) p->ph )->~QTableWidget(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QTableWidget * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTableWidget ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QTableWidget ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTableWidget Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QTableWidget Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTableWidget Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTableWidget Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTableWidget Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTableWidget( void * pObj ) +void * hbqt_gcAllocate_QTableWidget( void * pObj, bool bNew ) { QGC_POINTER_QTableWidget * p = ( QGC_POINTER_QTableWidget * ) hb_gcAllocate( sizeof( QGC_POINTER_QTableWidget ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTableWidget; - new( & p->pq ) QPointer< QTableWidget >( ( QTableWidget * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QTableWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QTableWidget >( ( QTableWidget * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QTableWidget ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -153,14 +153,14 @@ HB_FUNC( QT_QTABLEWIDGET ) else pObj = ( QTableWidget* ) new QTableWidget( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QTableWidget( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTableWidget( pObj, true ) ); } /* * QWidget * cellWidget ( int row, int column ) const */ HB_FUNC( QT_QTABLEWIDGET_CELLWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QTableWidget( 1 )->cellWidget( hb_parni( 2 ), hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QTableWidget( 1 )->cellWidget( hb_parni( 2 ), hb_parni( 3 ) ), false ) ); } /* @@ -200,7 +200,7 @@ HB_FUNC( QT_QTABLEWIDGET_CURRENTCOLUMN ) */ HB_FUNC( QT_QTABLEWIDGET_CURRENTITEM ) { - hb_retptr( ( QTableWidgetItem* ) hbqt_par_QTableWidget( 1 )->currentItem() ); + hb_retptrGC( hbqt_gcAllocate_QTableWidgetItem( hbqt_par_QTableWidget( 1 )->currentItem(), false ) ); } /* @@ -224,7 +224,7 @@ HB_FUNC( QT_QTABLEWIDGET_EDITITEM ) */ HB_FUNC( QT_QTABLEWIDGET_HORIZONTALHEADERITEM ) { - hb_retptr( ( QTableWidgetItem* ) hbqt_par_QTableWidget( 1 )->horizontalHeaderItem( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTableWidgetItem( hbqt_par_QTableWidget( 1 )->horizontalHeaderItem( hb_parni( 2 ) ), false ) ); } /* @@ -232,7 +232,7 @@ HB_FUNC( QT_QTABLEWIDGET_HORIZONTALHEADERITEM ) */ HB_FUNC( QT_QTABLEWIDGET_ITEM ) { - hb_retptr( ( QTableWidgetItem* ) hbqt_par_QTableWidget( 1 )->item( hb_parni( 2 ), hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTableWidgetItem( hbqt_par_QTableWidget( 1 )->item( hb_parni( 2 ), hb_parni( 3 ) ), false ) ); } /* @@ -240,7 +240,7 @@ HB_FUNC( QT_QTABLEWIDGET_ITEM ) */ HB_FUNC( QT_QTABLEWIDGET_ITEMAT ) { - hb_retptr( ( QTableWidgetItem* ) hbqt_par_QTableWidget( 1 )->itemAt( *hbqt_par_QPoint( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTableWidgetItem( hbqt_par_QTableWidget( 1 )->itemAt( *hbqt_par_QPoint( 2 ) ), false ) ); } /* @@ -248,7 +248,7 @@ HB_FUNC( QT_QTABLEWIDGET_ITEMAT ) */ HB_FUNC( QT_QTABLEWIDGET_ITEMAT_1 ) { - hb_retptr( ( QTableWidgetItem* ) hbqt_par_QTableWidget( 1 )->itemAt( hb_parni( 2 ), hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTableWidgetItem( hbqt_par_QTableWidget( 1 )->itemAt( hb_parni( 2 ), hb_parni( 3 ) ), false ) ); } /* @@ -256,7 +256,7 @@ HB_FUNC( QT_QTABLEWIDGET_ITEMAT_1 ) */ HB_FUNC( QT_QTABLEWIDGET_ITEMPROTOTYPE ) { - hb_retptr( ( QTableWidgetItem* ) hbqt_par_QTableWidget( 1 )->itemPrototype() ); + hb_retptrGC( hbqt_gcAllocate_QTableWidgetItem( new QTableWidgetItem( *( hbqt_par_QTableWidget( 1 )->itemPrototype() ) ), true ) ); } /* @@ -416,7 +416,7 @@ HB_FUNC( QT_QTABLEWIDGET_SORTITEMS ) */ HB_FUNC( QT_QTABLEWIDGET_TAKEHORIZONTALHEADERITEM ) { - hb_retptr( ( QTableWidgetItem* ) hbqt_par_QTableWidget( 1 )->takeHorizontalHeaderItem( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTableWidgetItem( hbqt_par_QTableWidget( 1 )->takeHorizontalHeaderItem( hb_parni( 2 ) ), false ) ); } /* @@ -424,7 +424,7 @@ HB_FUNC( QT_QTABLEWIDGET_TAKEHORIZONTALHEADERITEM ) */ HB_FUNC( QT_QTABLEWIDGET_TAKEITEM ) { - hb_retptr( ( QTableWidgetItem* ) hbqt_par_QTableWidget( 1 )->takeItem( hb_parni( 2 ), hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTableWidgetItem( hbqt_par_QTableWidget( 1 )->takeItem( hb_parni( 2 ), hb_parni( 3 ) ), false ) ); } /* @@ -432,7 +432,7 @@ HB_FUNC( QT_QTABLEWIDGET_TAKEITEM ) */ HB_FUNC( QT_QTABLEWIDGET_TAKEVERTICALHEADERITEM ) { - hb_retptr( ( QTableWidgetItem* ) hbqt_par_QTableWidget( 1 )->takeVerticalHeaderItem( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTableWidgetItem( hbqt_par_QTableWidget( 1 )->takeVerticalHeaderItem( hb_parni( 2 ) ), false ) ); } /* @@ -440,7 +440,7 @@ HB_FUNC( QT_QTABLEWIDGET_TAKEVERTICALHEADERITEM ) */ HB_FUNC( QT_QTABLEWIDGET_VERTICALHEADERITEM ) { - hb_retptr( ( QTableWidgetItem* ) hbqt_par_QTableWidget( 1 )->verticalHeaderItem( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTableWidgetItem( hbqt_par_QTableWidget( 1 )->verticalHeaderItem( hb_parni( 2 ) ), false ) ); } /* @@ -456,7 +456,7 @@ HB_FUNC( QT_QTABLEWIDGET_VISUALCOLUMN ) */ HB_FUNC( QT_QTABLEWIDGET_VISUALITEMRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QTableWidget( 1 )->visualItemRect( hbqt_par_QTableWidgetItem( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QTableWidget( 1 )->visualItemRect( hbqt_par_QTableWidgetItem( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTableWidgetItem.cpp b/harbour/contrib/hbqt/qtgui/QTableWidgetItem.cpp index 380f86daaa..727227b8d5 100644 --- a/harbour/contrib/hbqt/qtgui/QTableWidgetItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QTableWidgetItem.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -83,32 +83,49 @@ * virtual ~QTableWidgetItem () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTableWidgetItem; + QT_G_FUNC( hbqt_gcRelease_QTableWidgetItem ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTableWidgetItem p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTableWidgetItem ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTableWidgetItem * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTableWidgetItem Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTableWidgetItem * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTableWidgetItem ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTableWidgetItem Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTableWidgetItem Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTableWidgetItem Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTableWidgetItem( void * pObj ) +void * hbqt_gcAllocate_QTableWidgetItem( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTableWidgetItem; - HB_TRACE( HB_TR_DEBUG, ( " new_QTableWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTableWidgetItem ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -133,14 +150,14 @@ HB_FUNC( QT_QTABLEWIDGETITEM ) pObj = new QTableWidgetItem( 0 ) ; } - hb_retptrGC( hbqt_gcAllocate_QTableWidgetItem( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTableWidgetItem( pObj, true ) ); } /* * QBrush background () const */ HB_FUNC( QT_QTABLEWIDGETITEM_BACKGROUND ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QTableWidgetItem( 1 )->background() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QTableWidgetItem( 1 )->background() ), true ) ); } /* @@ -156,7 +173,7 @@ HB_FUNC( QT_QTABLEWIDGETITEM_CHECKSTATE ) */ HB_FUNC( QT_QTABLEWIDGETITEM_CLONE ) { - hb_retptr( ( QTableWidgetItem* ) hbqt_par_QTableWidgetItem( 1 )->clone() ); + hb_retptrGC( hbqt_gcAllocate_QTableWidgetItem( hbqt_par_QTableWidgetItem( 1 )->clone(), false ) ); } /* @@ -172,7 +189,7 @@ HB_FUNC( QT_QTABLEWIDGETITEM_COLUMN ) */ HB_FUNC( QT_QTABLEWIDGETITEM_DATA ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QTableWidgetItem( 1 )->data( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QTableWidgetItem( 1 )->data( hb_parni( 2 ) ) ), true ) ); } /* @@ -188,7 +205,7 @@ HB_FUNC( QT_QTABLEWIDGETITEM_FLAGS ) */ HB_FUNC( QT_QTABLEWIDGETITEM_FONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QTableWidgetItem( 1 )->font() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QTableWidgetItem( 1 )->font() ), true ) ); } /* @@ -196,7 +213,7 @@ HB_FUNC( QT_QTABLEWIDGETITEM_FONT ) */ HB_FUNC( QT_QTABLEWIDGETITEM_FOREGROUND ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QTableWidgetItem( 1 )->foreground() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QTableWidgetItem( 1 )->foreground() ), true ) ); } /* @@ -204,7 +221,7 @@ HB_FUNC( QT_QTABLEWIDGETITEM_FOREGROUND ) */ HB_FUNC( QT_QTABLEWIDGETITEM_ICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QTableWidgetItem( 1 )->icon() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QTableWidgetItem( 1 )->icon() ), true ) ); } /* @@ -348,7 +365,7 @@ HB_FUNC( QT_QTABLEWIDGETITEM_SETWHATSTHIS ) */ HB_FUNC( QT_QTABLEWIDGETITEM_SIZEHINT ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QTableWidgetItem( 1 )->sizeHint() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QTableWidgetItem( 1 )->sizeHint() ), true ) ); } /* @@ -364,7 +381,7 @@ HB_FUNC( QT_QTABLEWIDGETITEM_STATUSTIP ) */ HB_FUNC( QT_QTABLEWIDGETITEM_TABLEWIDGET ) { - hb_retptr( ( QTableWidget* ) hbqt_par_QTableWidgetItem( 1 )->tableWidget() ); + hb_retptrGC( hbqt_gcAllocate_QTableWidget( hbqt_par_QTableWidgetItem( 1 )->tableWidget(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTableWidgetSelectionRange.cpp b/harbour/contrib/hbqt/qtgui/QTableWidgetSelectionRange.cpp index e88d89b1b5..897c35ff0b 100644 --- a/harbour/contrib/hbqt/qtgui/QTableWidgetSelectionRange.cpp +++ b/harbour/contrib/hbqt/qtgui/QTableWidgetSelectionRange.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -77,32 +77,49 @@ * ~QTableWidgetSelectionRange () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTableWidgetSelectionRange; + QT_G_FUNC( hbqt_gcRelease_QTableWidgetSelectionRange ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTableWidgetSelectionRange p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTableWidgetSelectionRange ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTableWidgetSelectionRange * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTableWidgetSelectionRange Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTableWidgetSelectionRange * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTableWidgetSelectionRange ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTableWidgetSelectionRange Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTableWidgetSelectionRange Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTableWidgetSelectionRange Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTableWidgetSelectionRange( void * pObj ) +void * hbqt_gcAllocate_QTableWidgetSelectionRange( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTableWidgetSelectionRange; - HB_TRACE( HB_TR_DEBUG, ( " new_QTableWidgetSelectionRange %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTableWidgetSelectionRange ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -112,7 +129,7 @@ HB_FUNC( QT_QTABLEWIDGETSELECTIONRANGE ) pObj = new QTableWidgetSelectionRange() ; - hb_retptrGC( hbqt_gcAllocate_QTableWidgetSelectionRange( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTableWidgetSelectionRange( pObj, true ) ); } /* * int bottomRow () const diff --git a/harbour/contrib/hbqt/qtgui/QTextBlock.cpp b/harbour/contrib/hbqt/qtgui/QTextBlock.cpp index e8beee47d2..ecb81b5913 100644 --- a/harbour/contrib/hbqt/qtgui/QTextBlock.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextBlock.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -69,38 +69,56 @@ #include #include - +#include +#include "../hbqt_hbqsyntaxhighlighter.h" /* * QTextBlock ( const QTextBlock & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextBlock; + QT_G_FUNC( hbqt_gcRelease_QTextBlock ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextBlock p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextBlock ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextBlock * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextBlock Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextBlock * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextBlock ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextBlock Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextBlock Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextBlock Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextBlock( void * pObj ) +void * hbqt_gcAllocate_QTextBlock( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextBlock; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextBlock %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextBlock ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -117,14 +135,14 @@ HB_FUNC( QT_QTEXTBLOCK ) pObj = new QTextBlock() ; } - hb_retptrGC( hbqt_gcAllocate_QTextBlock( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextBlock( pObj, true ) ); } /* * QTextBlockFormat blockFormat () const */ HB_FUNC( QT_QTEXTBLOCK_BLOCKFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextBlockFormat( new QTextBlockFormat( hbqt_par_QTextBlock( 1 )->blockFormat() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextBlockFormat( new QTextBlockFormat( hbqt_par_QTextBlock( 1 )->blockFormat() ), true ) ); } /* @@ -148,7 +166,7 @@ HB_FUNC( QT_QTEXTBLOCK_BLOCKNUMBER ) */ HB_FUNC( QT_QTEXTBLOCK_CHARFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QTextBlock( 1 )->charFormat() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QTextBlock( 1 )->charFormat() ), true ) ); } /* @@ -176,7 +194,7 @@ HB_FUNC( QT_QTEXTBLOCK_CONTAINS ) } /* - * const QTextDocument * document () const + * virtual const QTextDocument * document () const */ HB_FUNC( QT_QTEXTBLOCK_DOCUMENT ) { @@ -212,7 +230,7 @@ HB_FUNC( QT_QTEXTBLOCK_ISVISIBLE ) */ HB_FUNC( QT_QTEXTBLOCK_LAYOUT ) { - hb_retptr( ( QTextLayout* ) hbqt_par_QTextBlock( 1 )->layout() ); + hb_retptrGC( hbqt_gcAllocate_QTextLayout( hbqt_par_QTextBlock( 1 )->layout(), false ) ); } /* @@ -236,7 +254,7 @@ HB_FUNC( QT_QTEXTBLOCK_LINECOUNT ) */ HB_FUNC( QT_QTEXTBLOCK_NEXT ) { - hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextBlock( 1 )->next() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextBlock( 1 )->next() ), true ) ); } /* @@ -252,7 +270,7 @@ HB_FUNC( QT_QTEXTBLOCK_POSITION ) */ HB_FUNC( QT_QTEXTBLOCK_PREVIOUS ) { - hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextBlock( 1 )->previous() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextBlock( 1 )->previous() ), true ) ); } /* @@ -279,6 +297,14 @@ HB_FUNC( QT_QTEXTBLOCK_SETREVISION ) hbqt_par_QTextBlock( 1 )->setRevision( hb_parni( 2 ) ); } +/* + * void setUserData ( HBQTextBlockUserData * data ) + */ +HB_FUNC( QT_QTEXTBLOCK_SETUSERDATA ) +{ + hbqt_par_QTextBlock( 1 )->setUserData( hbqt_par_HBQTextBlockUserData( 2 ) ); +} + /* * void setUserState ( int state ) */ @@ -308,7 +334,15 @@ HB_FUNC( QT_QTEXTBLOCK_TEXT ) */ HB_FUNC( QT_QTEXTBLOCK_TEXTLIST ) { - hb_retptr( ( QTextList* ) hbqt_par_QTextBlock( 1 )->textList() ); + hb_retptrGC( hbqt_gcAllocate_QTextList( hbqt_par_QTextBlock( 1 )->textList(), false ) ); +} + +/* + * HBQTextBlockUserData * userData () const + */ +HB_FUNC( QT_QTEXTBLOCK_USERDATA ) +{ + hb_retptr( ( HBQTextBlockUserData* ) hbqt_par_QTextBlock( 1 )->userData() ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextBlockFormat.cpp b/harbour/contrib/hbqt/qtgui/QTextBlockFormat.cpp index fb41c43e0c..9c53c78dba 100644 --- a/harbour/contrib/hbqt/qtgui/QTextBlockFormat.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextBlockFormat.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -94,32 +94,49 @@ * */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextBlockFormat; + QT_G_FUNC( hbqt_gcRelease_QTextBlockFormat ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextBlockFormat p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextBlockFormat ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextBlockFormat * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextBlockFormat Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextBlockFormat * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextBlockFormat ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextBlockFormat Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextBlockFormat Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextBlockFormat Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextBlockFormat( void * pObj ) +void * hbqt_gcAllocate_QTextBlockFormat( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextBlockFormat; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextBlockFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextBlockFormat ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -136,7 +153,7 @@ HB_FUNC( QT_QTEXTBLOCKFORMAT ) pObj = ( QTextBlockFormat* ) new QTextBlockFormat() ; } - hb_retptrGC( hbqt_gcAllocate_QTextBlockFormat( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextBlockFormat( pObj, true ) ); } /* * Qt::Alignment alignment () const diff --git a/harbour/contrib/hbqt/qtgui/QTextBlockGroup.cpp b/harbour/contrib/hbqt/qtgui/QTextBlockGroup.cpp index 71e393540e..2ac6856a09 100644 --- a/harbour/contrib/hbqt/qtgui/QTextBlockGroup.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextBlockGroup.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -75,11 +75,35 @@ * QTextBlockGroup ( QTextDocument * document ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QTextBlockGroup > pq; +} QGC_POINTER_QTextBlockGroup; + QT_G_FUNC( hbqt_gcRelease_QTextBlockGroup ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QTextBlockGroup( void * pObj, bool bNew ) +{ + QGC_POINTER_QTextBlockGroup * p = ( QGC_POINTER_QTextBlockGroup * ) hb_gcAllocate( sizeof( QGC_POINTER_QTextBlockGroup ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QTextBlockGroup; + + if( bNew ) + { + new( & p->pq ) QPointer< QTextBlockGroup >( ( QTextBlockGroup * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextBlockGroup ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QTEXTBLOCKGROUP ) { } diff --git a/harbour/contrib/hbqt/qtgui/QTextBrowser.cpp b/harbour/contrib/hbqt/qtgui/QTextBrowser.cpp index a076662c17..8eee5a0f72 100644 --- a/harbour/contrib/hbqt/qtgui/QTextBrowser.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextBrowser.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -78,6 +78,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QTextBrowser > pq; } QGC_POINTER_QTextBrowser; @@ -86,48 +87,47 @@ QT_G_FUNC( hbqt_gcRelease_QTextBrowser ) { QGC_POINTER_QTextBrowser * p = ( QGC_POINTER_QTextBrowser * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextBrowser p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextBrowser ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QTextBrowser * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QTextBrowser * ) p->ph )->~QTextBrowser(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QTextBrowser * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextBrowser ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QTextBrowser ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextBrowser Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QTextBrowser Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextBrowser Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextBrowser Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextBrowser Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextBrowser( void * pObj ) +void * hbqt_gcAllocate_QTextBrowser( void * pObj, bool bNew ) { QGC_POINTER_QTextBrowser * p = ( QGC_POINTER_QTextBrowser * ) hb_gcAllocate( sizeof( QGC_POINTER_QTextBrowser ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextBrowser; - new( & p->pq ) QPointer< QTextBrowser >( ( QTextBrowser * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QTextBrowser %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QTextBrowser >( ( QTextBrowser * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextBrowser ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -137,7 +137,7 @@ HB_FUNC( QT_QTEXTBROWSER ) pObj = ( QTextBrowser* ) new QTextBrowser( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QTextBrowser( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextBrowser( pObj, true ) ); } /* * int backwardHistoryCount () const @@ -176,7 +176,7 @@ HB_FUNC( QT_QTEXTBROWSER_HISTORYTITLE ) */ HB_FUNC( QT_QTEXTBROWSER_HISTORYURL ) { - hb_retptrGC( hbqt_gcAllocate_QUrl( new QUrl( hbqt_par_QTextBrowser( 1 )->historyUrl( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QUrl( new QUrl( hbqt_par_QTextBrowser( 1 )->historyUrl( hb_parni( 2 ) ) ), true ) ); } /* @@ -200,7 +200,7 @@ HB_FUNC( QT_QTEXTBROWSER_ISFORWARDAVAILABLE ) */ HB_FUNC( QT_QTEXTBROWSER_LOADRESOURCE ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QTextBrowser( 1 )->loadResource( hb_parni( 2 ), *hbqt_par_QUrl( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QTextBrowser( 1 )->loadResource( hb_parni( 2 ), *hbqt_par_QUrl( 3 ) ) ), true ) ); } /* @@ -224,7 +224,7 @@ HB_FUNC( QT_QTEXTBROWSER_OPENLINKS ) */ HB_FUNC( QT_QTEXTBROWSER_SEARCHPATHS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QTextBrowser( 1 )->searchPaths() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QTextBrowser( 1 )->searchPaths() ), true ) ); } /* @@ -256,7 +256,7 @@ HB_FUNC( QT_QTEXTBROWSER_SETSEARCHPATHS ) */ HB_FUNC( QT_QTEXTBROWSER_SOURCE ) { - hb_retptrGC( hbqt_gcAllocate_QUrl( new QUrl( hbqt_par_QTextBrowser( 1 )->source() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QUrl( new QUrl( hbqt_par_QTextBrowser( 1 )->source() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextCharFormat.cpp b/harbour/contrib/hbqt/qtgui/QTextCharFormat.cpp index 81874deb16..8aa10e7c15 100644 --- a/harbour/contrib/hbqt/qtgui/QTextCharFormat.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextCharFormat.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,32 +81,49 @@ * */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextCharFormat; + QT_G_FUNC( hbqt_gcRelease_QTextCharFormat ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextCharFormat p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextCharFormat ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextCharFormat * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextCharFormat Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextCharFormat * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextCharFormat ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextCharFormat Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextCharFormat Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextCharFormat Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextCharFormat( void * pObj ) +void * hbqt_gcAllocate_QTextCharFormat( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextCharFormat; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextCharFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextCharFormat ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -116,7 +133,7 @@ HB_FUNC( QT_QTEXTCHARFORMAT ) pObj = ( QTextCharFormat* ) new QTextCharFormat() ; - hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( pObj, true ) ); } /* * QString anchorHref () const @@ -131,7 +148,7 @@ HB_FUNC( QT_QTEXTCHARFORMAT_ANCHORHREF ) */ HB_FUNC( QT_QTEXTCHARFORMAT_ANCHORNAMES ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QTextCharFormat( 1 )->anchorNames() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QTextCharFormat( 1 )->anchorNames() ), true ) ); } /* @@ -139,7 +156,7 @@ HB_FUNC( QT_QTEXTCHARFORMAT_ANCHORNAMES ) */ HB_FUNC( QT_QTEXTCHARFORMAT_FONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QTextCharFormat( 1 )->font() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QTextCharFormat( 1 )->font() ), true ) ); } /* @@ -459,7 +476,7 @@ HB_FUNC( QT_QTEXTCHARFORMAT_SETVERTICALALIGNMENT ) */ HB_FUNC( QT_QTEXTCHARFORMAT_TEXTOUTLINE ) { - hb_retptrGC( hbqt_gcAllocate_QPen( new QPen( hbqt_par_QTextCharFormat( 1 )->textOutline() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPen( new QPen( hbqt_par_QTextCharFormat( 1 )->textOutline() ), true ) ); } /* @@ -475,7 +492,7 @@ HB_FUNC( QT_QTEXTCHARFORMAT_TOOLTIP ) */ HB_FUNC( QT_QTEXTCHARFORMAT_UNDERLINECOLOR ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QTextCharFormat( 1 )->underlineColor() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QTextCharFormat( 1 )->underlineColor() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextCursor.cpp b/harbour/contrib/hbqt/qtgui/QTextCursor.cpp index ab540cc113..da04efec44 100644 --- a/harbour/contrib/hbqt/qtgui/QTextCursor.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextCursor.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -88,32 +88,49 @@ * ~QTextCursor () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextCursor; + QT_G_FUNC( hbqt_gcRelease_QTextCursor ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextCursor p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextCursor ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextCursor * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextCursor Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextCursor * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextCursor ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextCursor Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextCursor Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextCursor Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextCursor( void * pObj ) +void * hbqt_gcAllocate_QTextCursor( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextCursor; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextCursor %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextCursor ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -151,7 +168,7 @@ HB_FUNC( QT_QTEXTCURSOR ) pObj = ( QTextCursor* ) new QTextCursor() ; } - hb_retptrGC( hbqt_gcAllocate_QTextCursor( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCursor( pObj, true ) ); } /* * int anchor () const @@ -206,7 +223,7 @@ HB_FUNC( QT_QTEXTCURSOR_BEGINEDITBLOCK ) */ HB_FUNC( QT_QTEXTCURSOR_BLOCK ) { - hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextCursor( 1 )->block() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextCursor( 1 )->block() ), true ) ); } /* @@ -214,7 +231,7 @@ HB_FUNC( QT_QTEXTCURSOR_BLOCK ) */ HB_FUNC( QT_QTEXTCURSOR_BLOCKCHARFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QTextCursor( 1 )->blockCharFormat() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QTextCursor( 1 )->blockCharFormat() ), true ) ); } /* @@ -222,7 +239,7 @@ HB_FUNC( QT_QTEXTCURSOR_BLOCKCHARFORMAT ) */ HB_FUNC( QT_QTEXTCURSOR_BLOCKFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextBlockFormat( new QTextBlockFormat( hbqt_par_QTextCursor( 1 )->blockFormat() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextBlockFormat( new QTextBlockFormat( hbqt_par_QTextCursor( 1 )->blockFormat() ), true ) ); } /* @@ -238,7 +255,7 @@ HB_FUNC( QT_QTEXTCURSOR_BLOCKNUMBER ) */ HB_FUNC( QT_QTEXTCURSOR_CHARFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QTextCursor( 1 )->charFormat() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QTextCursor( 1 )->charFormat() ), true ) ); } /* @@ -262,7 +279,7 @@ HB_FUNC( QT_QTEXTCURSOR_COLUMNNUMBER ) */ HB_FUNC( QT_QTEXTCURSOR_CREATELIST ) { - hb_retptr( ( QTextList* ) hbqt_par_QTextCursor( 1 )->createList( *hbqt_par_QTextListFormat( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextList( hbqt_par_QTextCursor( 1 )->createList( *hbqt_par_QTextListFormat( 2 ) ), false ) ); } /* @@ -270,7 +287,7 @@ HB_FUNC( QT_QTEXTCURSOR_CREATELIST ) */ HB_FUNC( QT_QTEXTCURSOR_CREATELIST_1 ) { - hb_retptr( ( QTextList* ) hbqt_par_QTextCursor( 1 )->createList( ( QTextListFormat::Style ) hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextList( hbqt_par_QTextCursor( 1 )->createList( ( QTextListFormat::Style ) hb_parni( 2 ) ), false ) ); } /* @@ -278,7 +295,7 @@ HB_FUNC( QT_QTEXTCURSOR_CREATELIST_1 ) */ HB_FUNC( QT_QTEXTCURSOR_CURRENTFRAME ) { - hb_retptr( ( QTextFrame* ) hbqt_par_QTextCursor( 1 )->currentFrame() ); + hb_retptrGC( hbqt_gcAllocate_QTextFrame( hbqt_par_QTextCursor( 1 )->currentFrame(), false ) ); } /* @@ -286,15 +303,7 @@ HB_FUNC( QT_QTEXTCURSOR_CURRENTFRAME ) */ HB_FUNC( QT_QTEXTCURSOR_CURRENTLIST ) { - hb_retptr( ( QTextList* ) hbqt_par_QTextCursor( 1 )->currentList() ); -} - -/* - * QTextTable * currentTable () const - */ -HB_FUNC( QT_QTEXTCURSOR_CURRENTTABLE ) -{ - hb_retptr( ( QTextTable* ) hbqt_par_QTextCursor( 1 )->currentTable() ); + hb_retptrGC( hbqt_gcAllocate_QTextList( hbqt_par_QTextCursor( 1 )->currentList(), false ) ); } /* @@ -318,7 +327,7 @@ HB_FUNC( QT_QTEXTCURSOR_DELETEPREVIOUSCHAR ) */ HB_FUNC( QT_QTEXTCURSOR_DOCUMENT ) { - hb_retptr( ( QTextDocument* ) hbqt_par_QTextCursor( 1 )->document() ); + hb_retptrGC( hbqt_gcAllocate_QTextDocument( hbqt_par_QTextCursor( 1 )->document(), false ) ); } /* @@ -382,7 +391,7 @@ HB_FUNC( QT_QTEXTCURSOR_INSERTFRAGMENT ) */ HB_FUNC( QT_QTEXTCURSOR_INSERTFRAME ) { - hb_retptr( ( QTextFrame* ) hbqt_par_QTextCursor( 1 )->insertFrame( *hbqt_par_QTextFrameFormat( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextFrame( hbqt_par_QTextCursor( 1 )->insertFrame( *hbqt_par_QTextFrameFormat( 2 ) ), false ) ); } /* @@ -430,7 +439,7 @@ HB_FUNC( QT_QTEXTCURSOR_INSERTIMAGE_3 ) */ HB_FUNC( QT_QTEXTCURSOR_INSERTLIST ) { - hb_retptr( ( QTextList* ) hbqt_par_QTextCursor( 1 )->insertList( *hbqt_par_QTextListFormat( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextList( hbqt_par_QTextCursor( 1 )->insertList( *hbqt_par_QTextListFormat( 2 ) ), false ) ); } /* @@ -438,23 +447,7 @@ HB_FUNC( QT_QTEXTCURSOR_INSERTLIST ) */ HB_FUNC( QT_QTEXTCURSOR_INSERTLIST_1 ) { - hb_retptr( ( QTextList* ) hbqt_par_QTextCursor( 1 )->insertList( ( QTextListFormat::Style ) hb_parni( 2 ) ) ); -} - -/* - * QTextTable * insertTable ( int rows, int columns, const QTextTableFormat & format ) - */ -HB_FUNC( QT_QTEXTCURSOR_INSERTTABLE ) -{ - hb_retptr( ( QTextTable* ) hbqt_par_QTextCursor( 1 )->insertTable( hb_parni( 2 ), hb_parni( 3 ), *hbqt_par_QTextTableFormat( 4 ) ) ); -} - -/* - * QTextTable * insertTable ( int rows, int columns ) - */ -HB_FUNC( QT_QTEXTCURSOR_INSERTTABLE_1 ) -{ - hb_retptr( ( QTextTable* ) hbqt_par_QTextCursor( 1 )->insertTable( hb_parni( 2 ), hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextList( hbqt_par_QTextCursor( 1 )->insertList( ( QTextListFormat::Style ) hb_parni( 2 ) ), false ) ); } /* @@ -584,7 +577,7 @@ HB_FUNC( QT_QTEXTCURSOR_SELECTEDTEXT ) */ HB_FUNC( QT_QTEXTCURSOR_SELECTION ) { - hb_retptrGC( hbqt_gcAllocate_QTextDocumentFragment( new QTextDocumentFragment( hbqt_par_QTextCursor( 1 )->selection() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextDocumentFragment( new QTextDocumentFragment( hbqt_par_QTextCursor( 1 )->selection() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextDocument.cpp b/harbour/contrib/hbqt/qtgui/QTextDocument.cpp index 6b6d65a265..a73607564e 100644 --- a/harbour/contrib/hbqt/qtgui/QTextDocument.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextDocument.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -102,6 +102,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QTextDocument > pq; } QGC_POINTER_QTextDocument; @@ -110,48 +111,47 @@ QT_G_FUNC( hbqt_gcRelease_QTextDocument ) { QGC_POINTER_QTextDocument * p = ( QGC_POINTER_QTextDocument * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextDocument p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextDocument ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QTextDocument * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QTextDocument * ) p->ph )->~QTextDocument(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QTextDocument * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextDocument ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QTextDocument ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextDocument Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QTextDocument Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextDocument Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextDocument Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextDocument Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextDocument( void * pObj ) +void * hbqt_gcAllocate_QTextDocument( void * pObj, bool bNew ) { QGC_POINTER_QTextDocument * p = ( QGC_POINTER_QTextDocument * ) hb_gcAllocate( sizeof( QGC_POINTER_QTextDocument ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextDocument; - new( & p->pq ) QPointer< QTextDocument >( ( QTextDocument * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QTextDocument %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QTextDocument >( ( QTextDocument * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextDocument ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -161,7 +161,7 @@ HB_FUNC( QT_QTEXTDOCUMENT ) pObj = ( QTextDocument* ) new QTextDocument( hbqt_par_QObject( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QTextDocument( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextDocument( pObj, true ) ); } /* * void addResource ( int type, const QUrl & name, const QVariant & resource ) @@ -184,7 +184,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_ADJUSTSIZE ) */ HB_FUNC( QT_QTEXTDOCUMENT_BEGIN ) { - hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->begin() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->begin() ), true ) ); } /* @@ -216,7 +216,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_CLEAR ) */ HB_FUNC( QT_QTEXTDOCUMENT_CLONE ) { - hb_retptr( ( QTextDocument* ) hbqt_par_QTextDocument( 1 )->clone( hbqt_par_QObject( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextDocument( hbqt_par_QTextDocument( 1 )->clone( hbqt_par_QObject( 2 ) ), false ) ); } /* @@ -224,7 +224,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_CLONE ) */ HB_FUNC( QT_QTEXTDOCUMENT_DEFAULTFONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QTextDocument( 1 )->defaultFont() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QTextDocument( 1 )->defaultFont() ), true ) ); } /* @@ -240,7 +240,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_DEFAULTSTYLESHEET ) */ HB_FUNC( QT_QTEXTDOCUMENT_DEFAULTTEXTOPTION ) { - hb_retptrGC( hbqt_gcAllocate_QTextOption( new QTextOption( hbqt_par_QTextDocument( 1 )->defaultTextOption() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextOption( new QTextOption( hbqt_par_QTextDocument( 1 )->defaultTextOption() ), true ) ); } /* @@ -248,7 +248,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_DEFAULTTEXTOPTION ) */ HB_FUNC( QT_QTEXTDOCUMENT_DOCUMENTLAYOUT ) { - hb_retptr( ( QAbstractTextDocumentLayout* ) hbqt_par_QTextDocument( 1 )->documentLayout() ); + hb_retptrGC( hbqt_gcAllocate_QAbstractTextDocumentLayout( hbqt_par_QTextDocument( 1 )->documentLayout(), false ) ); } /* @@ -272,7 +272,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_DRAWCONTENTS ) */ HB_FUNC( QT_QTEXTDOCUMENT_END ) { - hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->end() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->end() ), true ) ); } /* @@ -280,7 +280,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_END ) */ HB_FUNC( QT_QTEXTDOCUMENT_FIND ) { - hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextDocument( 1 )->find( QTextDocument::tr( hb_parc( 2 ) ), *hbqt_par_QTextCursor( 3 ), ( QTextDocument::FindFlags ) hb_parni( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextDocument( 1 )->find( QTextDocument::tr( hb_parc( 2 ) ), *hbqt_par_QTextCursor( 3 ), ( QTextDocument::FindFlags ) hb_parni( 4 ) ) ), true ) ); } /* @@ -288,7 +288,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_FIND ) */ HB_FUNC( QT_QTEXTDOCUMENT_FIND_1 ) { - hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextDocument( 1 )->find( *hbqt_par_QRegExp( 2 ), *hbqt_par_QTextCursor( 3 ), ( QTextDocument::FindFlags ) hb_parni( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextDocument( 1 )->find( *hbqt_par_QRegExp( 2 ), *hbqt_par_QTextCursor( 3 ), ( QTextDocument::FindFlags ) hb_parni( 4 ) ) ), true ) ); } /* @@ -296,7 +296,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_FIND_1 ) */ HB_FUNC( QT_QTEXTDOCUMENT_FIND_2 ) { - hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextDocument( 1 )->find( QTextDocument::tr( hb_parc( 2 ) ), hb_parni( 3 ), ( QTextDocument::FindFlags ) hb_parni( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextDocument( 1 )->find( QTextDocument::tr( hb_parc( 2 ) ), hb_parni( 3 ), ( QTextDocument::FindFlags ) hb_parni( 4 ) ) ), true ) ); } /* @@ -304,7 +304,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_FIND_2 ) */ HB_FUNC( QT_QTEXTDOCUMENT_FIND_3 ) { - hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextDocument( 1 )->find( *hbqt_par_QRegExp( 2 ), hb_parni( 3 ), ( QTextDocument::FindFlags ) hb_parni( 4 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextDocument( 1 )->find( *hbqt_par_QRegExp( 2 ), hb_parni( 3 ), ( QTextDocument::FindFlags ) hb_parni( 4 ) ) ), true ) ); } /* @@ -312,7 +312,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_FIND_3 ) */ HB_FUNC( QT_QTEXTDOCUMENT_FINDBLOCK ) { - hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->findBlock( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->findBlock( hb_parni( 2 ) ) ), true ) ); } /* @@ -320,7 +320,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_FINDBLOCK ) */ HB_FUNC( QT_QTEXTDOCUMENT_FINDBLOCKBYLINENUMBER ) { - hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->findBlockByLineNumber( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->findBlockByLineNumber( hb_parni( 2 ) ) ), true ) ); } /* @@ -328,7 +328,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_FINDBLOCKBYLINENUMBER ) */ HB_FUNC( QT_QTEXTDOCUMENT_FINDBLOCKBYNUMBER ) { - hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->findBlockByNumber( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->findBlockByNumber( hb_parni( 2 ) ) ), true ) ); } /* @@ -336,7 +336,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_FINDBLOCKBYNUMBER ) */ HB_FUNC( QT_QTEXTDOCUMENT_FIRSTBLOCK ) { - hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->firstBlock() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->firstBlock() ), true ) ); } /* @@ -400,7 +400,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_ISUNDOREDOENABLED ) */ HB_FUNC( QT_QTEXTDOCUMENT_LASTBLOCK ) { - hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->lastBlock() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextDocument( 1 )->lastBlock() ), true ) ); } /* @@ -440,7 +440,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_METAINFORMATION ) */ HB_FUNC( QT_QTEXTDOCUMENT_OBJECT ) { - hb_retptr( ( QTextObject* ) hbqt_par_QTextDocument( 1 )->object( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextObject( hbqt_par_QTextDocument( 1 )->object( hb_parni( 2 ) ), false ) ); } /* @@ -448,7 +448,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_OBJECT ) */ HB_FUNC( QT_QTEXTDOCUMENT_OBJECTFORFORMAT ) { - hb_retptr( ( QTextObject* ) hbqt_par_QTextDocument( 1 )->objectForFormat( *hbqt_par_QTextFormat( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextObject( hbqt_par_QTextDocument( 1 )->objectForFormat( *hbqt_par_QTextFormat( 2 ) ), false ) ); } /* @@ -464,7 +464,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_PAGECOUNT ) */ HB_FUNC( QT_QTEXTDOCUMENT_PAGESIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSizeF( new QSizeF( hbqt_par_QTextDocument( 1 )->pageSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSizeF( new QSizeF( hbqt_par_QTextDocument( 1 )->pageSize() ), true ) ); } /* @@ -488,7 +488,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_REDO ) */ HB_FUNC( QT_QTEXTDOCUMENT_RESOURCE ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QTextDocument( 1 )->resource( hb_parni( 2 ), *hbqt_par_QUrl( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QTextDocument( 1 )->resource( hb_parni( 2 ), *hbqt_par_QUrl( 3 ) ) ), true ) ); } /* @@ -504,7 +504,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_REVISION ) */ HB_FUNC( QT_QTEXTDOCUMENT_ROOTFRAME ) { - hb_retptr( ( QTextFrame* ) hbqt_par_QTextDocument( 1 )->rootFrame() ); + hb_retptrGC( hbqt_gcAllocate_QTextFrame( hbqt_par_QTextDocument( 1 )->rootFrame(), false ) ); } /* @@ -624,7 +624,7 @@ HB_FUNC( QT_QTEXTDOCUMENT_SETUSEDESIGNMETRICS ) */ HB_FUNC( QT_QTEXTDOCUMENT_SIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSizeF( new QSizeF( hbqt_par_QTextDocument( 1 )->size() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSizeF( new QSizeF( hbqt_par_QTextDocument( 1 )->size() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextDocumentFragment.cpp b/harbour/contrib/hbqt/qtgui/QTextDocumentFragment.cpp index 64064eeb79..bdd4b6909a 100644 --- a/harbour/contrib/hbqt/qtgui/QTextDocumentFragment.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextDocumentFragment.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,32 +79,49 @@ * ~QTextDocumentFragment () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextDocumentFragment; + QT_G_FUNC( hbqt_gcRelease_QTextDocumentFragment ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextDocumentFragment p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextDocumentFragment ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextDocumentFragment * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextDocumentFragment Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextDocumentFragment * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextDocumentFragment ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextDocumentFragment Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextDocumentFragment Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextDocumentFragment Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextDocumentFragment( void * pObj ) +void * hbqt_gcAllocate_QTextDocumentFragment( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextDocumentFragment; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextDocumentFragment %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextDocumentFragment ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -114,7 +131,7 @@ HB_FUNC( QT_QTEXTDOCUMENTFRAGMENT ) pObj = ( QTextDocumentFragment* ) new QTextDocumentFragment() ; - hb_retptrGC( hbqt_gcAllocate_QTextDocumentFragment( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextDocumentFragment( pObj, true ) ); } /* * bool isEmpty () const @@ -153,7 +170,7 @@ HB_FUNC( QT_QTEXTDOCUMENTFRAGMENT_TOPLAINTEXT ) */ HB_FUNC( QT_QTEXTDOCUMENTFRAGMENT_FROMHTML ) { - hb_retptrGC( hbqt_gcAllocate_QTextDocumentFragment( new QTextDocumentFragment( hbqt_par_QTextDocumentFragment( 1 )->fromHtml( hbqt_par_QString( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextDocumentFragment( new QTextDocumentFragment( hbqt_par_QTextDocumentFragment( 1 )->fromHtml( hbqt_par_QString( 2 ) ) ), true ) ); } /* @@ -161,7 +178,7 @@ HB_FUNC( QT_QTEXTDOCUMENTFRAGMENT_FROMHTML ) */ HB_FUNC( QT_QTEXTDOCUMENTFRAGMENT_FROMHTML_1 ) { - hb_retptrGC( hbqt_gcAllocate_QTextDocumentFragment( new QTextDocumentFragment( hbqt_par_QTextDocumentFragment( 1 )->fromHtml( hbqt_par_QString( 2 ), hbqt_par_QTextDocument( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextDocumentFragment( new QTextDocumentFragment( hbqt_par_QTextDocumentFragment( 1 )->fromHtml( hbqt_par_QString( 2 ), hbqt_par_QTextDocument( 3 ) ) ), true ) ); } /* @@ -169,7 +186,7 @@ HB_FUNC( QT_QTEXTDOCUMENTFRAGMENT_FROMHTML_1 ) */ HB_FUNC( QT_QTEXTDOCUMENTFRAGMENT_FROMPLAINTEXT ) { - hb_retptrGC( hbqt_gcAllocate_QTextDocumentFragment( new QTextDocumentFragment( hbqt_par_QTextDocumentFragment( 1 )->fromPlainText( hbqt_par_QString( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextDocumentFragment( new QTextDocumentFragment( hbqt_par_QTextDocumentFragment( 1 )->fromPlainText( hbqt_par_QString( 2 ) ) ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QTextDocumentWriter.cpp b/harbour/contrib/hbqt/qtgui/QTextDocumentWriter.cpp index 8a2017feb0..03d31064f8 100644 --- a/harbour/contrib/hbqt/qtgui/QTextDocumentWriter.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextDocumentWriter.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -78,32 +78,49 @@ * ~QTextDocumentWriter () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextDocumentWriter; + QT_G_FUNC( hbqt_gcRelease_QTextDocumentWriter ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextDocumentWriter p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextDocumentWriter ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextDocumentWriter * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextDocumentWriter Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextDocumentWriter * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextDocumentWriter ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextDocumentWriter Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextDocumentWriter Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextDocumentWriter Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextDocumentWriter( void * pObj ) +void * hbqt_gcAllocate_QTextDocumentWriter( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextDocumentWriter; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextDocumentWriter %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextDocumentWriter ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -113,14 +130,14 @@ HB_FUNC( QT_QTEXTDOCUMENTWRITER ) pObj = ( QTextDocumentWriter* ) new QTextDocumentWriter() ; - hb_retptrGC( hbqt_gcAllocate_QTextDocumentWriter( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextDocumentWriter( pObj, true ) ); } /* * QTextCodec * codec () const */ HB_FUNC( QT_QTEXTDOCUMENTWRITER_CODEC ) { - hb_retptr( ( QTextCodec* ) hbqt_par_QTextDocumentWriter( 1 )->codec() ); + hb_retptrGC( hbqt_gcAllocate_QTextCodec( hbqt_par_QTextDocumentWriter( 1 )->codec(), false ) ); } /* @@ -128,7 +145,7 @@ HB_FUNC( QT_QTEXTDOCUMENTWRITER_CODEC ) */ HB_FUNC( QT_QTEXTDOCUMENTWRITER_DEVICE ) { - hb_retptr( ( QIODevice* ) hbqt_par_QTextDocumentWriter( 1 )->device() ); + hb_retptrGC( hbqt_gcAllocate_QIODevice( hbqt_par_QTextDocumentWriter( 1 )->device(), false ) ); } /* @@ -144,7 +161,7 @@ HB_FUNC( QT_QTEXTDOCUMENTWRITER_FILENAME ) */ HB_FUNC( QT_QTEXTDOCUMENTWRITER_FORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QTextDocumentWriter( 1 )->format() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QTextDocumentWriter( 1 )->format() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextEdit.cpp b/harbour/contrib/hbqt/qtgui/QTextEdit.cpp index f1bc5cdd95..2f31efe08d 100644 --- a/harbour/contrib/hbqt/qtgui/QTextEdit.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextEdit.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -95,6 +95,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QTextEdit > pq; } QGC_POINTER_QTextEdit; @@ -103,48 +104,47 @@ QT_G_FUNC( hbqt_gcRelease_QTextEdit ) { QGC_POINTER_QTextEdit * p = ( QGC_POINTER_QTextEdit * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextEdit p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextEdit ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QTextEdit * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QTextEdit * ) p->ph )->~QTextEdit(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QTextEdit * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextEdit ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QTextEdit ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextEdit Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QTextEdit Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextEdit Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextEdit Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextEdit Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextEdit( void * pObj ) +void * hbqt_gcAllocate_QTextEdit( void * pObj, bool bNew ) { QGC_POINTER_QTextEdit * p = ( QGC_POINTER_QTextEdit * ) hb_gcAllocate( sizeof( QGC_POINTER_QTextEdit ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextEdit; - new( & p->pq ) QPointer< QTextEdit >( ( QTextEdit * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QTextEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QTextEdit >( ( QTextEdit * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextEdit ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -157,7 +157,7 @@ HB_FUNC( QT_QTEXTEDIT ) else pObj = new QTextEdit( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QTextEdit( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextEdit( pObj, true ) ); } /* * bool acceptRichText () const @@ -204,7 +204,7 @@ HB_FUNC( QT_QTEXTEDIT_CANPASTE ) */ HB_FUNC( QT_QTEXTEDIT_CREATESTANDARDCONTEXTMENU ) { - hb_retptr( ( QMenu* ) hbqt_par_QTextEdit( 1 )->createStandardContextMenu() ); + hb_retptrGC( hbqt_gcAllocate_QMenu( hbqt_par_QTextEdit( 1 )->createStandardContextMenu(), false ) ); } /* @@ -212,7 +212,7 @@ HB_FUNC( QT_QTEXTEDIT_CREATESTANDARDCONTEXTMENU ) */ HB_FUNC( QT_QTEXTEDIT_CREATESTANDARDCONTEXTMENU_1 ) { - hb_retptr( ( QMenu* ) hbqt_par_QTextEdit( 1 )->createStandardContextMenu( *hbqt_par_QPoint( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QMenu( hbqt_par_QTextEdit( 1 )->createStandardContextMenu( *hbqt_par_QPoint( 2 ) ), false ) ); } /* @@ -220,7 +220,7 @@ HB_FUNC( QT_QTEXTEDIT_CREATESTANDARDCONTEXTMENU_1 ) */ HB_FUNC( QT_QTEXTEDIT_CURRENTCHARFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QTextEdit( 1 )->currentCharFormat() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QTextEdit( 1 )->currentCharFormat() ), true ) ); } /* @@ -228,7 +228,7 @@ HB_FUNC( QT_QTEXTEDIT_CURRENTCHARFORMAT ) */ HB_FUNC( QT_QTEXTEDIT_CURRENTFONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QTextEdit( 1 )->currentFont() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QTextEdit( 1 )->currentFont() ), true ) ); } /* @@ -236,7 +236,7 @@ HB_FUNC( QT_QTEXTEDIT_CURRENTFONT ) */ HB_FUNC( QT_QTEXTEDIT_CURSORFORPOSITION ) { - hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextEdit( 1 )->cursorForPosition( *hbqt_par_QPoint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextEdit( 1 )->cursorForPosition( *hbqt_par_QPoint( 2 ) ) ), true ) ); } /* @@ -244,7 +244,7 @@ HB_FUNC( QT_QTEXTEDIT_CURSORFORPOSITION ) */ HB_FUNC( QT_QTEXTEDIT_CURSORRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QTextEdit( 1 )->cursorRect( *hbqt_par_QTextCursor( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QTextEdit( 1 )->cursorRect( *hbqt_par_QTextCursor( 2 ) ) ), true ) ); } /* @@ -252,7 +252,7 @@ HB_FUNC( QT_QTEXTEDIT_CURSORRECT ) */ HB_FUNC( QT_QTEXTEDIT_CURSORRECT_1 ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QTextEdit( 1 )->cursorRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QTextEdit( 1 )->cursorRect() ), true ) ); } /* @@ -268,7 +268,7 @@ HB_FUNC( QT_QTEXTEDIT_CURSORWIDTH ) */ HB_FUNC( QT_QTEXTEDIT_DOCUMENT ) { - hb_retptr( ( QTextDocument* ) hbqt_par_QTextEdit( 1 )->document() ); + hb_retptrGC( hbqt_gcAllocate_QTextDocument( hbqt_par_QTextEdit( 1 )->document(), false ) ); } /* @@ -372,7 +372,7 @@ HB_FUNC( QT_QTEXTEDIT_LINEWRAPMODE ) */ HB_FUNC( QT_QTEXTEDIT_LOADRESOURCE ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QTextEdit( 1 )->loadResource( hb_parni( 2 ), *hbqt_par_QUrl( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QTextEdit( 1 )->loadResource( hb_parni( 2 ), *hbqt_par_QUrl( 3 ) ) ), true ) ); } /* @@ -556,7 +556,7 @@ HB_FUNC( QT_QTEXTEDIT_TABSTOPWIDTH ) */ HB_FUNC( QT_QTEXTEDIT_TEXTBACKGROUNDCOLOR ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QTextEdit( 1 )->textBackgroundColor() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QTextEdit( 1 )->textBackgroundColor() ), true ) ); } /* @@ -564,7 +564,7 @@ HB_FUNC( QT_QTEXTEDIT_TEXTBACKGROUNDCOLOR ) */ HB_FUNC( QT_QTEXTEDIT_TEXTCOLOR ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QTextEdit( 1 )->textColor() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QTextEdit( 1 )->textColor() ), true ) ); } /* @@ -572,7 +572,7 @@ HB_FUNC( QT_QTEXTEDIT_TEXTCOLOR ) */ HB_FUNC( QT_QTEXTEDIT_TEXTCURSOR ) { - hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextEdit( 1 )->textCursor() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextEdit( 1 )->textCursor() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextFormat.cpp b/harbour/contrib/hbqt/qtgui/QTextFormat.cpp index c621400067..73ab5493d5 100644 --- a/harbour/contrib/hbqt/qtgui/QTextFormat.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextFormat.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -101,32 +101,49 @@ * ~QTextFormat () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextFormat; + QT_G_FUNC( hbqt_gcRelease_QTextFormat ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextFormat p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextFormat ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextFormat * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextFormat Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextFormat * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextFormat ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextFormat Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextFormat Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextFormat Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextFormat( void * pObj ) +void * hbqt_gcAllocate_QTextFormat( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextFormat; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextFormat ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -136,14 +153,14 @@ HB_FUNC( QT_QTEXTFORMAT ) pObj = ( QTextFormat* ) new QTextFormat() ; - hb_retptrGC( hbqt_gcAllocate_QTextFormat( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextFormat( pObj, true ) ); } /* * QBrush background () const */ HB_FUNC( QT_QTEXTFORMAT_BACKGROUND ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QTextFormat( 1 )->background() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QTextFormat( 1 )->background() ), true ) ); } /* @@ -159,7 +176,7 @@ HB_FUNC( QT_QTEXTFORMAT_BOOLPROPERTY ) */ HB_FUNC( QT_QTEXTFORMAT_BRUSHPROPERTY ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QTextFormat( 1 )->brushProperty( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QTextFormat( 1 )->brushProperty( hb_parni( 2 ) ) ), true ) ); } /* @@ -191,7 +208,7 @@ HB_FUNC( QT_QTEXTFORMAT_CLEARPROPERTY ) */ HB_FUNC( QT_QTEXTFORMAT_COLORPROPERTY ) { - hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QTextFormat( 1 )->colorProperty( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QColor( new QColor( hbqt_par_QTextFormat( 1 )->colorProperty( hb_parni( 2 ) ) ), true ) ); } /* @@ -207,7 +224,7 @@ HB_FUNC( QT_QTEXTFORMAT_DOUBLEPROPERTY ) */ HB_FUNC( QT_QTEXTFORMAT_FOREGROUND ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QTextFormat( 1 )->foreground() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QTextFormat( 1 )->foreground() ), true ) ); } /* @@ -303,7 +320,7 @@ HB_FUNC( QT_QTEXTFORMAT_LAYOUTDIRECTION ) */ HB_FUNC( QT_QTEXTFORMAT_LENGTHPROPERTY ) { - hb_retptrGC( hbqt_gcAllocate_QTextLength( new QTextLength( hbqt_par_QTextFormat( 1 )->lengthProperty( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextLength( new QTextLength( hbqt_par_QTextFormat( 1 )->lengthProperty( hb_parni( 2 ) ) ), true ) ); } /* @@ -335,7 +352,7 @@ HB_FUNC( QT_QTEXTFORMAT_OBJECTTYPE ) */ HB_FUNC( QT_QTEXTFORMAT_PENPROPERTY ) { - hb_retptrGC( hbqt_gcAllocate_QPen( new QPen( hbqt_par_QTextFormat( 1 )->penProperty( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPen( new QPen( hbqt_par_QTextFormat( 1 )->penProperty( hb_parni( 2 ) ) ), true ) ); } /* @@ -343,7 +360,7 @@ HB_FUNC( QT_QTEXTFORMAT_PENPROPERTY ) */ HB_FUNC( QT_QTEXTFORMAT_PROPERTY ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QTextFormat( 1 )->property( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QTextFormat( 1 )->property( hb_parni( 2 ) ) ), true ) ); } /* @@ -415,7 +432,7 @@ HB_FUNC( QT_QTEXTFORMAT_STRINGPROPERTY ) */ HB_FUNC( QT_QTEXTFORMAT_TOBLOCKFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextBlockFormat( new QTextBlockFormat( hbqt_par_QTextFormat( 1 )->toBlockFormat() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextBlockFormat( new QTextBlockFormat( hbqt_par_QTextFormat( 1 )->toBlockFormat() ), true ) ); } /* @@ -423,7 +440,7 @@ HB_FUNC( QT_QTEXTFORMAT_TOBLOCKFORMAT ) */ HB_FUNC( QT_QTEXTFORMAT_TOCHARFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QTextFormat( 1 )->toCharFormat() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QTextFormat( 1 )->toCharFormat() ), true ) ); } /* @@ -431,7 +448,7 @@ HB_FUNC( QT_QTEXTFORMAT_TOCHARFORMAT ) */ HB_FUNC( QT_QTEXTFORMAT_TOFRAMEFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextFrameFormat( new QTextFrameFormat( hbqt_par_QTextFormat( 1 )->toFrameFormat() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextFrameFormat( new QTextFrameFormat( hbqt_par_QTextFormat( 1 )->toFrameFormat() ), true ) ); } /* @@ -439,7 +456,7 @@ HB_FUNC( QT_QTEXTFORMAT_TOFRAMEFORMAT ) */ HB_FUNC( QT_QTEXTFORMAT_TOIMAGEFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextImageFormat( new QTextImageFormat( hbqt_par_QTextFormat( 1 )->toImageFormat() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextImageFormat( new QTextImageFormat( hbqt_par_QTextFormat( 1 )->toImageFormat() ), true ) ); } /* @@ -447,7 +464,7 @@ HB_FUNC( QT_QTEXTFORMAT_TOIMAGEFORMAT ) */ HB_FUNC( QT_QTEXTFORMAT_TOLISTFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextListFormat( new QTextListFormat( hbqt_par_QTextFormat( 1 )->toListFormat() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextListFormat( new QTextListFormat( hbqt_par_QTextFormat( 1 )->toListFormat() ), true ) ); } /* @@ -455,7 +472,7 @@ HB_FUNC( QT_QTEXTFORMAT_TOLISTFORMAT ) */ HB_FUNC( QT_QTEXTFORMAT_TOTABLEFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextTableFormat( new QTextTableFormat( hbqt_par_QTextFormat( 1 )->toTableFormat() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextTableFormat( new QTextTableFormat( hbqt_par_QTextFormat( 1 )->toTableFormat() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextFragment.cpp b/harbour/contrib/hbqt/qtgui/QTextFragment.cpp index c18078139c..335ac69879 100644 --- a/harbour/contrib/hbqt/qtgui/QTextFragment.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextFragment.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -76,32 +76,49 @@ * QTextFragment ( const QTextFragment & other ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextFragment; + QT_G_FUNC( hbqt_gcRelease_QTextFragment ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextFragment p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextFragment ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextFragment * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextFragment Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextFragment * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextFragment ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextFragment Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextFragment Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextFragment Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextFragment( void * pObj ) +void * hbqt_gcAllocate_QTextFragment( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextFragment; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextFragment %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextFragment ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -111,14 +128,14 @@ HB_FUNC( QT_QTEXTFRAGMENT ) pObj = ( QTextFragment* ) new QTextFragment() ; - hb_retptrGC( hbqt_gcAllocate_QTextFragment( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextFragment( pObj, true ) ); } /* * QTextCharFormat charFormat () const */ HB_FUNC( QT_QTEXTFRAGMENT_CHARFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QTextFragment( 1 )->charFormat() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( hbqt_par_QTextFragment( 1 )->charFormat() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextFrame.cpp b/harbour/contrib/hbqt/qtgui/QTextFrame.cpp index 833b1c2c01..9aa21025be 100644 --- a/harbour/contrib/hbqt/qtgui/QTextFrame.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextFrame.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -94,6 +94,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QTextFrame > pq; } QGC_POINTER_QTextFrame; @@ -102,48 +103,47 @@ QT_G_FUNC( hbqt_gcRelease_QTextFrame ) { QGC_POINTER_QTextFrame * p = ( QGC_POINTER_QTextFrame * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextFrame p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextFrame ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QTextFrame * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QTextFrame * ) p->ph )->~QTextFrame(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QTextFrame * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextFrame ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QTextFrame ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextFrame Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QTextFrame Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextFrame Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextFrame Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextFrame Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextFrame( void * pObj ) +void * hbqt_gcAllocate_QTextFrame( void * pObj, bool bNew ) { QGC_POINTER_QTextFrame * p = ( QGC_POINTER_QTextFrame * ) hb_gcAllocate( sizeof( QGC_POINTER_QTextFrame ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextFrame; - new( & p->pq ) QPointer< QTextFrame >( ( QTextFrame * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QTextFrame %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QTextFrame >( ( QTextFrame * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextFrame ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -153,14 +153,14 @@ HB_FUNC( QT_QTEXTFRAME ) pObj = ( QTextFrame* ) new QTextFrame( hbqt_par_QTextDocument( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QTextFrame( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextFrame( pObj, true ) ); } /* * QTextCursor firstCursorPosition () const */ HB_FUNC( QT_QTEXTFRAME_FIRSTCURSORPOSITION ) { - hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextFrame( 1 )->firstCursorPosition() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextFrame( 1 )->firstCursorPosition() ), true ) ); } /* @@ -176,7 +176,7 @@ HB_FUNC( QT_QTEXTFRAME_FIRSTPOSITION ) */ HB_FUNC( QT_QTEXTFRAME_FRAMEFORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextFrameFormat( new QTextFrameFormat( hbqt_par_QTextFrame( 1 )->frameFormat() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextFrameFormat( new QTextFrameFormat( hbqt_par_QTextFrame( 1 )->frameFormat() ), true ) ); } /* @@ -184,7 +184,7 @@ HB_FUNC( QT_QTEXTFRAME_FRAMEFORMAT ) */ HB_FUNC( QT_QTEXTFRAME_LASTCURSORPOSITION ) { - hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextFrame( 1 )->lastCursorPosition() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextCursor( new QTextCursor( hbqt_par_QTextFrame( 1 )->lastCursorPosition() ), true ) ); } /* @@ -200,7 +200,7 @@ HB_FUNC( QT_QTEXTFRAME_LASTPOSITION ) */ HB_FUNC( QT_QTEXTFRAME_PARENTFRAME ) { - hb_retptr( ( QTextFrame* ) hbqt_par_QTextFrame( 1 )->parentFrame() ); + hb_retptrGC( hbqt_gcAllocate_QTextFrame( hbqt_par_QTextFrame( 1 )->parentFrame(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextFrameFormat.cpp b/harbour/contrib/hbqt/qtgui/QTextFrameFormat.cpp index c6b28fac2b..79437556f5 100644 --- a/harbour/contrib/hbqt/qtgui/QTextFrameFormat.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextFrameFormat.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -85,32 +85,49 @@ * QTextFrameFormat () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextFrameFormat; + QT_G_FUNC( hbqt_gcRelease_QTextFrameFormat ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextFrameFormat p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextFrameFormat ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextFrameFormat * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextFrameFormat Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextFrameFormat * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextFrameFormat ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextFrameFormat Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextFrameFormat Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextFrameFormat Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextFrameFormat( void * pObj ) +void * hbqt_gcAllocate_QTextFrameFormat( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextFrameFormat; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextFrameFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextFrameFormat ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -120,7 +137,7 @@ HB_FUNC( QT_QTEXTFRAMEFORMAT ) pObj = ( QTextFrameFormat* ) new QTextFrameFormat() ; - hb_retptrGC( hbqt_gcAllocate_QTextFrameFormat( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextFrameFormat( pObj, true ) ); } /* * qreal border () const @@ -135,7 +152,7 @@ HB_FUNC( QT_QTEXTFRAMEFORMAT_BORDER ) */ HB_FUNC( QT_QTEXTFRAMEFORMAT_BORDERBRUSH ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QTextFrameFormat( 1 )->borderBrush() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QTextFrameFormat( 1 )->borderBrush() ), true ) ); } /* @@ -159,7 +176,7 @@ HB_FUNC( QT_QTEXTFRAMEFORMAT_BOTTOMMARGIN ) */ HB_FUNC( QT_QTEXTFRAMEFORMAT_HEIGHT ) { - hb_retptrGC( hbqt_gcAllocate_QTextLength( new QTextLength( hbqt_par_QTextFrameFormat( 1 )->height() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextLength( new QTextLength( hbqt_par_QTextFrameFormat( 1 )->height() ), true ) ); } /* @@ -351,7 +368,7 @@ HB_FUNC( QT_QTEXTFRAMEFORMAT_TOPMARGIN ) */ HB_FUNC( QT_QTEXTFRAMEFORMAT_WIDTH ) { - hb_retptrGC( hbqt_gcAllocate_QTextLength( new QTextLength( hbqt_par_QTextFrameFormat( 1 )->width() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextLength( new QTextLength( hbqt_par_QTextFrameFormat( 1 )->width() ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QTextImageFormat.cpp b/harbour/contrib/hbqt/qtgui/QTextImageFormat.cpp index bf4542749e..5d26f88f5c 100644 --- a/harbour/contrib/hbqt/qtgui/QTextImageFormat.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextImageFormat.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -76,32 +76,49 @@ * */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextImageFormat; + QT_G_FUNC( hbqt_gcRelease_QTextImageFormat ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextImageFormat p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextImageFormat ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextImageFormat * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextImageFormat Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextImageFormat * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextImageFormat ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextImageFormat Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextImageFormat Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextImageFormat Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextImageFormat( void * pObj ) +void * hbqt_gcAllocate_QTextImageFormat( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextImageFormat; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextImageFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextImageFormat ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -111,7 +128,7 @@ HB_FUNC( QT_QTEXTIMAGEFORMAT ) pObj = ( QTextImageFormat* ) new QTextImageFormat() ; - hb_retptrGC( hbqt_gcAllocate_QTextImageFormat( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextImageFormat( pObj, true ) ); } /* * qreal height () const diff --git a/harbour/contrib/hbqt/qtgui/QTextInlineObject.cpp b/harbour/contrib/hbqt/qtgui/QTextInlineObject.cpp index 0d4ab32681..e9d1328c2b 100644 --- a/harbour/contrib/hbqt/qtgui/QTextInlineObject.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextInlineObject.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -76,11 +76,33 @@ * */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextInlineObject; + QT_G_FUNC( hbqt_gcRelease_QTextInlineObject ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QTextInlineObject( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QTextInlineObject; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextInlineObject ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QTEXTINLINEOBJECT ) { } @@ -105,7 +127,7 @@ HB_FUNC( QT_QTEXTINLINEOBJECT_DESCENT ) */ HB_FUNC( QT_QTEXTINLINEOBJECT_FORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextFormat( new QTextFormat( hbqt_par_QTextInlineObject( 1 )->format() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextFormat( new QTextFormat( hbqt_par_QTextInlineObject( 1 )->format() ), true ) ); } /* @@ -137,7 +159,7 @@ HB_FUNC( QT_QTEXTINLINEOBJECT_ISVALID ) */ HB_FUNC( QT_QTEXTINLINEOBJECT_RECT ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QTextInlineObject( 1 )->rect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QTextInlineObject( 1 )->rect() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextItem.cpp b/harbour/contrib/hbqt/qtgui/QTextItem.cpp index 04cb0cfee7..e43429fb42 100644 --- a/harbour/contrib/hbqt/qtgui/QTextItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextItem.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,32 +81,49 @@ * */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextItem; + QT_G_FUNC( hbqt_gcRelease_QTextItem ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextItem p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextItem ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextItem * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextItem Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextItem * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextItem ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextItem Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextItem Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextItem Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextItem( void * pObj ) +void * hbqt_gcAllocate_QTextItem( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextItem; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextItem %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextItem ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -116,7 +133,7 @@ HB_FUNC( QT_QTEXTITEM ) pObj = ( QTextItem* ) new QTextItem() ; - hb_retptrGC( hbqt_gcAllocate_QTextItem( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextItem( pObj, true ) ); } /* * qreal ascent () const @@ -139,7 +156,7 @@ HB_FUNC( QT_QTEXTITEM_DESCENT ) */ HB_FUNC( QT_QTEXTITEM_FONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QTextItem( 1 )->font() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QTextItem( 1 )->font() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextLayout.cpp b/harbour/contrib/hbqt/qtgui/QTextLayout.cpp index 1cb8ebddcb..bfa3065a87 100644 --- a/harbour/contrib/hbqt/qtgui/QTextLayout.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextLayout.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -93,32 +93,49 @@ * ~QTextLayout () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextLayout; + QT_G_FUNC( hbqt_gcRelease_QTextLayout ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextLayout p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextLayout ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextLayout * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextLayout Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextLayout * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextLayout ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextLayout Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextLayout Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextLayout Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextLayout( void * pObj ) +void * hbqt_gcAllocate_QTextLayout( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextLayout; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextLayout ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -128,7 +145,7 @@ HB_FUNC( QT_QTEXTLAYOUT ) pObj = ( QTextLayout* ) new QTextLayout() ; - hb_retptrGC( hbqt_gcAllocate_QTextLayout( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextLayout( pObj, true ) ); } /* * void beginLayout () @@ -143,7 +160,7 @@ HB_FUNC( QT_QTEXTLAYOUT_BEGINLAYOUT ) */ HB_FUNC( QT_QTEXTLAYOUT_BOUNDINGRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QTextLayout( 1 )->boundingRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QTextLayout( 1 )->boundingRect() ), true ) ); } /* @@ -175,7 +192,7 @@ HB_FUNC( QT_QTEXTLAYOUT_CLEARLAYOUT ) */ HB_FUNC( QT_QTEXTLAYOUT_CREATELINE ) { - hb_retptrGC( hbqt_gcAllocate_QTextLine( new QTextLine( hbqt_par_QTextLayout( 1 )->createLine() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextLine( new QTextLine( hbqt_par_QTextLayout( 1 )->createLine() ), true ) ); } /* @@ -207,7 +224,7 @@ HB_FUNC( QT_QTEXTLAYOUT_ENDLAYOUT ) */ HB_FUNC( QT_QTEXTLAYOUT_FONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QTextLayout( 1 )->font() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QTextLayout( 1 )->font() ), true ) ); } /* @@ -223,7 +240,7 @@ HB_FUNC( QT_QTEXTLAYOUT_ISVALIDCURSORPOSITION ) */ HB_FUNC( QT_QTEXTLAYOUT_LINEAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextLine( new QTextLine( hbqt_par_QTextLayout( 1 )->lineAt( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextLine( new QTextLine( hbqt_par_QTextLayout( 1 )->lineAt( hb_parni( 2 ) ) ), true ) ); } /* @@ -239,7 +256,7 @@ HB_FUNC( QT_QTEXTLAYOUT_LINECOUNT ) */ HB_FUNC( QT_QTEXTLAYOUT_LINEFORTEXTPOSITION ) { - hb_retptrGC( hbqt_gcAllocate_QTextLine( new QTextLine( hbqt_par_QTextLayout( 1 )->lineForTextPosition( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextLine( new QTextLine( hbqt_par_QTextLayout( 1 )->lineForTextPosition( hb_parni( 2 ) ) ), true ) ); } /* @@ -271,7 +288,7 @@ HB_FUNC( QT_QTEXTLAYOUT_NEXTCURSORPOSITION ) */ HB_FUNC( QT_QTEXTLAYOUT_POSITION ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QTextLayout( 1 )->position() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QTextLayout( 1 )->position() ), true ) ); } /* @@ -359,7 +376,7 @@ HB_FUNC( QT_QTEXTLAYOUT_TEXT ) */ HB_FUNC( QT_QTEXTLAYOUT_TEXTOPTION ) { - hb_retptrGC( hbqt_gcAllocate_QTextOption( new QTextOption( hbqt_par_QTextLayout( 1 )->textOption() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextOption( new QTextOption( hbqt_par_QTextLayout( 1 )->textOption() ), true ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QTextLength.cpp b/harbour/contrib/hbqt/qtgui/QTextLength.cpp index 819d0f6204..e8c5e6ef67 100644 --- a/harbour/contrib/hbqt/qtgui/QTextLength.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextLength.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,32 +80,49 @@ * QTextLength ( Type type, qreal value ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextLength; + QT_G_FUNC( hbqt_gcRelease_QTextLength ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextLength p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextLength ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextLength * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextLength Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextLength * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextLength ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextLength Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextLength Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextLength Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextLength( void * pObj ) +void * hbqt_gcAllocate_QTextLength( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextLength; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextLength %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextLength ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -115,7 +132,7 @@ HB_FUNC( QT_QTEXTLENGTH ) pObj = ( QTextLength* ) new QTextLength() ; - hb_retptrGC( hbqt_gcAllocate_QTextLength( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextLength( pObj, true ) ); } /* * qreal rawValue () const diff --git a/harbour/contrib/hbqt/qtgui/QTextLine.cpp b/harbour/contrib/hbqt/qtgui/QTextLine.cpp index 3cf3112ea5..0551b280c2 100644 --- a/harbour/contrib/hbqt/qtgui/QTextLine.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextLine.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,32 +80,49 @@ * QTextLine () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextLine; + QT_G_FUNC( hbqt_gcRelease_QTextLine ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextLine p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextLine ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextLine * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextLine Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextLine * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextLine ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextLine Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextLine Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextLine Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextLine( void * pObj ) +void * hbqt_gcAllocate_QTextLine( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextLine; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextLine %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextLine ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -115,7 +132,7 @@ HB_FUNC( QT_QTEXTLINE ) pObj = ( QTextLine* ) new QTextLine() ; - hb_retptrGC( hbqt_gcAllocate_QTextLine( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextLine( pObj, true ) ); } /* * qreal ascent () const @@ -182,7 +199,7 @@ HB_FUNC( QT_QTEXTLINE_LINENUMBER ) */ HB_FUNC( QT_QTEXTLINE_NATURALTEXTRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QTextLine( 1 )->naturalTextRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QTextLine( 1 )->naturalTextRect() ), true ) ); } /* @@ -198,7 +215,7 @@ HB_FUNC( QT_QTEXTLINE_NATURALTEXTWIDTH ) */ HB_FUNC( QT_QTEXTLINE_POSITION ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QTextLine( 1 )->position() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QTextLine( 1 )->position() ), true ) ); } /* @@ -206,7 +223,7 @@ HB_FUNC( QT_QTEXTLINE_POSITION ) */ HB_FUNC( QT_QTEXTLINE_RECT ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QTextLine( 1 )->rect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QTextLine( 1 )->rect() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextList.cpp b/harbour/contrib/hbqt/qtgui/QTextList.cpp new file mode 100644 index 0000000000..59cbd5fe7c --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/QTextList.cpp @@ -0,0 +1,186 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009-2010 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ + +#include "hbapi.h" +#include "../hbqt.h" + +/*----------------------------------------------------------------------*/ +#if QT_VERSION >= 0x040500 +/*----------------------------------------------------------------------*/ + +#include + +#include + + +/* + * + * + */ + +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QTextList > pq; +} QGC_POINTER_QTextList; + +QT_G_FUNC( hbqt_gcRelease_QTextList ) +{ + HB_SYMBOL_UNUSED( Cargo ); +} + +void * hbqt_gcAllocate_QTextList( void * pObj, bool bNew ) +{ + QGC_POINTER_QTextList * p = ( QGC_POINTER_QTextList * ) hb_gcAllocate( sizeof( QGC_POINTER_QTextList ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QTextList; + + if( bNew ) + { + new( & p->pq ) QPointer< QTextList >( ( QTextList * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextList ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + +HB_FUNC( QT_QTEXTLIST ) +{ +} +/* + * void add ( const QTextBlock & block ) + */ +HB_FUNC( QT_QTEXTLIST_ADD ) +{ + hbqt_par_QTextList( 1 )->add( *hbqt_par_QTextBlock( 2 ) ); +} + +/* + * int count () const + */ +HB_FUNC( QT_QTEXTLIST_COUNT ) +{ + hb_retni( hbqt_par_QTextList( 1 )->count() ); +} + +/* + * QTextListFormat format () const + */ +HB_FUNC( QT_QTEXTLIST_FORMAT ) +{ + hb_retptrGC( hbqt_gcAllocate_QTextListFormat( new QTextListFormat( hbqt_par_QTextList( 1 )->format() ), true ) ); +} + +/* + * QTextBlock item ( int i ) const + */ +HB_FUNC( QT_QTEXTLIST_ITEM ) +{ + hb_retptrGC( hbqt_gcAllocate_QTextBlock( new QTextBlock( hbqt_par_QTextList( 1 )->item( hb_parni( 2 ) ) ), true ) ); +} + +/* + * int itemNumber ( const QTextBlock & block ) const + */ +HB_FUNC( QT_QTEXTLIST_ITEMNUMBER ) +{ + hb_retni( hbqt_par_QTextList( 1 )->itemNumber( *hbqt_par_QTextBlock( 2 ) ) ); +} + +/* + * QString itemText ( const QTextBlock & block ) const + */ +HB_FUNC( QT_QTEXTLIST_ITEMTEXT ) +{ + hb_retc( hbqt_par_QTextList( 1 )->itemText( *hbqt_par_QTextBlock( 2 ) ).toAscii().data() ); +} + +/* + * void remove ( const QTextBlock & block ) + */ +HB_FUNC( QT_QTEXTLIST_REMOVE ) +{ + hbqt_par_QTextList( 1 )->remove( *hbqt_par_QTextBlock( 2 ) ); +} + +/* + * void removeItem ( int i ) + */ +HB_FUNC( QT_QTEXTLIST_REMOVEITEM ) +{ + hbqt_par_QTextList( 1 )->removeItem( hb_parni( 2 ) ); +} + +/* + * void setFormat ( const QTextListFormat & format ) + */ +HB_FUNC( QT_QTEXTLIST_SETFORMAT ) +{ + hbqt_par_QTextList( 1 )->setFormat( *hbqt_par_QTextListFormat( 2 ) ); +} + + +/*----------------------------------------------------------------------*/ +#endif /* #if QT_VERSION >= 0x040500 */ +/*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QTextListFormat.cpp b/harbour/contrib/hbqt/qtgui/QTextListFormat.cpp index 7e7d8e4ea0..5bb88423f4 100644 --- a/harbour/contrib/hbqt/qtgui/QTextListFormat.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextListFormat.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,32 +79,49 @@ * */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextListFormat; + QT_G_FUNC( hbqt_gcRelease_QTextListFormat ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextListFormat p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextListFormat ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextListFormat * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextListFormat Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextListFormat * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextListFormat ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextListFormat Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextListFormat Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextListFormat Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextListFormat( void * pObj ) +void * hbqt_gcAllocate_QTextListFormat( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextListFormat; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextListFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextListFormat ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -114,7 +131,7 @@ HB_FUNC( QT_QTEXTLISTFORMAT ) pObj = new QTextListFormat() ; - hb_retptrGC( hbqt_gcAllocate_QTextListFormat( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextListFormat( pObj, true ) ); } /* * int indent () const diff --git a/harbour/contrib/hbqt/qtgui/QTextObject.cpp b/harbour/contrib/hbqt/qtgui/QTextObject.cpp index aceca2a613..09c90d000b 100644 --- a/harbour/contrib/hbqt/qtgui/QTextObject.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextObject.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -75,11 +75,35 @@ * */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QTextObject > pq; +} QGC_POINTER_QTextObject; + QT_G_FUNC( hbqt_gcRelease_QTextObject ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QTextObject( void * pObj, bool bNew ) +{ + QGC_POINTER_QTextObject * p = ( QGC_POINTER_QTextObject * ) hb_gcAllocate( sizeof( QGC_POINTER_QTextObject ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QTextObject; + + if( bNew ) + { + new( & p->pq ) QPointer< QTextObject >( ( QTextObject * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextObject ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QTEXTOBJECT ) { } @@ -88,7 +112,7 @@ HB_FUNC( QT_QTEXTOBJECT ) */ HB_FUNC( QT_QTEXTOBJECT_DOCUMENT ) { - hb_retptr( ( QTextDocument* ) hbqt_par_QTextObject( 1 )->document() ); + hb_retptrGC( hbqt_gcAllocate_QTextDocument( hbqt_par_QTextObject( 1 )->document(), false ) ); } /* @@ -96,7 +120,7 @@ HB_FUNC( QT_QTEXTOBJECT_DOCUMENT ) */ HB_FUNC( QT_QTEXTOBJECT_FORMAT ) { - hb_retptrGC( hbqt_gcAllocate_QTextFormat( new QTextFormat( hbqt_par_QTextObject( 1 )->format() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTextFormat( new QTextFormat( hbqt_par_QTextObject( 1 )->format() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTextOption.cpp b/harbour/contrib/hbqt/qtgui/QTextOption.cpp index 4cbe6535e9..53d49ce4a2 100644 --- a/harbour/contrib/hbqt/qtgui/QTextOption.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextOption.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -97,32 +97,49 @@ * ~QTextOption () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextOption; + QT_G_FUNC( hbqt_gcRelease_QTextOption ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextOption p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextOption ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextOption * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextOption Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextOption * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextOption ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextOption Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextOption Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextOption Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextOption( void * pObj ) +void * hbqt_gcAllocate_QTextOption( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextOption; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextOption %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextOption ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -132,7 +149,7 @@ HB_FUNC( QT_QTEXTOPTION ) pObj = new QTextOption() ; - hb_retptrGC( hbqt_gcAllocate_QTextOption( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextOption( pObj, true ) ); } /* * Qt::Alignment alignment () const diff --git a/harbour/contrib/hbqt/qtgui/QTextTableFormat.cpp b/harbour/contrib/hbqt/qtgui/QTextTableFormat.cpp index 44fad778ba..2913850733 100644 --- a/harbour/contrib/hbqt/qtgui/QTextTableFormat.cpp +++ b/harbour/contrib/hbqt/qtgui/QTextTableFormat.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -84,32 +84,49 @@ /* QTextTableFormat () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTextTableFormat; + QT_G_FUNC( hbqt_gcRelease_QTextTableFormat ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextTableFormat p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTextTableFormat ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTextTableFormat * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTextTableFormat Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTextTableFormat * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTextTableFormat ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTextTableFormat Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTextTableFormat Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTextTableFormat Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTextTableFormat( void * pObj ) +void * hbqt_gcAllocate_QTextTableFormat( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTextTableFormat; - HB_TRACE( HB_TR_DEBUG, ( " new_QTextTableFormat %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTextTableFormat ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -119,7 +136,7 @@ HB_FUNC( QT_QTEXTTABLEFORMAT ) pObj = new QTextTableFormat() ; - hb_retptrGC( hbqt_gcAllocate_QTextTableFormat( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTextTableFormat( pObj, true ) ); } /* * Qt::Alignment alignment () const diff --git a/harbour/contrib/hbqt/qtgui/QTimeEdit.cpp b/harbour/contrib/hbqt/qtgui/QTimeEdit.cpp index 4ee28a103a..6c553856ee 100644 --- a/harbour/contrib/hbqt/qtgui/QTimeEdit.cpp +++ b/harbour/contrib/hbqt/qtgui/QTimeEdit.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QTimeEdit > pq; } QGC_POINTER_QTimeEdit; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QTimeEdit ) { QGC_POINTER_QTimeEdit * p = ( QGC_POINTER_QTimeEdit * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTimeEdit p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTimeEdit ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QTimeEdit * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QTimeEdit * ) p->ph )->~QTimeEdit(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QTimeEdit * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTimeEdit ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QTimeEdit ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTimeEdit Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QTimeEdit Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTimeEdit Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTimeEdit Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTimeEdit Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTimeEdit( void * pObj ) +void * hbqt_gcAllocate_QTimeEdit( void * pObj, bool bNew ) { QGC_POINTER_QTimeEdit * p = ( QGC_POINTER_QTimeEdit * ) hb_gcAllocate( sizeof( QGC_POINTER_QTimeEdit ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTimeEdit; - new( & p->pq ) QPointer< QTimeEdit >( ( QTimeEdit * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QTimeEdit %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QTimeEdit >( ( QTimeEdit * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QTimeEdit ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -141,7 +141,7 @@ HB_FUNC( QT_QTIMEEDIT ) pObj = (QTimeEdit *) new QTimeEdit( QTime( hbqt_par_QString( 1 ) ), hbqt_par_QWidget( 2 ) ) ; #endif - hb_retptrGC( hbqt_gcAllocate_QTimeEdit( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTimeEdit( pObj, true ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QToolBar.cpp b/harbour/contrib/hbqt/qtgui/QToolBar.cpp index 1502b1b0c3..eb403959b3 100644 --- a/harbour/contrib/hbqt/qtgui/QToolBar.cpp +++ b/harbour/contrib/hbqt/qtgui/QToolBar.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,6 +80,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QToolBar > pq; } QGC_POINTER_QToolBar; @@ -88,48 +89,47 @@ QT_G_FUNC( hbqt_gcRelease_QToolBar ) { QGC_POINTER_QToolBar * p = ( QGC_POINTER_QToolBar * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QToolBar p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QToolBar ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QToolBar * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QToolBar * ) p->ph )->~QToolBar(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QToolBar * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QToolBar ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QToolBar ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QToolBar Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QToolBar Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QToolBar Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QToolBar Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QToolBar Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QToolBar( void * pObj ) +void * hbqt_gcAllocate_QToolBar( void * pObj, bool bNew ) { QGC_POINTER_QToolBar * p = ( QGC_POINTER_QToolBar * ) hb_gcAllocate( sizeof( QGC_POINTER_QToolBar ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QToolBar; - new( & p->pq ) QPointer< QToolBar >( ( QToolBar * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QToolBar %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QToolBar >( ( QToolBar * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QToolBar ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -142,14 +142,14 @@ HB_FUNC( QT_QTOOLBAR ) else pObj = ( QToolBar* ) new QToolBar( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QToolBar( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QToolBar( pObj, true ) ); } /* * QAction * actionAt ( const QPoint & p ) const */ HB_FUNC( QT_QTOOLBAR_ACTIONAT ) { - hb_retptr( ( QAction* ) hbqt_par_QToolBar( 1 )->actionAt( *hbqt_par_QPoint( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QToolBar( 1 )->actionAt( *hbqt_par_QPoint( 2 ) ), false ) ); } /* @@ -157,7 +157,7 @@ HB_FUNC( QT_QTOOLBAR_ACTIONAT ) */ HB_FUNC( QT_QTOOLBAR_ACTIONAT_1 ) { - hb_retptr( ( QAction* ) hbqt_par_QToolBar( 1 )->actionAt( hb_parni( 2 ), hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QToolBar( 1 )->actionAt( hb_parni( 2 ), hb_parni( 3 ) ), false ) ); } /* @@ -173,7 +173,7 @@ HB_FUNC( QT_QTOOLBAR_ADDACTION ) */ HB_FUNC( QT_QTOOLBAR_ADDACTION_1 ) { - hb_retptr( ( QAction* ) hbqt_par_QToolBar( 1 )->addAction( QToolBar::tr( hb_parc( 2 ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QToolBar( 1 )->addAction( QToolBar::tr( hb_parc( 2 ) ) ), false ) ); } /* @@ -181,7 +181,7 @@ HB_FUNC( QT_QTOOLBAR_ADDACTION_1 ) */ HB_FUNC( QT_QTOOLBAR_ADDACTION_2 ) { - hb_retptr( ( QAction* ) hbqt_par_QToolBar( 1 )->addAction( QIcon( hbqt_par_QString( 2 ) ), QToolBar::tr( hb_parc( 3 ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QToolBar( 1 )->addAction( QIcon( hbqt_par_QString( 2 ) ), QToolBar::tr( hb_parc( 3 ) ) ), false ) ); } /* @@ -189,7 +189,7 @@ HB_FUNC( QT_QTOOLBAR_ADDACTION_2 ) */ HB_FUNC( QT_QTOOLBAR_ADDACTION_3 ) { - hb_retptr( ( QAction* ) hbqt_par_QToolBar( 1 )->addAction( QToolBar::tr( hb_parc( 2 ) ), hbqt_par_QObject( 3 ), hbqt_par_char( 4 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QToolBar( 1 )->addAction( QToolBar::tr( hb_parc( 2 ) ), hbqt_par_QObject( 3 ), hbqt_par_char( 4 ) ), false ) ); } /* @@ -197,7 +197,7 @@ HB_FUNC( QT_QTOOLBAR_ADDACTION_3 ) */ HB_FUNC( QT_QTOOLBAR_ADDACTION_4 ) { - hb_retptr( ( QAction* ) hbqt_par_QToolBar( 1 )->addAction( QIcon( hbqt_par_QString( 2 ) ), QToolBar::tr( hb_parc( 3 ) ), hbqt_par_QObject( 4 ), hbqt_par_char( 5 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QToolBar( 1 )->addAction( QIcon( hbqt_par_QString( 2 ) ), QToolBar::tr( hb_parc( 3 ) ), hbqt_par_QObject( 4 ), hbqt_par_char( 5 ) ), false ) ); } /* @@ -205,7 +205,7 @@ HB_FUNC( QT_QTOOLBAR_ADDACTION_4 ) */ HB_FUNC( QT_QTOOLBAR_ADDSEPARATOR ) { - hb_retptr( ( QAction* ) hbqt_par_QToolBar( 1 )->addSeparator() ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QToolBar( 1 )->addSeparator(), false ) ); } /* @@ -213,7 +213,7 @@ HB_FUNC( QT_QTOOLBAR_ADDSEPARATOR ) */ HB_FUNC( QT_QTOOLBAR_ADDWIDGET ) { - hb_retptr( ( QAction* ) hbqt_par_QToolBar( 1 )->addWidget( hbqt_par_QWidget( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QToolBar( 1 )->addWidget( hbqt_par_QWidget( 2 ) ), false ) ); } /* @@ -237,7 +237,7 @@ HB_FUNC( QT_QTOOLBAR_CLEAR ) */ HB_FUNC( QT_QTOOLBAR_ICONSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QToolBar( 1 )->iconSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QToolBar( 1 )->iconSize() ), true ) ); } /* @@ -245,7 +245,7 @@ HB_FUNC( QT_QTOOLBAR_ICONSIZE ) */ HB_FUNC( QT_QTOOLBAR_INSERTSEPARATOR ) { - hb_retptr( ( QAction* ) hbqt_par_QToolBar( 1 )->insertSeparator( hbqt_par_QAction( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QToolBar( 1 )->insertSeparator( hbqt_par_QAction( 2 ) ), false ) ); } /* @@ -253,7 +253,7 @@ HB_FUNC( QT_QTOOLBAR_INSERTSEPARATOR ) */ HB_FUNC( QT_QTOOLBAR_INSERTWIDGET ) { - hb_retptr( ( QAction* ) hbqt_par_QToolBar( 1 )->insertWidget( hbqt_par_QAction( 2 ), hbqt_par_QWidget( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QToolBar( 1 )->insertWidget( hbqt_par_QAction( 2 ), hbqt_par_QWidget( 3 ) ), false ) ); } /* @@ -333,7 +333,7 @@ HB_FUNC( QT_QTOOLBAR_SETORIENTATION ) */ HB_FUNC( QT_QTOOLBAR_TOGGLEVIEWACTION ) { - hb_retptr( ( QAction* ) hbqt_par_QToolBar( 1 )->toggleViewAction() ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QToolBar( 1 )->toggleViewAction(), false ) ); } /* @@ -349,7 +349,7 @@ HB_FUNC( QT_QTOOLBAR_TOOLBUTTONSTYLE ) */ HB_FUNC( QT_QTOOLBAR_WIDGETFORACTION ) { - hb_retptr( ( QWidget* ) hbqt_par_QToolBar( 1 )->widgetForAction( hbqt_par_QAction( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QToolBar( 1 )->widgetForAction( hbqt_par_QAction( 2 ) ), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QToolBox.cpp b/harbour/contrib/hbqt/qtgui/QToolBox.cpp index 6ee8df7e1c..c98af2d993 100644 --- a/harbour/contrib/hbqt/qtgui/QToolBox.cpp +++ b/harbour/contrib/hbqt/qtgui/QToolBox.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QToolBox > pq; } QGC_POINTER_QToolBox; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QToolBox ) { QGC_POINTER_QToolBox * p = ( QGC_POINTER_QToolBox * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QToolBox p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QToolBox ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QToolBox * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QToolBox * ) p->ph )->~QToolBox(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QToolBox * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QToolBox ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QToolBox ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QToolBox Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QToolBox Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QToolBox Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QToolBox Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QToolBox Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QToolBox( void * pObj ) +void * hbqt_gcAllocate_QToolBox( void * pObj, bool bNew ) { QGC_POINTER_QToolBox * p = ( QGC_POINTER_QToolBox * ) hb_gcAllocate( sizeof( QGC_POINTER_QToolBox ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QToolBox; - new( & p->pq ) QPointer< QToolBox >( ( QToolBox * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QToolBox %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QToolBox >( ( QToolBox * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QToolBox ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -138,7 +138,7 @@ HB_FUNC( QT_QTOOLBOX ) pObj = ( QToolBox* ) new QToolBox( hbqt_par_QWidget( 1 ), ( Qt::WindowFlags ) hb_parni( 2 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QToolBox( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QToolBox( pObj, true ) ); } /* * int addItem ( QWidget * widget, const QIcon & iconSet, const QString & text ) @@ -177,7 +177,7 @@ HB_FUNC( QT_QTOOLBOX_CURRENTINDEX ) */ HB_FUNC( QT_QTOOLBOX_CURRENTWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QToolBox( 1 )->currentWidget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QToolBox( 1 )->currentWidget(), false ) ); } /* @@ -217,7 +217,7 @@ HB_FUNC( QT_QTOOLBOX_ISITEMENABLED ) */ HB_FUNC( QT_QTOOLBOX_ITEMICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QToolBox( 1 )->itemIcon( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QToolBox( 1 )->itemIcon( hb_parni( 2 ) ) ), true ) ); } /* @@ -281,7 +281,7 @@ HB_FUNC( QT_QTOOLBOX_SETITEMTOOLTIP ) */ HB_FUNC( QT_QTOOLBOX_WIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QToolBox( 1 )->widget( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QToolBox( 1 )->widget( hb_parni( 2 ) ), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QToolButton.cpp b/harbour/contrib/hbqt/qtgui/QToolButton.cpp index bc347dc516..21476889f3 100644 --- a/harbour/contrib/hbqt/qtgui/QToolButton.cpp +++ b/harbour/contrib/hbqt/qtgui/QToolButton.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -83,6 +83,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QToolButton > pq; } QGC_POINTER_QToolButton; @@ -91,48 +92,47 @@ QT_G_FUNC( hbqt_gcRelease_QToolButton ) { QGC_POINTER_QToolButton * p = ( QGC_POINTER_QToolButton * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QToolButton p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QToolButton ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QToolButton * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QToolButton * ) p->ph )->~QToolButton(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QToolButton * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QToolButton ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QToolButton ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QToolButton Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QToolButton Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QToolButton Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QToolButton Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QToolButton Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QToolButton( void * pObj ) +void * hbqt_gcAllocate_QToolButton( void * pObj, bool bNew ) { QGC_POINTER_QToolButton * p = ( QGC_POINTER_QToolButton * ) hb_gcAllocate( sizeof( QGC_POINTER_QToolButton ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QToolButton; - new( & p->pq ) QPointer< QToolButton >( ( QToolButton * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QToolButton %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QToolButton >( ( QToolButton * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QToolButton ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -142,7 +142,7 @@ HB_FUNC( QT_QTOOLBUTTON ) pObj = ( QToolButton* ) new QToolButton( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QToolButton( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QToolButton( pObj, true ) ); } /* * Qt::ArrowType arrowType () const @@ -165,7 +165,7 @@ HB_FUNC( QT_QTOOLBUTTON_AUTORAISE ) */ HB_FUNC( QT_QTOOLBUTTON_DEFAULTACTION ) { - hb_retptr( ( QAction* ) hbqt_par_QToolButton( 1 )->defaultAction() ); + hb_retptrGC( hbqt_gcAllocate_QAction( hbqt_par_QToolButton( 1 )->defaultAction(), false ) ); } /* @@ -173,7 +173,7 @@ HB_FUNC( QT_QTOOLBUTTON_DEFAULTACTION ) */ HB_FUNC( QT_QTOOLBUTTON_MENU ) { - hb_retptr( ( QMenu* ) hbqt_par_QToolButton( 1 )->menu() ); + hb_retptrGC( hbqt_gcAllocate_QMenu( hbqt_par_QToolButton( 1 )->menu(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTransform.cpp b/harbour/contrib/hbqt/qtgui/QTransform.cpp index 68a6a5fd8e..c565baff2e 100644 --- a/harbour/contrib/hbqt/qtgui/QTransform.cpp +++ b/harbour/contrib/hbqt/qtgui/QTransform.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -81,32 +81,49 @@ * QTransform ( const QMatrix & matrix ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTransform; + QT_G_FUNC( hbqt_gcRelease_QTransform ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTransform p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTransform ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTransform * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTransform Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTransform * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTransform ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTransform Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTransform Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTransform Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTransform( void * pObj ) +void * hbqt_gcAllocate_QTransform( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTransform; - HB_TRACE( HB_TR_DEBUG, ( " new_QTransform %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTransform ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -116,7 +133,7 @@ HB_FUNC( QT_QTRANSFORM ) pObj = new QTransform() ; - hb_retptrGC( hbqt_gcAllocate_QTransform( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTransform( pObj, true ) ); } /* * qreal m11 () const @@ -195,7 +212,7 @@ HB_FUNC( QT_QTRANSFORM_M33 ) */ HB_FUNC( QT_QTRANSFORM_ADJOINT ) { - hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->adjoint() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->adjoint() ), true ) ); } /* @@ -237,7 +254,7 @@ HB_FUNC( QT_QTRANSFORM_INVERTED ) { bool iInvertible = 0; - hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->inverted( &iInvertible ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->inverted( &iInvertible ) ), true ) ); hb_stornl( iInvertible, 2 ); } @@ -309,7 +326,7 @@ HB_FUNC( QT_QTRANSFORM_MAP ) */ HB_FUNC( QT_QTRANSFORM_MAP_1 ) { - hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPointF( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPointF( new QPointF( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPointF( 2 ) ) ), true ) ); } /* @@ -317,7 +334,7 @@ HB_FUNC( QT_QTRANSFORM_MAP_1 ) */ HB_FUNC( QT_QTRANSFORM_MAP_2 ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPoint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPoint( 2 ) ) ), true ) ); } /* @@ -325,7 +342,7 @@ HB_FUNC( QT_QTRANSFORM_MAP_2 ) */ HB_FUNC( QT_QTRANSFORM_MAP_3 ) { - hb_retptrGC( hbqt_gcAllocate_QLine( new QLine( hbqt_par_QTransform( 1 )->map( *hbqt_par_QLine( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLine( new QLine( hbqt_par_QTransform( 1 )->map( *hbqt_par_QLine( 2 ) ) ), true ) ); } /* @@ -333,7 +350,7 @@ HB_FUNC( QT_QTRANSFORM_MAP_3 ) */ HB_FUNC( QT_QTRANSFORM_MAP_4 ) { - hb_retptrGC( hbqt_gcAllocate_QLineF( new QLineF( hbqt_par_QTransform( 1 )->map( *hbqt_par_QLineF( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLineF( new QLineF( hbqt_par_QTransform( 1 )->map( *hbqt_par_QLineF( 2 ) ) ), true ) ); } /* @@ -341,7 +358,7 @@ HB_FUNC( QT_QTRANSFORM_MAP_4 ) */ HB_FUNC( QT_QTRANSFORM_MAP_5 ) { - hb_retptrGC( hbqt_gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPolygonF( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPolygonF( new QPolygonF( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPolygonF( 2 ) ) ), true ) ); } /* @@ -349,7 +366,7 @@ HB_FUNC( QT_QTRANSFORM_MAP_5 ) */ HB_FUNC( QT_QTRANSFORM_MAP_6 ) { - hb_retptrGC( hbqt_gcAllocate_QPolygon( new QPolygon( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPolygon( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPolygon( new QPolygon( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPolygon( 2 ) ) ), true ) ); } /* @@ -357,7 +374,7 @@ HB_FUNC( QT_QTRANSFORM_MAP_6 ) */ HB_FUNC( QT_QTRANSFORM_MAP_7 ) { - hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QTransform( 1 )->map( *hbqt_par_QRegion( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QTransform( 1 )->map( *hbqt_par_QRegion( 2 ) ) ), true ) ); } /* @@ -365,7 +382,7 @@ HB_FUNC( QT_QTRANSFORM_MAP_7 ) */ HB_FUNC( QT_QTRANSFORM_MAP_8 ) { - hb_retptrGC( hbqt_gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPainterPath( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPainterPath( new QPainterPath( hbqt_par_QTransform( 1 )->map( *hbqt_par_QPainterPath( 2 ) ) ), true ) ); } /* @@ -387,7 +404,7 @@ HB_FUNC( QT_QTRANSFORM_MAP_9 ) */ HB_FUNC( QT_QTRANSFORM_MAPRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QTransform( 1 )->mapRect( *hbqt_par_QRectF( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRectF( new QRectF( hbqt_par_QTransform( 1 )->mapRect( *hbqt_par_QRectF( 2 ) ) ), true ) ); } /* @@ -395,7 +412,7 @@ HB_FUNC( QT_QTRANSFORM_MAPRECT ) */ HB_FUNC( QT_QTRANSFORM_MAPRECT_1 ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QTransform( 1 )->mapRect( *hbqt_par_QRect( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QTransform( 1 )->mapRect( *hbqt_par_QRect( 2 ) ) ), true ) ); } /* @@ -403,7 +420,7 @@ HB_FUNC( QT_QTRANSFORM_MAPRECT_1 ) */ HB_FUNC( QT_QTRANSFORM_MAPTOPOLYGON ) { - hb_retptrGC( hbqt_gcAllocate_QPolygon( new QPolygon( hbqt_par_QTransform( 1 )->mapToPolygon( *hbqt_par_QRect( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPolygon( new QPolygon( hbqt_par_QTransform( 1 )->mapToPolygon( *hbqt_par_QRect( 2 ) ) ), true ) ); } /* @@ -419,7 +436,7 @@ HB_FUNC( QT_QTRANSFORM_RESET ) */ HB_FUNC( QT_QTRANSFORM_ROTATE ) { - hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->rotate( hb_parnd( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::Axis ) hb_parni( 3 ) : ( Qt::Axis ) Qt::ZAxis ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->rotate( hb_parnd( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::Axis ) hb_parni( 3 ) : ( Qt::Axis ) Qt::ZAxis ) ) ), true ) ); } /* @@ -427,7 +444,7 @@ HB_FUNC( QT_QTRANSFORM_ROTATE ) */ HB_FUNC( QT_QTRANSFORM_ROTATERADIANS ) { - hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->rotateRadians( hb_parnd( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::Axis ) hb_parni( 3 ) : ( Qt::Axis ) Qt::ZAxis ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->rotateRadians( hb_parnd( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::Axis ) hb_parni( 3 ) : ( Qt::Axis ) Qt::ZAxis ) ) ), true ) ); } /* @@ -435,7 +452,7 @@ HB_FUNC( QT_QTRANSFORM_ROTATERADIANS ) */ HB_FUNC( QT_QTRANSFORM_SCALE ) { - hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->scale( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->scale( hb_parnd( 2 ), hb_parnd( 3 ) ) ), true ) ); } /* @@ -451,7 +468,7 @@ HB_FUNC( QT_QTRANSFORM_SETMATRIX ) */ HB_FUNC( QT_QTRANSFORM_SHEAR ) { - hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->shear( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->shear( hb_parnd( 2 ), hb_parnd( 3 ) ) ), true ) ); } /* @@ -459,7 +476,7 @@ HB_FUNC( QT_QTRANSFORM_SHEAR ) */ HB_FUNC( QT_QTRANSFORM_TOAFFINE ) { - hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QTransform( 1 )->toAffine() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QMatrix( new QMatrix( hbqt_par_QTransform( 1 )->toAffine() ), true ) ); } /* @@ -467,7 +484,7 @@ HB_FUNC( QT_QTRANSFORM_TOAFFINE ) */ HB_FUNC( QT_QTRANSFORM_TRANSLATE ) { - hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->translate( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->translate( hb_parnd( 2 ), hb_parnd( 3 ) ) ), true ) ); } /* @@ -475,7 +492,7 @@ HB_FUNC( QT_QTRANSFORM_TRANSLATE ) */ HB_FUNC( QT_QTRANSFORM_TRANSPOSED ) { - hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->transposed() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->transposed() ), true ) ); } /* @@ -491,7 +508,7 @@ HB_FUNC( QT_QTRANSFORM_TYPE ) */ HB_FUNC( QT_QTRANSFORM_FROMSCALE ) { - hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->fromScale( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->fromScale( hb_parnd( 2 ), hb_parnd( 3 ) ) ), true ) ); } /* @@ -499,7 +516,7 @@ HB_FUNC( QT_QTRANSFORM_FROMSCALE ) */ HB_FUNC( QT_QTRANSFORM_FROMTRANSLATE ) { - hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->fromTranslate( hb_parnd( 2 ), hb_parnd( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTransform( new QTransform( hbqt_par_QTransform( 1 )->fromTranslate( hb_parnd( 2 ), hb_parnd( 3 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTreeView.cpp b/harbour/contrib/hbqt/qtgui/QTreeView.cpp index a7c1e26ff3..1ef121a871 100644 --- a/harbour/contrib/hbqt/qtgui/QTreeView.cpp +++ b/harbour/contrib/hbqt/qtgui/QTreeView.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -91,6 +91,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QTreeView > pq; } QGC_POINTER_QTreeView; @@ -99,48 +100,47 @@ QT_G_FUNC( hbqt_gcRelease_QTreeView ) { QGC_POINTER_QTreeView * p = ( QGC_POINTER_QTreeView * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTreeView p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTreeView ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QTreeView * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QTreeView * ) p->ph )->~QTreeView(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QTreeView * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTreeView ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QTreeView ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTreeView Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QTreeView Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTreeView Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTreeView Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTreeView Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTreeView( void * pObj ) +void * hbqt_gcAllocate_QTreeView( void * pObj, bool bNew ) { QGC_POINTER_QTreeView * p = ( QGC_POINTER_QTreeView * ) hb_gcAllocate( sizeof( QGC_POINTER_QTreeView ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTreeView; - new( & p->pq ) QPointer< QTreeView >( ( QTreeView * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QTreeView %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QTreeView >( ( QTreeView * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QTreeView ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -150,7 +150,7 @@ HB_FUNC( QT_QTREEVIEW ) pObj = ( QTreeView* ) new QTreeView( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QTreeView( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTreeView( pObj, true ) ); } /* * bool allColumnsShowFocus () const @@ -205,7 +205,7 @@ HB_FUNC( QT_QTREEVIEW_EXPANDSONDOUBLECLICK ) */ HB_FUNC( QT_QTREEVIEW_HEADER ) { - hb_retptr( ( QHeaderView* ) hbqt_par_QTreeView( 1 )->header() ); + hb_retptrGC( hbqt_gcAllocate_QHeaderView( hbqt_par_QTreeView( 1 )->header(), false ) ); } /* @@ -221,7 +221,7 @@ HB_FUNC( QT_QTREEVIEW_INDENTATION ) */ HB_FUNC( QT_QTREEVIEW_INDEXABOVE ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QTreeView( 1 )->indexAbove( *hbqt_par_QModelIndex( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QTreeView( 1 )->indexAbove( *hbqt_par_QModelIndex( 2 ) ) ), true ) ); } /* @@ -229,7 +229,7 @@ HB_FUNC( QT_QTREEVIEW_INDEXABOVE ) */ HB_FUNC( QT_QTREEVIEW_INDEXBELOW ) { - hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QTreeView( 1 )->indexBelow( *hbqt_par_QModelIndex( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QModelIndex( new QModelIndex( hbqt_par_QTreeView( 1 )->indexBelow( *hbqt_par_QModelIndex( 2 ) ) ), true ) ); } /* @@ -469,7 +469,7 @@ HB_FUNC( QT_QTREEVIEW_UNIFORMROWHEIGHTS ) */ HB_FUNC( QT_QTREEVIEW_VISUALRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QTreeView( 1 )->visualRect( *hbqt_par_QModelIndex( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QTreeView( 1 )->visualRect( *hbqt_par_QModelIndex( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTreeWidget.cpp b/harbour/contrib/hbqt/qtgui/QTreeWidget.cpp index 03c663131b..b57a77ab4a 100644 --- a/harbour/contrib/hbqt/qtgui/QTreeWidget.cpp +++ b/harbour/contrib/hbqt/qtgui/QTreeWidget.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -91,6 +91,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QTreeWidget > pq; } QGC_POINTER_QTreeWidget; @@ -99,48 +100,47 @@ QT_G_FUNC( hbqt_gcRelease_QTreeWidget ) { QGC_POINTER_QTreeWidget * p = ( QGC_POINTER_QTreeWidget * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTreeWidget p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTreeWidget ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QTreeWidget * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QTreeWidget * ) p->ph )->~QTreeWidget(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QTreeWidget * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTreeWidget ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QTreeWidget ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTreeWidget Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QTreeWidget Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTreeWidget Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTreeWidget Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTreeWidget Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTreeWidget( void * pObj ) +void * hbqt_gcAllocate_QTreeWidget( void * pObj, bool bNew ) { QGC_POINTER_QTreeWidget * p = ( QGC_POINTER_QTreeWidget * ) hb_gcAllocate( sizeof( QGC_POINTER_QTreeWidget ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTreeWidget; - new( & p->pq ) QPointer< QTreeWidget >( ( QTreeWidget * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QTreeWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QTreeWidget >( ( QTreeWidget * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QTreeWidget ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -150,7 +150,7 @@ HB_FUNC( QT_QTREEWIDGET ) pObj = ( QTreeWidget* ) new QTreeWidget( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QTreeWidget( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTreeWidget( pObj, true ) ); } /* * void addTopLevelItem ( QTreeWidgetItem * item ) @@ -189,7 +189,7 @@ HB_FUNC( QT_QTREEWIDGET_CURRENTCOLUMN ) */ HB_FUNC( QT_QTREEWIDGET_CURRENTITEM ) { - hb_retptr( ( QTreeWidgetItem* ) hbqt_par_QTreeWidget( 1 )->currentItem() ); + hb_retptrGC( hbqt_gcAllocate_QTreeWidgetItem( hbqt_par_QTreeWidget( 1 )->currentItem(), false ) ); } /* @@ -205,7 +205,7 @@ HB_FUNC( QT_QTREEWIDGET_EDITITEM ) */ HB_FUNC( QT_QTREEWIDGET_HEADERITEM ) { - hb_retptr( ( QTreeWidgetItem* ) hbqt_par_QTreeWidget( 1 )->headerItem() ); + hb_retptrGC( hbqt_gcAllocate_QTreeWidgetItem( hbqt_par_QTreeWidget( 1 )->headerItem(), false ) ); } /* @@ -229,7 +229,7 @@ HB_FUNC( QT_QTREEWIDGET_INSERTTOPLEVELITEM ) */ HB_FUNC( QT_QTREEWIDGET_INVISIBLEROOTITEM ) { - hb_retptr( ( QTreeWidgetItem* ) hbqt_par_QTreeWidget( 1 )->invisibleRootItem() ); + hb_retptrGC( hbqt_gcAllocate_QTreeWidgetItem( hbqt_par_QTreeWidget( 1 )->invisibleRootItem(), false ) ); } /* @@ -245,7 +245,7 @@ HB_FUNC( QT_QTREEWIDGET_ISFIRSTITEMCOLUMNSPANNED ) */ HB_FUNC( QT_QTREEWIDGET_ITEMABOVE ) { - hb_retptr( ( QTreeWidgetItem* ) hbqt_par_QTreeWidget( 1 )->itemAbove( hbqt_par_QTreeWidgetItem( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTreeWidgetItem( hbqt_par_QTreeWidget( 1 )->itemAbove( hbqt_par_QTreeWidgetItem( 2 ) ), false ) ); } /* @@ -253,7 +253,7 @@ HB_FUNC( QT_QTREEWIDGET_ITEMABOVE ) */ HB_FUNC( QT_QTREEWIDGET_ITEMAT ) { - hb_retptr( ( QTreeWidgetItem* ) hbqt_par_QTreeWidget( 1 )->itemAt( *hbqt_par_QPoint( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTreeWidgetItem( hbqt_par_QTreeWidget( 1 )->itemAt( *hbqt_par_QPoint( 2 ) ), false ) ); } /* @@ -261,7 +261,7 @@ HB_FUNC( QT_QTREEWIDGET_ITEMAT ) */ HB_FUNC( QT_QTREEWIDGET_ITEMAT_1 ) { - hb_retptr( ( QTreeWidgetItem* ) hbqt_par_QTreeWidget( 1 )->itemAt( hb_parni( 2 ), hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTreeWidgetItem( hbqt_par_QTreeWidget( 1 )->itemAt( hb_parni( 2 ), hb_parni( 3 ) ), false ) ); } /* @@ -269,7 +269,7 @@ HB_FUNC( QT_QTREEWIDGET_ITEMAT_1 ) */ HB_FUNC( QT_QTREEWIDGET_ITEMBELOW ) { - hb_retptr( ( QTreeWidgetItem* ) hbqt_par_QTreeWidget( 1 )->itemBelow( hbqt_par_QTreeWidgetItem( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTreeWidgetItem( hbqt_par_QTreeWidget( 1 )->itemBelow( hbqt_par_QTreeWidgetItem( 2 ) ), false ) ); } /* @@ -277,7 +277,7 @@ HB_FUNC( QT_QTREEWIDGET_ITEMBELOW ) */ HB_FUNC( QT_QTREEWIDGET_ITEMWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QTreeWidget( 1 )->itemWidget( hbqt_par_QTreeWidgetItem( 2 ), hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QTreeWidget( 1 )->itemWidget( hbqt_par_QTreeWidgetItem( 2 ), hb_parni( 3 ) ), false ) ); } /* @@ -389,7 +389,7 @@ HB_FUNC( QT_QTREEWIDGET_SORTITEMS ) */ HB_FUNC( QT_QTREEWIDGET_TAKETOPLEVELITEM ) { - hb_retptr( ( QTreeWidgetItem* ) hbqt_par_QTreeWidget( 1 )->takeTopLevelItem( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTreeWidgetItem( hbqt_par_QTreeWidget( 1 )->takeTopLevelItem( hb_parni( 2 ) ), false ) ); } /* @@ -397,7 +397,7 @@ HB_FUNC( QT_QTREEWIDGET_TAKETOPLEVELITEM ) */ HB_FUNC( QT_QTREEWIDGET_TOPLEVELITEM ) { - hb_retptr( ( QTreeWidgetItem* ) hbqt_par_QTreeWidget( 1 )->topLevelItem( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTreeWidgetItem( hbqt_par_QTreeWidget( 1 )->topLevelItem( hb_parni( 2 ) ), false ) ); } /* @@ -413,7 +413,7 @@ HB_FUNC( QT_QTREEWIDGET_TOPLEVELITEMCOUNT ) */ HB_FUNC( QT_QTREEWIDGET_VISUALITEMRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QTreeWidget( 1 )->visualItemRect( hbqt_par_QTreeWidgetItem( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QTreeWidget( 1 )->visualItemRect( hbqt_par_QTreeWidgetItem( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QTreeWidgetItem.cpp b/harbour/contrib/hbqt/qtgui/QTreeWidgetItem.cpp index 7ce7be3145..bf5ee747a3 100644 --- a/harbour/contrib/hbqt/qtgui/QTreeWidgetItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QTreeWidgetItem.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -100,32 +100,49 @@ * virtual ~QTreeWidgetItem () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QTreeWidgetItem; + QT_G_FUNC( hbqt_gcRelease_QTreeWidgetItem ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTreeWidgetItem p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QTreeWidgetItem ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QTreeWidgetItem * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QTreeWidgetItem Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QTreeWidgetItem * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QTreeWidgetItem ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QTreeWidgetItem Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QTreeWidgetItem Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QTreeWidgetItem Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QTreeWidgetItem( void * pObj ) +void * hbqt_gcAllocate_QTreeWidgetItem( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QTreeWidgetItem; - HB_TRACE( HB_TR_DEBUG, ( " new_QTreeWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QTreeWidgetItem ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -142,7 +159,7 @@ HB_FUNC( QT_QTREEWIDGETITEM ) pObj = ( QTreeWidgetItem* ) new QTreeWidgetItem( hbqt_par_QTreeWidget( 1 ), hb_parni( 2 ) ) ; } - hb_retptrGC( hbqt_gcAllocate_QTreeWidgetItem( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QTreeWidgetItem( pObj, true ) ); } /* * void addChild ( QTreeWidgetItem * child ) @@ -157,7 +174,7 @@ HB_FUNC( QT_QTREEWIDGETITEM_ADDCHILD ) */ HB_FUNC( QT_QTREEWIDGETITEM_BACKGROUND ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QTreeWidgetItem( 1 )->background( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QTreeWidgetItem( 1 )->background( hb_parni( 2 ) ) ), true ) ); } /* @@ -173,7 +190,7 @@ HB_FUNC( QT_QTREEWIDGETITEM_CHECKSTATE ) */ HB_FUNC( QT_QTREEWIDGETITEM_CHILD ) { - hb_retptr( ( QTreeWidgetItem* ) hbqt_par_QTreeWidgetItem( 1 )->child( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTreeWidgetItem( hbqt_par_QTreeWidgetItem( 1 )->child( hb_parni( 2 ) ), false ) ); } /* @@ -197,7 +214,7 @@ HB_FUNC( QT_QTREEWIDGETITEM_CHILDINDICATORPOLICY ) */ HB_FUNC( QT_QTREEWIDGETITEM_CLONE ) { - hb_retptr( ( QTreeWidgetItem* ) hbqt_par_QTreeWidgetItem( 1 )->clone() ); + hb_retptrGC( hbqt_gcAllocate_QTreeWidgetItem( hbqt_par_QTreeWidgetItem( 1 )->clone(), false ) ); } /* @@ -213,7 +230,7 @@ HB_FUNC( QT_QTREEWIDGETITEM_COLUMNCOUNT ) */ HB_FUNC( QT_QTREEWIDGETITEM_DATA ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QTreeWidgetItem( 1 )->data( hb_parni( 2 ), hb_parni( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QTreeWidgetItem( 1 )->data( hb_parni( 2 ), hb_parni( 3 ) ) ), true ) ); } /* @@ -229,7 +246,7 @@ HB_FUNC( QT_QTREEWIDGETITEM_FLAGS ) */ HB_FUNC( QT_QTREEWIDGETITEM_FONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QTreeWidgetItem( 1 )->font( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QTreeWidgetItem( 1 )->font( hb_parni( 2 ) ) ), true ) ); } /* @@ -237,7 +254,7 @@ HB_FUNC( QT_QTREEWIDGETITEM_FONT ) */ HB_FUNC( QT_QTREEWIDGETITEM_FOREGROUND ) { - hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QTreeWidgetItem( 1 )->foreground( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QBrush( new QBrush( hbqt_par_QTreeWidgetItem( 1 )->foreground( hb_parni( 2 ) ) ), true ) ); } /* @@ -245,7 +262,7 @@ HB_FUNC( QT_QTREEWIDGETITEM_FOREGROUND ) */ HB_FUNC( QT_QTREEWIDGETITEM_ICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QTreeWidgetItem( 1 )->icon( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QTreeWidgetItem( 1 )->icon( hb_parni( 2 ) ) ), true ) ); } /* @@ -309,7 +326,7 @@ HB_FUNC( QT_QTREEWIDGETITEM_ISSELECTED ) */ HB_FUNC( QT_QTREEWIDGETITEM_PARENT ) { - hb_retptr( ( QTreeWidgetItem* ) hbqt_par_QTreeWidgetItem( 1 )->parent() ); + hb_retptrGC( hbqt_gcAllocate_QTreeWidgetItem( hbqt_par_QTreeWidgetItem( 1 )->parent(), false ) ); } /* @@ -485,7 +502,7 @@ HB_FUNC( QT_QTREEWIDGETITEM_SETWHATSTHIS ) */ HB_FUNC( QT_QTREEWIDGETITEM_SIZEHINT ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QTreeWidgetItem( 1 )->sizeHint( hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QTreeWidgetItem( 1 )->sizeHint( hb_parni( 2 ) ) ), true ) ); } /* @@ -509,7 +526,7 @@ HB_FUNC( QT_QTREEWIDGETITEM_STATUSTIP ) */ HB_FUNC( QT_QTREEWIDGETITEM_TAKECHILD ) { - hb_retptr( ( QTreeWidgetItem* ) hbqt_par_QTreeWidgetItem( 1 )->takeChild( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QTreeWidgetItem( hbqt_par_QTreeWidgetItem( 1 )->takeChild( hb_parni( 2 ) ), false ) ); } /* @@ -541,7 +558,7 @@ HB_FUNC( QT_QTREEWIDGETITEM_TOOLTIP ) */ HB_FUNC( QT_QTREEWIDGETITEM_TREEWIDGET ) { - hb_retptr( ( QTreeWidget* ) hbqt_par_QTreeWidgetItem( 1 )->treeWidget() ); + hb_retptrGC( hbqt_gcAllocate_QTreeWidget( hbqt_par_QTreeWidgetItem( 1 )->treeWidget(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QVBoxLayout.cpp b/harbour/contrib/hbqt/qtgui/QVBoxLayout.cpp index f946a628fb..7fb2114f88 100644 --- a/harbour/contrib/hbqt/qtgui/QVBoxLayout.cpp +++ b/harbour/contrib/hbqt/qtgui/QVBoxLayout.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,6 +80,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QVBoxLayout > pq; } QGC_POINTER_QVBoxLayout; @@ -88,48 +89,47 @@ QT_G_FUNC( hbqt_gcRelease_QVBoxLayout ) { QGC_POINTER_QVBoxLayout * p = ( QGC_POINTER_QVBoxLayout * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QVBoxLayout p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QVBoxLayout ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QVBoxLayout * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QVBoxLayout * ) p->ph )->~QVBoxLayout(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QVBoxLayout * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QVBoxLayout ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QVBoxLayout ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QVBoxLayout Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QVBoxLayout Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QVBoxLayout Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QVBoxLayout Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QVBoxLayout Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QVBoxLayout( void * pObj ) +void * hbqt_gcAllocate_QVBoxLayout( void * pObj, bool bNew ) { QGC_POINTER_QVBoxLayout * p = ( QGC_POINTER_QVBoxLayout * ) hb_gcAllocate( sizeof( QGC_POINTER_QVBoxLayout ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QVBoxLayout; - new( & p->pq ) QPointer< QVBoxLayout >( ( QVBoxLayout * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QVBoxLayout %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QVBoxLayout >( ( QVBoxLayout * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QVBoxLayout ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -139,7 +139,7 @@ HB_FUNC( QT_QVBOXLAYOUT ) pObj = ( QVBoxLayout* ) new QVBoxLayout( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QVBoxLayout( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QVBoxLayout( pObj, true ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QValidator.cpp b/harbour/contrib/hbqt/qtgui/QValidator.cpp index 4dbd972332..49bcac19b1 100644 --- a/harbour/contrib/hbqt/qtgui/QValidator.cpp +++ b/harbour/contrib/hbqt/qtgui/QValidator.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,11 +79,35 @@ * ~QValidator () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; + QPointer< QValidator > pq; +} QGC_POINTER_QValidator; + QT_G_FUNC( hbqt_gcRelease_QValidator ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QValidator( void * pObj, bool bNew ) +{ + QGC_POINTER_QValidator * p = ( QGC_POINTER_QValidator * ) hb_gcAllocate( sizeof( QGC_POINTER_QValidator ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QValidator; + + if( bNew ) + { + new( & p->pq ) QPointer< QValidator >( ( QValidator * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QValidator ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QVALIDATOR ) { } @@ -92,7 +116,7 @@ HB_FUNC( QT_QVALIDATOR ) */ HB_FUNC( QT_QVALIDATOR_LOCALE ) { - hb_retptrGC( hbqt_gcAllocate_QLocale( new QLocale( hbqt_par_QValidator( 1 )->locale() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLocale( new QLocale( hbqt_par_QValidator( 1 )->locale() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QWheelEvent.cpp b/harbour/contrib/hbqt/qtgui/QWheelEvent.cpp index cea886a132..994d8140d2 100644 --- a/harbour/contrib/hbqt/qtgui/QWheelEvent.cpp +++ b/harbour/contrib/hbqt/qtgui/QWheelEvent.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -76,11 +76,33 @@ * QWheelEvent ( const QPoint & pos, const QPoint & globalPos, int delta, Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, Qt::Orientation orient = Qt::Vertical ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QWheelEvent; + QT_G_FUNC( hbqt_gcRelease_QWheelEvent ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QWheelEvent( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QWheelEvent; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QWheelEvent ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QWHEELEVENT ) { } @@ -105,7 +127,7 @@ HB_FUNC( QT_QWHEELEVENT_DELTA ) */ HB_FUNC( QT_QWHEELEVENT_GLOBALPOS ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QWheelEvent( 1 )->globalPos() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QWheelEvent( 1 )->globalPos() ), true ) ); } /* @@ -137,7 +159,7 @@ HB_FUNC( QT_QWHEELEVENT_ORIENTATION ) */ HB_FUNC( QT_QWHEELEVENT_POS ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QWheelEvent( 1 )->pos() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QWheelEvent( 1 )->pos() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QWidget.cpp b/harbour/contrib/hbqt/qtgui/QWidget.cpp index 903e8f23e4..b5583ed49c 100644 --- a/harbour/contrib/hbqt/qtgui/QWidget.cpp +++ b/harbour/contrib/hbqt/qtgui/QWidget.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -73,7 +73,7 @@ */ /* - * Constructed[ 211/229 [ 92.14% ] ] + * Constructed[ 210/229 [ 91.70% ] ] * * *** Unconvered Prototypes *** * ----------------------------- @@ -86,6 +86,7 @@ * * // WId effectiveWinId () const * // virtual HDC getDC () const + * // QGraphicsProxyWidget * graphicsProxyWidget () const * // bool hasEditFocus () const * // Qt::HANDLE macCGHandle () const * // Qt::HANDLE macQDHandle () const @@ -117,6 +118,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QWidget > pq; } QGC_POINTER_QWidget; @@ -125,48 +127,47 @@ QT_G_FUNC( hbqt_gcRelease_QWidget ) { QGC_POINTER_QWidget * p = ( QGC_POINTER_QWidget * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QWidget p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QWidget ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QWidget * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QWidget * ) p->ph )->~QWidget(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QWidget * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QWidget ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QWidget ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QWidget Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QWidget Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QWidget Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QWidget Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QWidget Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QWidget( void * pObj ) +void * hbqt_gcAllocate_QWidget( void * pObj, bool bNew ) { QGC_POINTER_QWidget * p = ( QGC_POINTER_QWidget * ) hb_gcAllocate( sizeof( QGC_POINTER_QWidget ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QWidget; - new( & p->pq ) QPointer< QWidget >( ( QWidget * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QWidget %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QWidget >( ( QWidget * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QWidget ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -176,7 +177,7 @@ HB_FUNC( QT_QWIDGET ) pObj = new QWidget( hbqt_par_QWidget( 1 ), ( Qt::WindowFlags ) hb_parni( 2 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QWidget( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( pObj, true ) ); } /* * bool acceptDrops () const @@ -247,7 +248,7 @@ HB_FUNC( QT_QWIDGET_BACKGROUNDROLE ) */ HB_FUNC( QT_QWIDGET_BASESIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->baseSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->baseSize() ), true ) ); } /* @@ -255,7 +256,7 @@ HB_FUNC( QT_QWIDGET_BASESIZE ) */ HB_FUNC( QT_QWIDGET_CHILDAT ) { - hb_retptr( ( QWidget* ) hbqt_par_QWidget( 1 )->childAt( hb_parni( 2 ), hb_parni( 3 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QWidget( 1 )->childAt( hb_parni( 2 ), hb_parni( 3 ) ), false ) ); } /* @@ -263,7 +264,7 @@ HB_FUNC( QT_QWIDGET_CHILDAT ) */ HB_FUNC( QT_QWIDGET_CHILDAT_1 ) { - hb_retptr( ( QWidget* ) hbqt_par_QWidget( 1 )->childAt( *hbqt_par_QPoint( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QWidget( 1 )->childAt( *hbqt_par_QPoint( 2 ) ), false ) ); } /* @@ -271,7 +272,7 @@ HB_FUNC( QT_QWIDGET_CHILDAT_1 ) */ HB_FUNC( QT_QWIDGET_CHILDRENRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QWidget( 1 )->childrenRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QWidget( 1 )->childrenRect() ), true ) ); } /* @@ -279,7 +280,7 @@ HB_FUNC( QT_QWIDGET_CHILDRENRECT ) */ HB_FUNC( QT_QWIDGET_CHILDRENREGION ) { - hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QWidget( 1 )->childrenRegion() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QWidget( 1 )->childrenRegion() ), true ) ); } /* @@ -303,7 +304,7 @@ HB_FUNC( QT_QWIDGET_CLEARMASK ) */ HB_FUNC( QT_QWIDGET_CONTENTSRECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QWidget( 1 )->contentsRect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QWidget( 1 )->contentsRect() ), true ) ); } /* @@ -319,7 +320,7 @@ HB_FUNC( QT_QWIDGET_CONTEXTMENUPOLICY ) */ HB_FUNC( QT_QWIDGET_CURSOR ) { - hb_retptrGC( hbqt_gcAllocate_QCursor( new QCursor( hbqt_par_QWidget( 1 )->cursor() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QCursor( new QCursor( hbqt_par_QWidget( 1 )->cursor() ), true ) ); } /* @@ -343,7 +344,7 @@ HB_FUNC( QT_QWIDGET_FOCUSPOLICY ) */ HB_FUNC( QT_QWIDGET_FOCUSPROXY ) { - hb_retptr( ( QWidget* ) hbqt_par_QWidget( 1 )->focusProxy() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QWidget( 1 )->focusProxy(), false ) ); } /* @@ -351,7 +352,7 @@ HB_FUNC( QT_QWIDGET_FOCUSPROXY ) */ HB_FUNC( QT_QWIDGET_FOCUSWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QWidget( 1 )->focusWidget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QWidget( 1 )->focusWidget(), false ) ); } /* @@ -359,7 +360,7 @@ HB_FUNC( QT_QWIDGET_FOCUSWIDGET ) */ HB_FUNC( QT_QWIDGET_FONT ) { - hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QWidget( 1 )->font() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFont( new QFont( hbqt_par_QWidget( 1 )->font() ), true ) ); } /* @@ -367,7 +368,7 @@ HB_FUNC( QT_QWIDGET_FONT ) */ HB_FUNC( QT_QWIDGET_FONTINFO ) { - hb_retptrGC( hbqt_gcAllocate_QFontInfo( new QFontInfo( hbqt_par_QWidget( 1 )->fontInfo() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFontInfo( new QFontInfo( hbqt_par_QWidget( 1 )->fontInfo() ), true ) ); } /* @@ -375,7 +376,7 @@ HB_FUNC( QT_QWIDGET_FONTINFO ) */ HB_FUNC( QT_QWIDGET_FONTMETRICS ) { - hb_retptrGC( hbqt_gcAllocate_QFontMetrics( new QFontMetrics( hbqt_par_QWidget( 1 )->fontMetrics() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QFontMetrics( new QFontMetrics( hbqt_par_QWidget( 1 )->fontMetrics() ), true ) ); } /* @@ -391,7 +392,7 @@ HB_FUNC( QT_QWIDGET_FOREGROUNDROLE ) */ HB_FUNC( QT_QWIDGET_FRAMEGEOMETRY ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QWidget( 1 )->frameGeometry() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QWidget( 1 )->frameGeometry() ), true ) ); } /* @@ -399,7 +400,7 @@ HB_FUNC( QT_QWIDGET_FRAMEGEOMETRY ) */ HB_FUNC( QT_QWIDGET_FRAMESIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->frameSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->frameSize() ), true ) ); } /* @@ -407,7 +408,7 @@ HB_FUNC( QT_QWIDGET_FRAMESIZE ) */ HB_FUNC( QT_QWIDGET_GEOMETRY ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QWidget( 1 )->geometry() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QWidget( 1 )->geometry() ), true ) ); } /* @@ -460,14 +461,6 @@ HB_FUNC( QT_QWIDGET_GRABSHORTCUT ) hb_retni( hbqt_par_QWidget( 1 )->grabShortcut( *hbqt_par_QKeySequence( 2 ), ( HB_ISNUM( 3 ) ? ( Qt::ShortcutContext ) hb_parni( 3 ) : ( Qt::ShortcutContext ) Qt::WindowShortcut ) ) ); } -/* - * QGraphicsProxyWidget * graphicsProxyWidget () const - */ -HB_FUNC( QT_QWIDGET_GRAPHICSPROXYWIDGET ) -{ - hb_retptr( ( QGraphicsProxyWidget* ) hbqt_par_QWidget( 1 )->graphicsProxyWidget() ); -} - /* * bool hasFocus () const */ @@ -505,7 +498,7 @@ HB_FUNC( QT_QWIDGET_HEIGHTFORWIDTH ) */ HB_FUNC( QT_QWIDGET_INPUTCONTEXT ) { - hb_retptr( ( QInputContext* ) hbqt_par_QWidget( 1 )->inputContext() ); + hb_retptrGC( hbqt_gcAllocate_QInputContext( hbqt_par_QWidget( 1 )->inputContext(), false ) ); } /* @@ -513,7 +506,7 @@ HB_FUNC( QT_QWIDGET_INPUTCONTEXT ) */ HB_FUNC( QT_QWIDGET_INPUTMETHODQUERY ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QWidget( 1 )->inputMethodQuery( ( Qt::InputMethodQuery ) hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QWidget( 1 )->inputMethodQuery( ( Qt::InputMethodQuery ) hb_parni( 2 ) ) ), true ) ); } /* @@ -633,7 +626,7 @@ HB_FUNC( QT_QWIDGET_ISWINDOWMODIFIED ) */ HB_FUNC( QT_QWIDGET_LAYOUT ) { - hb_retptr( ( QLayout* ) hbqt_par_QWidget( 1 )->layout() ); + hb_retptrGC( hbqt_gcAllocate_QLayout( hbqt_par_QWidget( 1 )->layout(), false ) ); } /* @@ -649,7 +642,7 @@ HB_FUNC( QT_QWIDGET_LAYOUTDIRECTION ) */ HB_FUNC( QT_QWIDGET_LOCALE ) { - hb_retptrGC( hbqt_gcAllocate_QLocale( new QLocale( hbqt_par_QWidget( 1 )->locale() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QLocale( new QLocale( hbqt_par_QWidget( 1 )->locale() ), true ) ); } /* @@ -657,7 +650,7 @@ HB_FUNC( QT_QWIDGET_LOCALE ) */ HB_FUNC( QT_QWIDGET_MAPFROM ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->mapFrom( hbqt_par_QWidget( 2 ), *hbqt_par_QPoint( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->mapFrom( hbqt_par_QWidget( 2 ), *hbqt_par_QPoint( 3 ) ) ), true ) ); } /* @@ -665,7 +658,7 @@ HB_FUNC( QT_QWIDGET_MAPFROM ) */ HB_FUNC( QT_QWIDGET_MAPFROMGLOBAL ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->mapFromGlobal( *hbqt_par_QPoint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->mapFromGlobal( *hbqt_par_QPoint( 2 ) ) ), true ) ); } /* @@ -673,7 +666,7 @@ HB_FUNC( QT_QWIDGET_MAPFROMGLOBAL ) */ HB_FUNC( QT_QWIDGET_MAPFROMPARENT ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->mapFromParent( *hbqt_par_QPoint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->mapFromParent( *hbqt_par_QPoint( 2 ) ) ), true ) ); } /* @@ -681,7 +674,7 @@ HB_FUNC( QT_QWIDGET_MAPFROMPARENT ) */ HB_FUNC( QT_QWIDGET_MAPTO ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->mapTo( hbqt_par_QWidget( 2 ), *hbqt_par_QPoint( 3 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->mapTo( hbqt_par_QWidget( 2 ), *hbqt_par_QPoint( 3 ) ) ), true ) ); } /* @@ -689,7 +682,7 @@ HB_FUNC( QT_QWIDGET_MAPTO ) */ HB_FUNC( QT_QWIDGET_MAPTOGLOBAL ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->mapToGlobal( *hbqt_par_QPoint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->mapToGlobal( *hbqt_par_QPoint( 2 ) ) ), true ) ); } /* @@ -697,7 +690,7 @@ HB_FUNC( QT_QWIDGET_MAPTOGLOBAL ) */ HB_FUNC( QT_QWIDGET_MAPTOPARENT ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->mapToParent( *hbqt_par_QPoint( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->mapToParent( *hbqt_par_QPoint( 2 ) ) ), true ) ); } /* @@ -705,7 +698,7 @@ HB_FUNC( QT_QWIDGET_MAPTOPARENT ) */ HB_FUNC( QT_QWIDGET_MASK ) { - hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QWidget( 1 )->mask() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QWidget( 1 )->mask() ), true ) ); } /* @@ -721,7 +714,7 @@ HB_FUNC( QT_QWIDGET_MAXIMUMHEIGHT ) */ HB_FUNC( QT_QWIDGET_MAXIMUMSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->maximumSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->maximumSize() ), true ) ); } /* @@ -745,7 +738,7 @@ HB_FUNC( QT_QWIDGET_MINIMUMHEIGHT ) */ HB_FUNC( QT_QWIDGET_MINIMUMSIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->minimumSize() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->minimumSize() ), true ) ); } /* @@ -753,7 +746,7 @@ HB_FUNC( QT_QWIDGET_MINIMUMSIZE ) */ HB_FUNC( QT_QWIDGET_MINIMUMSIZEHINT ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->minimumSizeHint() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->minimumSizeHint() ), true ) ); } /* @@ -785,7 +778,7 @@ HB_FUNC( QT_QWIDGET_MOVE_1 ) */ HB_FUNC( QT_QWIDGET_NATIVEPARENTWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QWidget( 1 )->nativeParentWidget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QWidget( 1 )->nativeParentWidget(), false ) ); } /* @@ -793,7 +786,7 @@ HB_FUNC( QT_QWIDGET_NATIVEPARENTWIDGET ) */ HB_FUNC( QT_QWIDGET_NEXTINFOCUSCHAIN ) { - hb_retptr( ( QWidget* ) hbqt_par_QWidget( 1 )->nextInFocusChain() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QWidget( 1 )->nextInFocusChain(), false ) ); } /* @@ -801,7 +794,7 @@ HB_FUNC( QT_QWIDGET_NEXTINFOCUSCHAIN ) */ HB_FUNC( QT_QWIDGET_NORMALGEOMETRY ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QWidget( 1 )->normalGeometry() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QWidget( 1 )->normalGeometry() ), true ) ); } /* @@ -817,7 +810,7 @@ HB_FUNC( QT_QWIDGET_OVERRIDEWINDOWFLAGS ) */ HB_FUNC( QT_QWIDGET_PAINTENGINE ) { - hb_retptr( ( QPaintEngine* ) hbqt_par_QWidget( 1 )->paintEngine() ); + hb_retptrGC( hbqt_gcAllocate_QPaintEngine( hbqt_par_QWidget( 1 )->paintEngine(), false ) ); } /* @@ -825,7 +818,7 @@ HB_FUNC( QT_QWIDGET_PAINTENGINE ) */ HB_FUNC( QT_QWIDGET_PALETTE ) { - hb_retptrGC( hbqt_gcAllocate_QPalette( new QPalette( hbqt_par_QWidget( 1 )->palette() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPalette( new QPalette( hbqt_par_QWidget( 1 )->palette() ), true ) ); } /* @@ -833,7 +826,7 @@ HB_FUNC( QT_QWIDGET_PALETTE ) */ HB_FUNC( QT_QWIDGET_PARENTWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QWidget( 1 )->parentWidget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QWidget( 1 )->parentWidget(), false ) ); } /* @@ -841,7 +834,7 @@ HB_FUNC( QT_QWIDGET_PARENTWIDGET ) */ HB_FUNC( QT_QWIDGET_POS ) { - hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->pos() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPoint( new QPoint( hbqt_par_QWidget( 1 )->pos() ), true ) ); } /* @@ -849,7 +842,7 @@ HB_FUNC( QT_QWIDGET_POS ) */ HB_FUNC( QT_QWIDGET_RECT ) { - hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QWidget( 1 )->rect() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRect( new QRect( hbqt_par_QWidget( 1 )->rect() ), true ) ); } /* @@ -937,7 +930,7 @@ HB_FUNC( QT_QWIDGET_RESTOREGEOMETRY ) */ HB_FUNC( QT_QWIDGET_SAVEGEOMETRY ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QWidget( 1 )->saveGeometry() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QWidget( 1 )->saveGeometry() ), true ) ); } /* @@ -1425,7 +1418,7 @@ HB_FUNC( QT_QWIDGET_SETWINDOWSTATE ) */ HB_FUNC( QT_QWIDGET_SIZE ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->size() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->size() ), true ) ); } /* @@ -1433,7 +1426,7 @@ HB_FUNC( QT_QWIDGET_SIZE ) */ HB_FUNC( QT_QWIDGET_SIZEHINT ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->sizeHint() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->sizeHint() ), true ) ); } /* @@ -1441,7 +1434,7 @@ HB_FUNC( QT_QWIDGET_SIZEHINT ) */ HB_FUNC( QT_QWIDGET_SIZEINCREMENT ) { - hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->sizeIncrement() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSize( new QSize( hbqt_par_QWidget( 1 )->sizeIncrement() ), true ) ); } /* @@ -1449,7 +1442,7 @@ HB_FUNC( QT_QWIDGET_SIZEINCREMENT ) */ HB_FUNC( QT_QWIDGET_SIZEPOLICY ) { - hb_retptrGC( hbqt_gcAllocate_QSizePolicy( new QSizePolicy( hbqt_par_QWidget( 1 )->sizePolicy() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QSizePolicy( new QSizePolicy( hbqt_par_QWidget( 1 )->sizePolicy() ), true ) ); } /* @@ -1473,7 +1466,7 @@ HB_FUNC( QT_QWIDGET_STATUSTIP ) */ HB_FUNC( QT_QWIDGET_STYLE ) { - hb_retptr( ( QStyle* ) hbqt_par_QWidget( 1 )->style() ); + hb_retptrGC( hbqt_gcAllocate_QStyle( hbqt_par_QWidget( 1 )->style(), false ) ); } /* @@ -1577,7 +1570,7 @@ HB_FUNC( QT_QWIDGET_UPDATESENABLED ) */ HB_FUNC( QT_QWIDGET_VISIBLEREGION ) { - hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QWidget( 1 )->visibleRegion() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QRegion( new QRegion( hbqt_par_QWidget( 1 )->visibleRegion() ), true ) ); } /* @@ -1601,7 +1594,7 @@ HB_FUNC( QT_QWIDGET_WIDTH ) */ HB_FUNC( QT_QWIDGET_WINDOW ) { - hb_retptr( ( QWidget* ) hbqt_par_QWidget( 1 )->window() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QWidget( 1 )->window(), false ) ); } /* @@ -1625,7 +1618,7 @@ HB_FUNC( QT_QWIDGET_WINDOWFLAGS ) */ HB_FUNC( QT_QWIDGET_WINDOWICON ) { - hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QWidget( 1 )->windowIcon() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QIcon( new QIcon( hbqt_par_QWidget( 1 )->windowIcon() ), true ) ); } /* @@ -1705,7 +1698,7 @@ HB_FUNC( QT_QWIDGET_Y ) */ HB_FUNC( QT_QWIDGET_KEYBOARDGRABBER ) { - hb_retptr( ( QWidget* ) hbqt_par_QWidget( 1 )->keyboardGrabber() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QWidget( 1 )->keyboardGrabber(), false ) ); } /* @@ -1713,7 +1706,7 @@ HB_FUNC( QT_QWIDGET_KEYBOARDGRABBER ) */ HB_FUNC( QT_QWIDGET_MOUSEGRABBER ) { - hb_retptr( ( QWidget* ) hbqt_par_QWidget( 1 )->mouseGrabber() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QWidget( 1 )->mouseGrabber(), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QWidgetAction.cpp b/harbour/contrib/hbqt/qtgui/QWidgetAction.cpp index 85ebe5cbc9..72a0c9a540 100644 --- a/harbour/contrib/hbqt/qtgui/QWidgetAction.cpp +++ b/harbour/contrib/hbqt/qtgui/QWidgetAction.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -79,6 +79,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QWidgetAction > pq; } QGC_POINTER_QWidgetAction; @@ -87,48 +88,47 @@ QT_G_FUNC( hbqt_gcRelease_QWidgetAction ) { QGC_POINTER_QWidgetAction * p = ( QGC_POINTER_QWidgetAction * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QWidgetAction p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QWidgetAction ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QWidgetAction * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QWidgetAction * ) p->ph )->~QWidgetAction(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QWidgetAction * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QWidgetAction ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QWidgetAction ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QWidgetAction Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QWidgetAction Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QWidgetAction Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QWidgetAction Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QWidgetAction Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QWidgetAction( void * pObj ) +void * hbqt_gcAllocate_QWidgetAction( void * pObj, bool bNew ) { QGC_POINTER_QWidgetAction * p = ( QGC_POINTER_QWidgetAction * ) hb_gcAllocate( sizeof( QGC_POINTER_QWidgetAction ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QWidgetAction; - new( & p->pq ) QPointer< QWidgetAction >( ( QWidgetAction * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QWidgetAction %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QWidgetAction >( ( QWidgetAction * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QWidgetAction ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -138,14 +138,14 @@ HB_FUNC( QT_QWIDGETACTION ) pObj = ( QWidgetAction* ) new QWidgetAction( hbqt_par_QObject( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QWidgetAction( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QWidgetAction( pObj, true ) ); } /* * QWidget * defaultWidget () const */ HB_FUNC( QT_QWIDGETACTION_DEFAULTWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QWidgetAction( 1 )->defaultWidget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QWidgetAction( 1 )->defaultWidget(), false ) ); } /* @@ -161,7 +161,7 @@ HB_FUNC( QT_QWIDGETACTION_RELEASEWIDGET ) */ HB_FUNC( QT_QWIDGETACTION_REQUESTWIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QWidgetAction( 1 )->requestWidget( hbqt_par_QWidget( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QWidgetAction( 1 )->requestWidget( hbqt_par_QWidget( 2 ) ), false ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QWidgetItem.cpp b/harbour/contrib/hbqt/qtgui/QWidgetItem.cpp index 0d380a5261..7dbb46d5d5 100644 --- a/harbour/contrib/hbqt/qtgui/QWidgetItem.cpp +++ b/harbour/contrib/hbqt/qtgui/QWidgetItem.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -75,32 +75,49 @@ * QWidgetItem ( QWidget * widget ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QWidgetItem; + QT_G_FUNC( hbqt_gcRelease_QWidgetItem ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QWidgetItem p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QWidgetItem ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QWidgetItem * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QWidgetItem Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QWidgetItem * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QWidgetItem ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QWidgetItem Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QWidgetItem Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QWidgetItem Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QWidgetItem( void * pObj ) +void * hbqt_gcAllocate_QWidgetItem( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QWidgetItem; - HB_TRACE( HB_TR_DEBUG, ( " new_QWidgetItem %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QWidgetItem ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -110,7 +127,7 @@ HB_FUNC( QT_QWIDGETITEM ) pObj = ( QWidgetItem* ) new QWidgetItem( hbqt_par_QWidget( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QWidgetItem( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QWidgetItem( pObj, true ) ); } /* * virtual bool isEmpty () const @@ -125,7 +142,7 @@ HB_FUNC( QT_QWIDGETITEM_ISEMPTY ) */ HB_FUNC( QT_QWIDGETITEM_WIDGET ) { - hb_retptr( ( QWidget* ) hbqt_par_QWidgetItem( 1 )->widget() ); + hb_retptrGC( hbqt_gcAllocate_QWidget( hbqt_par_QWidgetItem( 1 )->widget(), false ) ); } diff --git a/harbour/contrib/hbqt/qtgui/QWindowsStyle.cpp b/harbour/contrib/hbqt/qtgui/QWindowsStyle.cpp index 3044f97955..8f3c9cf8eb 100644 --- a/harbour/contrib/hbqt/qtgui/QWindowsStyle.cpp +++ b/harbour/contrib/hbqt/qtgui/QWindowsStyle.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -80,6 +80,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QWindowsStyle > pq; } QGC_POINTER_QWindowsStyle; @@ -88,48 +89,47 @@ QT_G_FUNC( hbqt_gcRelease_QWindowsStyle ) { QGC_POINTER_QWindowsStyle * p = ( QGC_POINTER_QWindowsStyle * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QWindowsStyle p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QWindowsStyle ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QWindowsStyle * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QWindowsStyle * ) p->ph )->~QWindowsStyle(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QWindowsStyle * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QWindowsStyle ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QWindowsStyle ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QWindowsStyle Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QWindowsStyle Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QWindowsStyle Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QWindowsStyle Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QWindowsStyle Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QWindowsStyle( void * pObj ) +void * hbqt_gcAllocate_QWindowsStyle( void * pObj, bool bNew ) { QGC_POINTER_QWindowsStyle * p = ( QGC_POINTER_QWindowsStyle * ) hb_gcAllocate( sizeof( QGC_POINTER_QWindowsStyle ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QWindowsStyle; - new( & p->pq ) QPointer< QWindowsStyle >( ( QWindowsStyle * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QWindowsStyle %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QWindowsStyle >( ( QWindowsStyle * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QWindowsStyle ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -139,7 +139,7 @@ HB_FUNC( QT_QWINDOWSSTYLE ) pObj = ( QWindowsStyle* ) new QWindowsStyle() ; - hb_retptrGC( hbqt_gcAllocate_QWindowsStyle( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QWindowsStyle( pObj, true ) ); } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/QWizard.cpp b/harbour/contrib/hbqt/qtgui/QWizard.cpp index d8c0e85514..048c2d3c8a 100644 --- a/harbour/contrib/hbqt/qtgui/QWizard.cpp +++ b/harbour/contrib/hbqt/qtgui/QWizard.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -99,6 +99,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QWizard > pq; } QGC_POINTER_QWizard; @@ -107,48 +108,47 @@ QT_G_FUNC( hbqt_gcRelease_QWizard ) { QGC_POINTER_QWizard * p = ( QGC_POINTER_QWizard * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QWizard p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QWizard ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QWizard * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QWizard * ) p->ph )->~QWizard(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QWizard * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QWizard ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QWizard ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QWizard Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QWizard Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QWizard Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QWizard Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QWizard Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QWizard( void * pObj ) +void * hbqt_gcAllocate_QWizard( void * pObj, bool bNew ) { QGC_POINTER_QWizard * p = ( QGC_POINTER_QWizard * ) hb_gcAllocate( sizeof( QGC_POINTER_QWizard ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QWizard; - new( & p->pq ) QPointer< QWizard >( ( QWizard * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QWizard %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QWizard >( ( QWizard * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QWizard ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -158,7 +158,7 @@ HB_FUNC( QT_QWIZARD ) pObj = new QWizard( hbqt_par_QWidget( 2 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QWizard( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QWizard( pObj, true ) ); } /* * int addPage ( QWizardPage * page ) @@ -173,7 +173,7 @@ HB_FUNC( QT_QWIZARD_ADDPAGE ) */ HB_FUNC( QT_QWIZARD_BUTTON ) { - hb_retptr( ( QAbstractButton* ) hbqt_par_QWizard( 1 )->button( ( QWizard::WizardButton ) hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QAbstractButton( hbqt_par_QWizard( 1 )->button( ( QWizard::WizardButton ) hb_parni( 2 ) ), false ) ); } /* @@ -197,7 +197,7 @@ HB_FUNC( QT_QWIZARD_CURRENTID ) */ HB_FUNC( QT_QWIZARD_CURRENTPAGE ) { - hb_retptr( ( QWizardPage* ) hbqt_par_QWizard( 1 )->currentPage() ); + hb_retptrGC( hbqt_gcAllocate_QWizardPage( hbqt_par_QWizard( 1 )->currentPage(), false ) ); } /* @@ -205,7 +205,7 @@ HB_FUNC( QT_QWIZARD_CURRENTPAGE ) */ HB_FUNC( QT_QWIZARD_FIELD ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QWizard( 1 )->field( QWizard::tr( hb_parc( 2 ) ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QWizard( 1 )->field( QWizard::tr( hb_parc( 2 ) ) ) ), true ) ); } /* @@ -237,7 +237,7 @@ HB_FUNC( QT_QWIZARD_OPTIONS ) */ HB_FUNC( QT_QWIZARD_PAGE ) { - hb_retptr( ( QWizardPage* ) hbqt_par_QWizard( 1 )->page( hb_parni( 2 ) ) ); + hb_retptrGC( hbqt_gcAllocate_QWizardPage( hbqt_par_QWizard( 1 )->page( hb_parni( 2 ) ), false ) ); } /* @@ -245,7 +245,7 @@ HB_FUNC( QT_QWIZARD_PAGE ) */ HB_FUNC( QT_QWIZARD_PIXMAP ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QWizard( 1 )->pixmap( ( QWizard::WizardPixmap ) hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QWizard( 1 )->pixmap( ( QWizard::WizardPixmap ) hb_parni( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/QWizardPage.cpp b/harbour/contrib/hbqt/qtgui/QWizardPage.cpp index 052aee758d..41be4ac587 100644 --- a/harbour/contrib/hbqt/qtgui/QWizardPage.cpp +++ b/harbour/contrib/hbqt/qtgui/QWizardPage.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -77,6 +77,7 @@ typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QWizardPage > pq; } QGC_POINTER_QWizardPage; @@ -85,48 +86,47 @@ QT_G_FUNC( hbqt_gcRelease_QWizardPage ) { QGC_POINTER_QWizardPage * p = ( QGC_POINTER_QWizardPage * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QWizardPage p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QWizardPage ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QWizardPage * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QWizardPage * ) p->ph )->~QWizardPage(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QWizardPage * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QWizardPage ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QWizardPage ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QWizardPage Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QWizardPage Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QWizardPage Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QWizardPage Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QWizardPage Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QWizardPage( void * pObj ) +void * hbqt_gcAllocate_QWizardPage( void * pObj, bool bNew ) { QGC_POINTER_QWizardPage * p = ( QGC_POINTER_QWizardPage * ) hb_gcAllocate( sizeof( QGC_POINTER_QWizardPage ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QWizardPage; - new( & p->pq ) QPointer< QWizardPage >( ( QWizardPage * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QWizardPage %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QWizardPage >( ( QWizardPage * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QWizardPage ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -136,7 +136,7 @@ HB_FUNC( QT_QWIZARDPAGE ) pObj = new QWizardPage() ; - hb_retptrGC( hbqt_gcAllocate_QWizardPage( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QWizardPage( pObj, true ) ); } /* * QString buttonText ( QWizard::WizardButton which ) const @@ -199,7 +199,7 @@ HB_FUNC( QT_QWIZARDPAGE_NEXTID ) */ HB_FUNC( QT_QWIZARDPAGE_PIXMAP ) { - hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QWizardPage( 1 )->pixmap( ( QWizard::WizardPixmap ) hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QPixmap( new QPixmap( hbqt_par_QWizardPage( 1 )->pixmap( ( QWizard::WizardPixmap ) hb_parni( 2 ) ) ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtgui/THBQTextBlockUserData.prg b/harbour/contrib/hbqt/qtgui/THBQTextBlockUserData.prg new file mode 100644 index 0000000000..aa3ef073a1 --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/THBQTextBlockUserData.prg @@ -0,0 +1,86 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009-2010 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ + + +#include "hbclass.ch" + + +CREATE CLASS HBQTextBlockUserData INHERIT HbQtObjectHandler + + METHOD new( ... ) + + METHOD setData( nState ) + + ENDCLASS + + +METHOD HBQTextBlockUserData:new( ... ) + LOCAL p + FOR EACH p IN { ... } + hb_pvalue( p:__enumIndex(), hbqt_ptr( p ) ) + NEXT + ::pPtr := Qt_HBQTextBlockUserData( ... ) + RETURN Self + + +METHOD HBQTextBlockUserData:setData( nState ) + RETURN Qt_HBQTextBlockUserData_setData( ::pPtr, nState ) + diff --git a/harbour/contrib/hbqt/qtgui/TQAbstractButton.prg b/harbour/contrib/hbqt/qtgui/TQAbstractButton.prg index 5816355863..24b905d587 100644 --- a/harbour/contrib/hbqt/qtgui/TQAbstractButton.prg +++ b/harbour/contrib/hbqt/qtgui/TQAbstractButton.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQAbstractItemDelegate.prg b/harbour/contrib/hbqt/qtgui/TQAbstractItemDelegate.prg index 33779518e1..48227a1bd3 100644 --- a/harbour/contrib/hbqt/qtgui/TQAbstractItemDelegate.prg +++ b/harbour/contrib/hbqt/qtgui/TQAbstractItemDelegate.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQAbstractItemView.prg b/harbour/contrib/hbqt/qtgui/TQAbstractItemView.prg index b58f8a76df..27cea1dbfe 100644 --- a/harbour/contrib/hbqt/qtgui/TQAbstractItemView.prg +++ b/harbour/contrib/hbqt/qtgui/TQAbstractItemView.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQAbstractPrintDialog.prg b/harbour/contrib/hbqt/qtgui/TQAbstractPrintDialog.prg index b213629625..b4c059c0f0 100644 --- a/harbour/contrib/hbqt/qtgui/TQAbstractPrintDialog.prg +++ b/harbour/contrib/hbqt/qtgui/TQAbstractPrintDialog.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQAbstractProxyModel.prg b/harbour/contrib/hbqt/qtgui/TQAbstractProxyModel.prg index 25c459ffba..75cb273b65 100644 --- a/harbour/contrib/hbqt/qtgui/TQAbstractProxyModel.prg +++ b/harbour/contrib/hbqt/qtgui/TQAbstractProxyModel.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQAbstractScrollArea.prg b/harbour/contrib/hbqt/qtgui/TQAbstractScrollArea.prg index 9479d02dcc..7ec7196b44 100644 --- a/harbour/contrib/hbqt/qtgui/TQAbstractScrollArea.prg +++ b/harbour/contrib/hbqt/qtgui/TQAbstractScrollArea.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQAbstractSlider.prg b/harbour/contrib/hbqt/qtgui/TQAbstractSlider.prg index e265db671f..113cf926c6 100644 --- a/harbour/contrib/hbqt/qtgui/TQAbstractSlider.prg +++ b/harbour/contrib/hbqt/qtgui/TQAbstractSlider.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQAbstractSpinBox.prg b/harbour/contrib/hbqt/qtgui/TQAbstractSpinBox.prg index 1cb358fb77..5aca24141e 100644 --- a/harbour/contrib/hbqt/qtgui/TQAbstractSpinBox.prg +++ b/harbour/contrib/hbqt/qtgui/TQAbstractSpinBox.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQAbstractTextDocumentLayout.prg b/harbour/contrib/hbqt/qtgui/TQAbstractTextDocumentLayout.prg index 68f67c8d23..130d447b98 100644 --- a/harbour/contrib/hbqt/qtgui/TQAbstractTextDocumentLayout.prg +++ b/harbour/contrib/hbqt/qtgui/TQAbstractTextDocumentLayout.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -72,7 +72,6 @@ CREATE CLASS QAbstractTextDocumentLayout INHERIT HbQtObjectHandler, QObject METHOD document() METHOD documentSize() METHOD frameBoundingRect( pFrame ) - METHOD handlerForObject( nObjectType ) METHOD hitTest( pPoint, nAccuracy ) METHOD pageCount() METHOD paintDevice() @@ -111,10 +110,6 @@ METHOD QAbstractTextDocumentLayout:frameBoundingRect( pFrame ) RETURN Qt_QAbstractTextDocumentLayout_frameBoundingRect( ::pPtr, hbqt_ptr( pFrame ) ) -METHOD QAbstractTextDocumentLayout:handlerForObject( nObjectType ) - RETURN Qt_QAbstractTextDocumentLayout_handlerForObject( ::pPtr, nObjectType ) - - METHOD QAbstractTextDocumentLayout:hitTest( pPoint, nAccuracy ) RETURN Qt_QAbstractTextDocumentLayout_hitTest( ::pPtr, hbqt_ptr( pPoint ), nAccuracy ) diff --git a/harbour/contrib/hbqt/qtgui/TQAction.prg b/harbour/contrib/hbqt/qtgui/TQAction.prg index 426e9def7d..003c774c3c 100644 --- a/harbour/contrib/hbqt/qtgui/TQAction.prg +++ b/harbour/contrib/hbqt/qtgui/TQAction.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQActionGroup.prg b/harbour/contrib/hbqt/qtgui/TQActionGroup.prg index aa6b4be551..5e91a48503 100644 --- a/harbour/contrib/hbqt/qtgui/TQActionGroup.prg +++ b/harbour/contrib/hbqt/qtgui/TQActionGroup.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQApplication.prg b/harbour/contrib/hbqt/qtgui/TQApplication.prg index 9b06ceb419..362ea31afe 100644 --- a/harbour/contrib/hbqt/qtgui/TQApplication.prg +++ b/harbour/contrib/hbqt/qtgui/TQApplication.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQBitmap.prg b/harbour/contrib/hbqt/qtgui/TQBitmap.prg index aba79773a4..7d8611df62 100644 --- a/harbour/contrib/hbqt/qtgui/TQBitmap.prg +++ b/harbour/contrib/hbqt/qtgui/TQBitmap.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQBoxLayout.prg b/harbour/contrib/hbqt/qtgui/TQBoxLayout.prg index 927c09a851..a6b5bfb2bc 100644 --- a/harbour/contrib/hbqt/qtgui/TQBoxLayout.prg +++ b/harbour/contrib/hbqt/qtgui/TQBoxLayout.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQBrush.prg b/harbour/contrib/hbqt/qtgui/TQBrush.prg index 5199335619..b72fe8835a 100644 --- a/harbour/contrib/hbqt/qtgui/TQBrush.prg +++ b/harbour/contrib/hbqt/qtgui/TQBrush.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQButtonGroup.prg b/harbour/contrib/hbqt/qtgui/TQButtonGroup.prg index 8b0f4b9d1a..36fe02c0f4 100644 --- a/harbour/contrib/hbqt/qtgui/TQButtonGroup.prg +++ b/harbour/contrib/hbqt/qtgui/TQButtonGroup.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQCalendarWidget.prg b/harbour/contrib/hbqt/qtgui/TQCalendarWidget.prg index 7a5d57146d..aa21e2cd63 100644 --- a/harbour/contrib/hbqt/qtgui/TQCalendarWidget.prg +++ b/harbour/contrib/hbqt/qtgui/TQCalendarWidget.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQCheckBox.prg b/harbour/contrib/hbqt/qtgui/TQCheckBox.prg index 195037cae7..65e24248c1 100644 --- a/harbour/contrib/hbqt/qtgui/TQCheckBox.prg +++ b/harbour/contrib/hbqt/qtgui/TQCheckBox.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQClipboard.prg b/harbour/contrib/hbqt/qtgui/TQClipboard.prg index 091404d03d..6d3b267893 100644 --- a/harbour/contrib/hbqt/qtgui/TQClipboard.prg +++ b/harbour/contrib/hbqt/qtgui/TQClipboard.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -69,7 +69,6 @@ CREATE CLASS QClipboard INHERIT HbQtObjectHandler, QObject METHOD clear( nMode ) METHOD image( nMode ) - METHOD mimeData( nMode ) METHOD ownsClipboard() METHOD ownsFindBuffer() METHOD ownsSelection() @@ -102,10 +101,6 @@ METHOD QClipboard:image( nMode ) RETURN Qt_QClipboard_image( ::pPtr, nMode ) -METHOD QClipboard:mimeData( nMode ) - RETURN Qt_QClipboard_mimeData( ::pPtr, nMode ) - - METHOD QClipboard:ownsClipboard() RETURN Qt_QClipboard_ownsClipboard( ::pPtr ) diff --git a/harbour/contrib/hbqt/qtgui/TQColor.prg b/harbour/contrib/hbqt/qtgui/TQColor.prg index 27d039b0c3..c90d4c5b02 100644 --- a/harbour/contrib/hbqt/qtgui/TQColor.prg +++ b/harbour/contrib/hbqt/qtgui/TQColor.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQColorDialog.prg b/harbour/contrib/hbqt/qtgui/TQColorDialog.prg index 143063b29f..d5581db6f2 100644 --- a/harbour/contrib/hbqt/qtgui/TQColorDialog.prg +++ b/harbour/contrib/hbqt/qtgui/TQColorDialog.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQComboBox.prg b/harbour/contrib/hbqt/qtgui/TQComboBox.prg index d82612972d..ff4e73e056 100644 --- a/harbour/contrib/hbqt/qtgui/TQComboBox.prg +++ b/harbour/contrib/hbqt/qtgui/TQComboBox.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQCommandLinkButton.prg b/harbour/contrib/hbqt/qtgui/TQCommandLinkButton.prg index 16a9e59cf6..1a6e4fe8e4 100644 --- a/harbour/contrib/hbqt/qtgui/TQCommandLinkButton.prg +++ b/harbour/contrib/hbqt/qtgui/TQCommandLinkButton.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQCommonStyle.prg b/harbour/contrib/hbqt/qtgui/TQCommonStyle.prg index ea9a3ead48..c6a03f1b82 100644 --- a/harbour/contrib/hbqt/qtgui/TQCommonStyle.prg +++ b/harbour/contrib/hbqt/qtgui/TQCommonStyle.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQCompleter.prg b/harbour/contrib/hbqt/qtgui/TQCompleter.prg index e8249a068f..b3de46b0f5 100644 --- a/harbour/contrib/hbqt/qtgui/TQCompleter.prg +++ b/harbour/contrib/hbqt/qtgui/TQCompleter.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQConicalGradient.prg b/harbour/contrib/hbqt/qtgui/TQConicalGradient.prg index 29a3843f4b..2eb6fd009a 100644 --- a/harbour/contrib/hbqt/qtgui/TQConicalGradient.prg +++ b/harbour/contrib/hbqt/qtgui/TQConicalGradient.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQContextMenuEvent.prg b/harbour/contrib/hbqt/qtgui/TQContextMenuEvent.prg index c237183050..aea07dfe68 100644 --- a/harbour/contrib/hbqt/qtgui/TQContextMenuEvent.prg +++ b/harbour/contrib/hbqt/qtgui/TQContextMenuEvent.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQCursor.prg b/harbour/contrib/hbqt/qtgui/TQCursor.prg index 079d4fbba0..d63babac94 100644 --- a/harbour/contrib/hbqt/qtgui/TQCursor.prg +++ b/harbour/contrib/hbqt/qtgui/TQCursor.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQDateEdit.prg b/harbour/contrib/hbqt/qtgui/TQDateEdit.prg index 44e1061d45..abbc89ca54 100644 --- a/harbour/contrib/hbqt/qtgui/TQDateEdit.prg +++ b/harbour/contrib/hbqt/qtgui/TQDateEdit.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQDateTimeEdit.prg b/harbour/contrib/hbqt/qtgui/TQDateTimeEdit.prg index 14681df717..014f06f1f4 100644 --- a/harbour/contrib/hbqt/qtgui/TQDateTimeEdit.prg +++ b/harbour/contrib/hbqt/qtgui/TQDateTimeEdit.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQDesktopWidget.prg b/harbour/contrib/hbqt/qtgui/TQDesktopWidget.prg index 39e99a71db..1b42b541c7 100644 --- a/harbour/contrib/hbqt/qtgui/TQDesktopWidget.prg +++ b/harbour/contrib/hbqt/qtgui/TQDesktopWidget.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQDial.prg b/harbour/contrib/hbqt/qtgui/TQDial.prg index fd525e1357..9babcc87e7 100644 --- a/harbour/contrib/hbqt/qtgui/TQDial.prg +++ b/harbour/contrib/hbqt/qtgui/TQDial.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQDialog.prg b/harbour/contrib/hbqt/qtgui/TQDialog.prg index 42d6f08c9b..eec452aa44 100644 --- a/harbour/contrib/hbqt/qtgui/TQDialog.prg +++ b/harbour/contrib/hbqt/qtgui/TQDialog.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQDirModel.prg b/harbour/contrib/hbqt/qtgui/TQDirModel.prg index 6954b9b973..48d8116aca 100644 --- a/harbour/contrib/hbqt/qtgui/TQDirModel.prg +++ b/harbour/contrib/hbqt/qtgui/TQDirModel.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQDockWidget.prg b/harbour/contrib/hbqt/qtgui/TQDockWidget.prg index f4dd90aec6..4f307bb294 100644 --- a/harbour/contrib/hbqt/qtgui/TQDockWidget.prg +++ b/harbour/contrib/hbqt/qtgui/TQDockWidget.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQDoubleSpinBox.prg b/harbour/contrib/hbqt/qtgui/TQDoubleSpinBox.prg index dadf91e079..0df875c422 100644 --- a/harbour/contrib/hbqt/qtgui/TQDoubleSpinBox.prg +++ b/harbour/contrib/hbqt/qtgui/TQDoubleSpinBox.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQDragEnterEvent.prg b/harbour/contrib/hbqt/qtgui/TQDragEnterEvent.prg index 0fbc7f3dc5..6007f8b9f0 100644 --- a/harbour/contrib/hbqt/qtgui/TQDragEnterEvent.prg +++ b/harbour/contrib/hbqt/qtgui/TQDragEnterEvent.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQDragLeaveEvent.prg b/harbour/contrib/hbqt/qtgui/TQDragLeaveEvent.prg index a113140cde..26bba901b1 100644 --- a/harbour/contrib/hbqt/qtgui/TQDragLeaveEvent.prg +++ b/harbour/contrib/hbqt/qtgui/TQDragLeaveEvent.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQDragMoveEvent.prg b/harbour/contrib/hbqt/qtgui/TQDragMoveEvent.prg index fcaa23112d..0749259adb 100644 --- a/harbour/contrib/hbqt/qtgui/TQDragMoveEvent.prg +++ b/harbour/contrib/hbqt/qtgui/TQDragMoveEvent.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQDropEvent.prg b/harbour/contrib/hbqt/qtgui/TQDropEvent.prg index 0d8b9b97ea..7060cc5235 100644 --- a/harbour/contrib/hbqt/qtgui/TQDropEvent.prg +++ b/harbour/contrib/hbqt/qtgui/TQDropEvent.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -70,7 +70,6 @@ CREATE CLASS QDropEvent INHERIT HbQtObjectHandler, QEvent METHOD acceptProposedAction() METHOD dropAction() METHOD keyboardModifiers() - METHOD mimeData() METHOD mouseButtons() METHOD pos() METHOD possibleActions() @@ -102,10 +101,6 @@ METHOD QDropEvent:keyboardModifiers() RETURN Qt_QDropEvent_keyboardModifiers( ::pPtr ) -METHOD QDropEvent:mimeData() - RETURN Qt_QDropEvent_mimeData( ::pPtr ) - - METHOD QDropEvent:mouseButtons() RETURN Qt_QDropEvent_mouseButtons( ::pPtr ) diff --git a/harbour/contrib/hbqt/qtgui/TQErrorMessage.prg b/harbour/contrib/hbqt/qtgui/TQErrorMessage.prg index 8019357d45..fac4c77442 100644 --- a/harbour/contrib/hbqt/qtgui/TQErrorMessage.prg +++ b/harbour/contrib/hbqt/qtgui/TQErrorMessage.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQFileDialog.prg b/harbour/contrib/hbqt/qtgui/TQFileDialog.prg index 9158fd908f..ebbf797565 100644 --- a/harbour/contrib/hbqt/qtgui/TQFileDialog.prg +++ b/harbour/contrib/hbqt/qtgui/TQFileDialog.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQFileIconProvider.prg b/harbour/contrib/hbqt/qtgui/TQFileIconProvider.prg index a8b83ed811..f242eaef71 100644 --- a/harbour/contrib/hbqt/qtgui/TQFileIconProvider.prg +++ b/harbour/contrib/hbqt/qtgui/TQFileIconProvider.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQFileSystemModel.prg b/harbour/contrib/hbqt/qtgui/TQFileSystemModel.prg index 05b80f0302..d6f5b55df0 100644 --- a/harbour/contrib/hbqt/qtgui/TQFileSystemModel.prg +++ b/harbour/contrib/hbqt/qtgui/TQFileSystemModel.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQFocusEvent.prg b/harbour/contrib/hbqt/qtgui/TQFocusEvent.prg index d979431b49..1dfa513699 100644 --- a/harbour/contrib/hbqt/qtgui/TQFocusEvent.prg +++ b/harbour/contrib/hbqt/qtgui/TQFocusEvent.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQFocusFrame.prg b/harbour/contrib/hbqt/qtgui/TQFocusFrame.prg index 5f4ccfa812..e6745ef265 100644 --- a/harbour/contrib/hbqt/qtgui/TQFocusFrame.prg +++ b/harbour/contrib/hbqt/qtgui/TQFocusFrame.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQFont.prg b/harbour/contrib/hbqt/qtgui/TQFont.prg index 1f58a5ee63..7adaa77da6 100644 --- a/harbour/contrib/hbqt/qtgui/TQFont.prg +++ b/harbour/contrib/hbqt/qtgui/TQFont.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQFontComboBox.prg b/harbour/contrib/hbqt/qtgui/TQFontComboBox.prg index 2af61b24e8..4ab7d6f05c 100644 --- a/harbour/contrib/hbqt/qtgui/TQFontComboBox.prg +++ b/harbour/contrib/hbqt/qtgui/TQFontComboBox.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQFontDatabase.prg b/harbour/contrib/hbqt/qtgui/TQFontDatabase.prg index 2f7179d7fc..c37edbe4a9 100644 --- a/harbour/contrib/hbqt/qtgui/TQFontDatabase.prg +++ b/harbour/contrib/hbqt/qtgui/TQFontDatabase.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQFontDialog.prg b/harbour/contrib/hbqt/qtgui/TQFontDialog.prg index 7417333829..9f03e6ca5b 100644 --- a/harbour/contrib/hbqt/qtgui/TQFontDialog.prg +++ b/harbour/contrib/hbqt/qtgui/TQFontDialog.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQFontInfo.prg b/harbour/contrib/hbqt/qtgui/TQFontInfo.prg index b4bf8e48b0..28c4cf06fa 100644 --- a/harbour/contrib/hbqt/qtgui/TQFontInfo.prg +++ b/harbour/contrib/hbqt/qtgui/TQFontInfo.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQFontMetrics.prg b/harbour/contrib/hbqt/qtgui/TQFontMetrics.prg index d7e2b42f81..d605838986 100644 --- a/harbour/contrib/hbqt/qtgui/TQFontMetrics.prg +++ b/harbour/contrib/hbqt/qtgui/TQFontMetrics.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQFontMetricsF.prg b/harbour/contrib/hbqt/qtgui/TQFontMetricsF.prg index 4f51edf37e..542cebe903 100644 --- a/harbour/contrib/hbqt/qtgui/TQFontMetricsF.prg +++ b/harbour/contrib/hbqt/qtgui/TQFontMetricsF.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQFormLayout.prg b/harbour/contrib/hbqt/qtgui/TQFormLayout.prg index e9a5d0219a..85690ecd6a 100644 --- a/harbour/contrib/hbqt/qtgui/TQFormLayout.prg +++ b/harbour/contrib/hbqt/qtgui/TQFormLayout.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQFrame.prg b/harbour/contrib/hbqt/qtgui/TQFrame.prg index 15160af6f7..42793ef838 100644 --- a/harbour/contrib/hbqt/qtgui/TQFrame.prg +++ b/harbour/contrib/hbqt/qtgui/TQFrame.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQGradient.prg b/harbour/contrib/hbqt/qtgui/TQGradient.prg index 9e92e901b9..bec0ab8b48 100644 --- a/harbour/contrib/hbqt/qtgui/TQGradient.prg +++ b/harbour/contrib/hbqt/qtgui/TQGradient.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQGridLayout.prg b/harbour/contrib/hbqt/qtgui/TQGridLayout.prg index 15b9171fc0..40b73a2d00 100644 --- a/harbour/contrib/hbqt/qtgui/TQGridLayout.prg +++ b/harbour/contrib/hbqt/qtgui/TQGridLayout.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQGroupBox.prg b/harbour/contrib/hbqt/qtgui/TQGroupBox.prg index 408a1fd836..25b9072a8a 100644 --- a/harbour/contrib/hbqt/qtgui/TQGroupBox.prg +++ b/harbour/contrib/hbqt/qtgui/TQGroupBox.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQHBoxLayout.prg b/harbour/contrib/hbqt/qtgui/TQHBoxLayout.prg index 9026d88e10..250958d471 100644 --- a/harbour/contrib/hbqt/qtgui/TQHBoxLayout.prg +++ b/harbour/contrib/hbqt/qtgui/TQHBoxLayout.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQHeaderView.prg b/harbour/contrib/hbqt/qtgui/TQHeaderView.prg index 39fc2bd063..535fcb0059 100644 --- a/harbour/contrib/hbqt/qtgui/TQHeaderView.prg +++ b/harbour/contrib/hbqt/qtgui/TQHeaderView.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQHelpEvent.prg b/harbour/contrib/hbqt/qtgui/TQHelpEvent.prg index 7b130ae7d5..c5392010ca 100644 --- a/harbour/contrib/hbqt/qtgui/TQHelpEvent.prg +++ b/harbour/contrib/hbqt/qtgui/TQHelpEvent.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQIcon.prg b/harbour/contrib/hbqt/qtgui/TQIcon.prg index 71881190d8..941c46fa43 100644 --- a/harbour/contrib/hbqt/qtgui/TQIcon.prg +++ b/harbour/contrib/hbqt/qtgui/TQIcon.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQImage.prg b/harbour/contrib/hbqt/qtgui/TQImage.prg index cb50b7790b..6905805452 100644 --- a/harbour/contrib/hbqt/qtgui/TQImage.prg +++ b/harbour/contrib/hbqt/qtgui/TQImage.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQImageReader.prg b/harbour/contrib/hbqt/qtgui/TQImageReader.prg index 2a618a15bd..ec24f307f5 100644 --- a/harbour/contrib/hbqt/qtgui/TQImageReader.prg +++ b/harbour/contrib/hbqt/qtgui/TQImageReader.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQImageWriter.prg b/harbour/contrib/hbqt/qtgui/TQImageWriter.prg index 85fa5004a2..c45929b966 100644 --- a/harbour/contrib/hbqt/qtgui/TQImageWriter.prg +++ b/harbour/contrib/hbqt/qtgui/TQImageWriter.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQInputContext.prg b/harbour/contrib/hbqt/qtgui/TQInputContext.prg index befe0d1b10..b1d4ec57b7 100644 --- a/harbour/contrib/hbqt/qtgui/TQInputContext.prg +++ b/harbour/contrib/hbqt/qtgui/TQInputContext.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQInputDialog.prg b/harbour/contrib/hbqt/qtgui/TQInputDialog.prg index a4bc5fd97d..f06dcf57fb 100644 --- a/harbour/contrib/hbqt/qtgui/TQInputDialog.prg +++ b/harbour/contrib/hbqt/qtgui/TQInputDialog.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQInputEvent.prg b/harbour/contrib/hbqt/qtgui/TQInputEvent.prg index 2c53b7545d..b90769ac1d 100644 --- a/harbour/contrib/hbqt/qtgui/TQInputEvent.prg +++ b/harbour/contrib/hbqt/qtgui/TQInputEvent.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQInputMethodEvent.prg b/harbour/contrib/hbqt/qtgui/TQInputMethodEvent.prg index 793c49057b..64cbb2c0b3 100644 --- a/harbour/contrib/hbqt/qtgui/TQInputMethodEvent.prg +++ b/harbour/contrib/hbqt/qtgui/TQInputMethodEvent.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQItemSelection.prg b/harbour/contrib/hbqt/qtgui/TQItemSelection.prg index 2ac44b2390..0c385fb9e0 100644 --- a/harbour/contrib/hbqt/qtgui/TQItemSelection.prg +++ b/harbour/contrib/hbqt/qtgui/TQItemSelection.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQItemSelectionModel.prg b/harbour/contrib/hbqt/qtgui/TQItemSelectionModel.prg index c731509f55..ef6c57b46a 100644 --- a/harbour/contrib/hbqt/qtgui/TQItemSelectionModel.prg +++ b/harbour/contrib/hbqt/qtgui/TQItemSelectionModel.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQKeyEvent.prg b/harbour/contrib/hbqt/qtgui/TQKeyEvent.prg index b7123cfa86..3a89ec3fbc 100644 --- a/harbour/contrib/hbqt/qtgui/TQKeyEvent.prg +++ b/harbour/contrib/hbqt/qtgui/TQKeyEvent.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQKeySequence.prg b/harbour/contrib/hbqt/qtgui/TQKeySequence.prg index 86649970e5..493aab6654 100644 --- a/harbour/contrib/hbqt/qtgui/TQKeySequence.prg +++ b/harbour/contrib/hbqt/qtgui/TQKeySequence.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQLCDNumber.prg b/harbour/contrib/hbqt/qtgui/TQLCDNumber.prg index 006d5863f1..3b75272382 100644 --- a/harbour/contrib/hbqt/qtgui/TQLCDNumber.prg +++ b/harbour/contrib/hbqt/qtgui/TQLCDNumber.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQLabel.prg b/harbour/contrib/hbqt/qtgui/TQLabel.prg index 1238947713..8c08f4ef39 100644 --- a/harbour/contrib/hbqt/qtgui/TQLabel.prg +++ b/harbour/contrib/hbqt/qtgui/TQLabel.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQLayout.prg b/harbour/contrib/hbqt/qtgui/TQLayout.prg index 436c25ef70..53abfa28ff 100644 --- a/harbour/contrib/hbqt/qtgui/TQLayout.prg +++ b/harbour/contrib/hbqt/qtgui/TQLayout.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQLayoutItem.prg b/harbour/contrib/hbqt/qtgui/TQLayoutItem.prg index 0b3d5195db..03dc413eac 100644 --- a/harbour/contrib/hbqt/qtgui/TQLayoutItem.prg +++ b/harbour/contrib/hbqt/qtgui/TQLayoutItem.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQLineEdit.prg b/harbour/contrib/hbqt/qtgui/TQLineEdit.prg index 8f90efe6d9..ef507afae5 100644 --- a/harbour/contrib/hbqt/qtgui/TQLineEdit.prg +++ b/harbour/contrib/hbqt/qtgui/TQLineEdit.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQLinearGradient.prg b/harbour/contrib/hbqt/qtgui/TQLinearGradient.prg index 92d01369bc..f659aec79f 100644 --- a/harbour/contrib/hbqt/qtgui/TQLinearGradient.prg +++ b/harbour/contrib/hbqt/qtgui/TQLinearGradient.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQListView.prg b/harbour/contrib/hbqt/qtgui/TQListView.prg index aee1a05c12..0c23d8379e 100644 --- a/harbour/contrib/hbqt/qtgui/TQListView.prg +++ b/harbour/contrib/hbqt/qtgui/TQListView.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQListWidget.prg b/harbour/contrib/hbqt/qtgui/TQListWidget.prg index 36c03aea05..62f7d0c2b6 100644 --- a/harbour/contrib/hbqt/qtgui/TQListWidget.prg +++ b/harbour/contrib/hbqt/qtgui/TQListWidget.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQListWidgetItem.prg b/harbour/contrib/hbqt/qtgui/TQListWidgetItem.prg index f315ab0378..1c13d2a60c 100644 --- a/harbour/contrib/hbqt/qtgui/TQListWidgetItem.prg +++ b/harbour/contrib/hbqt/qtgui/TQListWidgetItem.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQMainWindow.prg b/harbour/contrib/hbqt/qtgui/TQMainWindow.prg index b4985ae08a..5714ec9fda 100644 --- a/harbour/contrib/hbqt/qtgui/TQMainWindow.prg +++ b/harbour/contrib/hbqt/qtgui/TQMainWindow.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQMatrix.prg b/harbour/contrib/hbqt/qtgui/TQMatrix.prg index 7e41ee0214..6c9ccf4908 100644 --- a/harbour/contrib/hbqt/qtgui/TQMatrix.prg +++ b/harbour/contrib/hbqt/qtgui/TQMatrix.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQMdiArea.prg b/harbour/contrib/hbqt/qtgui/TQMdiArea.prg index 92d6700ac9..524cc12a87 100644 --- a/harbour/contrib/hbqt/qtgui/TQMdiArea.prg +++ b/harbour/contrib/hbqt/qtgui/TQMdiArea.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQMdiSubWindow.prg b/harbour/contrib/hbqt/qtgui/TQMdiSubWindow.prg index 0e550ff0fa..0194ab2f44 100644 --- a/harbour/contrib/hbqt/qtgui/TQMdiSubWindow.prg +++ b/harbour/contrib/hbqt/qtgui/TQMdiSubWindow.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQMenu.prg b/harbour/contrib/hbqt/qtgui/TQMenu.prg index da8fc617ff..4069abb812 100644 --- a/harbour/contrib/hbqt/qtgui/TQMenu.prg +++ b/harbour/contrib/hbqt/qtgui/TQMenu.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQMenuBar.prg b/harbour/contrib/hbqt/qtgui/TQMenuBar.prg index 9026727731..580828c0ea 100644 --- a/harbour/contrib/hbqt/qtgui/TQMenuBar.prg +++ b/harbour/contrib/hbqt/qtgui/TQMenuBar.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQMessageBox.prg b/harbour/contrib/hbqt/qtgui/TQMessageBox.prg index d77cf2ad97..a799a23c30 100644 --- a/harbour/contrib/hbqt/qtgui/TQMessageBox.prg +++ b/harbour/contrib/hbqt/qtgui/TQMessageBox.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQMouseEvent.prg b/harbour/contrib/hbqt/qtgui/TQMouseEvent.prg index e1298cd29f..b7bdd552af 100644 --- a/harbour/contrib/hbqt/qtgui/TQMouseEvent.prg +++ b/harbour/contrib/hbqt/qtgui/TQMouseEvent.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQMoveEvent.prg b/harbour/contrib/hbqt/qtgui/TQMoveEvent.prg index e1a9d9dafe..deb634409f 100644 --- a/harbour/contrib/hbqt/qtgui/TQMoveEvent.prg +++ b/harbour/contrib/hbqt/qtgui/TQMoveEvent.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQMovie.prg b/harbour/contrib/hbqt/qtgui/TQMovie.prg index 26c590cdb9..cb20543612 100644 --- a/harbour/contrib/hbqt/qtgui/TQMovie.prg +++ b/harbour/contrib/hbqt/qtgui/TQMovie.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQPageSetupDialog.prg b/harbour/contrib/hbqt/qtgui/TQPageSetupDialog.prg index d1cb08e764..3aa0728e1c 100644 --- a/harbour/contrib/hbqt/qtgui/TQPageSetupDialog.prg +++ b/harbour/contrib/hbqt/qtgui/TQPageSetupDialog.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQPaintDevice.prg b/harbour/contrib/hbqt/qtgui/TQPaintDevice.prg index 11775eda7a..0a7f224555 100644 --- a/harbour/contrib/hbqt/qtgui/TQPaintDevice.prg +++ b/harbour/contrib/hbqt/qtgui/TQPaintDevice.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQPaintEngine.prg b/harbour/contrib/hbqt/qtgui/TQPaintEngine.prg new file mode 100644 index 0000000000..0102a14bd3 --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/TQPaintEngine.prg @@ -0,0 +1,201 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009-2010 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ + + +#include "hbclass.ch" + + +CREATE CLASS QPaintEngine INHERIT HbQtObjectHandler + + METHOD new( ... ) + + METHOD begin( pPdev ) + METHOD drawEllipse( pRect ) + METHOD drawEllipse_1( pRect ) + METHOD drawImage( pRectangle, pImage, pSr, nFlags ) + METHOD drawLines( pLines, nLineCount ) + METHOD drawLines_1( pLines, nLineCount ) + METHOD drawPath( pPath ) + METHOD drawPixmap( pR, pPm, pSr ) + METHOD drawPoints( pPoints, nPointCount ) + METHOD drawPoints_1( pPoints, nPointCount ) + METHOD drawPolygon( pPoints, nPointCount, nMode ) + METHOD drawPolygon_1( pPoints, nPointCount, nMode ) + METHOD drawRects( pRects, nRectCount ) + METHOD drawRects_1( pRects, nRectCount ) + METHOD drawTextItem( pP, pTextItem ) + METHOD drawTiledPixmap( pRect, pPixmap, pP ) + METHOD end() + METHOD hasFeature( nFeature ) + METHOD isActive() + METHOD paintDevice() + METHOD painter() + METHOD setActive( lState ) + METHOD type() + METHOD updateState( pState ) + + ENDCLASS + + +METHOD QPaintEngine:new( ... ) + LOCAL p + FOR EACH p IN { ... } + hb_pvalue( p:__enumIndex(), hbqt_ptr( p ) ) + NEXT + ::pPtr := Qt_QPaintEngine( ... ) + RETURN Self + + +METHOD QPaintEngine:begin( pPdev ) + RETURN Qt_QPaintEngine_begin( ::pPtr, hbqt_ptr( pPdev ) ) + + +METHOD QPaintEngine:drawEllipse( pRect ) + RETURN Qt_QPaintEngine_drawEllipse( ::pPtr, hbqt_ptr( pRect ) ) + + +METHOD QPaintEngine:drawEllipse_1( pRect ) + RETURN Qt_QPaintEngine_drawEllipse_1( ::pPtr, hbqt_ptr( pRect ) ) + + +METHOD QPaintEngine:drawImage( pRectangle, pImage, pSr, nFlags ) + RETURN Qt_QPaintEngine_drawImage( ::pPtr, hbqt_ptr( pRectangle ), hbqt_ptr( pImage ), hbqt_ptr( pSr ), nFlags ) + + +METHOD QPaintEngine:drawLines( pLines, nLineCount ) + RETURN Qt_QPaintEngine_drawLines( ::pPtr, hbqt_ptr( pLines ), nLineCount ) + + +METHOD QPaintEngine:drawLines_1( pLines, nLineCount ) + RETURN Qt_QPaintEngine_drawLines_1( ::pPtr, hbqt_ptr( pLines ), nLineCount ) + + +METHOD QPaintEngine:drawPath( pPath ) + RETURN Qt_QPaintEngine_drawPath( ::pPtr, hbqt_ptr( pPath ) ) + + +METHOD QPaintEngine:drawPixmap( pR, pPm, pSr ) + RETURN Qt_QPaintEngine_drawPixmap( ::pPtr, hbqt_ptr( pR ), hbqt_ptr( pPm ), hbqt_ptr( pSr ) ) + + +METHOD QPaintEngine:drawPoints( pPoints, nPointCount ) + RETURN Qt_QPaintEngine_drawPoints( ::pPtr, hbqt_ptr( pPoints ), nPointCount ) + + +METHOD QPaintEngine:drawPoints_1( pPoints, nPointCount ) + RETURN Qt_QPaintEngine_drawPoints_1( ::pPtr, hbqt_ptr( pPoints ), nPointCount ) + + +METHOD QPaintEngine:drawPolygon( pPoints, nPointCount, nMode ) + RETURN Qt_QPaintEngine_drawPolygon( ::pPtr, hbqt_ptr( pPoints ), nPointCount, nMode ) + + +METHOD QPaintEngine:drawPolygon_1( pPoints, nPointCount, nMode ) + RETURN Qt_QPaintEngine_drawPolygon_1( ::pPtr, hbqt_ptr( pPoints ), nPointCount, nMode ) + + +METHOD QPaintEngine:drawRects( pRects, nRectCount ) + RETURN Qt_QPaintEngine_drawRects( ::pPtr, hbqt_ptr( pRects ), nRectCount ) + + +METHOD QPaintEngine:drawRects_1( pRects, nRectCount ) + RETURN Qt_QPaintEngine_drawRects_1( ::pPtr, hbqt_ptr( pRects ), nRectCount ) + + +METHOD QPaintEngine:drawTextItem( pP, pTextItem ) + RETURN Qt_QPaintEngine_drawTextItem( ::pPtr, hbqt_ptr( pP ), hbqt_ptr( pTextItem ) ) + + +METHOD QPaintEngine:drawTiledPixmap( pRect, pPixmap, pP ) + RETURN Qt_QPaintEngine_drawTiledPixmap( ::pPtr, hbqt_ptr( pRect ), hbqt_ptr( pPixmap ), hbqt_ptr( pP ) ) + + +METHOD QPaintEngine:end() + RETURN Qt_QPaintEngine_end( ::pPtr ) + + +METHOD QPaintEngine:hasFeature( nFeature ) + RETURN Qt_QPaintEngine_hasFeature( ::pPtr, nFeature ) + + +METHOD QPaintEngine:isActive() + RETURN Qt_QPaintEngine_isActive( ::pPtr ) + + +METHOD QPaintEngine:paintDevice() + RETURN Qt_QPaintEngine_paintDevice( ::pPtr ) + + +METHOD QPaintEngine:painter() + RETURN Qt_QPaintEngine_painter( ::pPtr ) + + +METHOD QPaintEngine:setActive( lState ) + RETURN Qt_QPaintEngine_setActive( ::pPtr, lState ) + + +METHOD QPaintEngine:type() + RETURN Qt_QPaintEngine_type( ::pPtr ) + + +METHOD QPaintEngine:updateState( pState ) + RETURN Qt_QPaintEngine_updateState( ::pPtr, hbqt_ptr( pState ) ) + diff --git a/harbour/contrib/hbqt/qtgui/TQPaintEvent.prg b/harbour/contrib/hbqt/qtgui/TQPaintEvent.prg index f7114a5818..a511786e3d 100644 --- a/harbour/contrib/hbqt/qtgui/TQPaintEvent.prg +++ b/harbour/contrib/hbqt/qtgui/TQPaintEvent.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQPainter.prg b/harbour/contrib/hbqt/qtgui/TQPainter.prg index 9536e33282..445eb1655a 100644 --- a/harbour/contrib/hbqt/qtgui/TQPainter.prg +++ b/harbour/contrib/hbqt/qtgui/TQPainter.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQPainterPath.prg b/harbour/contrib/hbqt/qtgui/TQPainterPath.prg index e386446d2b..9bc952204b 100644 --- a/harbour/contrib/hbqt/qtgui/TQPainterPath.prg +++ b/harbour/contrib/hbqt/qtgui/TQPainterPath.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQPalette.prg b/harbour/contrib/hbqt/qtgui/TQPalette.prg index 11fd9770c6..ae319f2d64 100644 --- a/harbour/contrib/hbqt/qtgui/TQPalette.prg +++ b/harbour/contrib/hbqt/qtgui/TQPalette.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQPen.prg b/harbour/contrib/hbqt/qtgui/TQPen.prg index 2608ce4903..6147bada8f 100644 --- a/harbour/contrib/hbqt/qtgui/TQPen.prg +++ b/harbour/contrib/hbqt/qtgui/TQPen.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQPicture.prg b/harbour/contrib/hbqt/qtgui/TQPicture.prg index dbd8c8f0ad..14c67aaa41 100644 --- a/harbour/contrib/hbqt/qtgui/TQPicture.prg +++ b/harbour/contrib/hbqt/qtgui/TQPicture.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQPixmap.prg b/harbour/contrib/hbqt/qtgui/TQPixmap.prg index a3014225e9..5c2395c530 100644 --- a/harbour/contrib/hbqt/qtgui/TQPixmap.prg +++ b/harbour/contrib/hbqt/qtgui/TQPixmap.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQPlainTextEdit.prg b/harbour/contrib/hbqt/qtgui/TQPlainTextEdit.prg index ca48bd85f9..1236583524 100644 --- a/harbour/contrib/hbqt/qtgui/TQPlainTextEdit.prg +++ b/harbour/contrib/hbqt/qtgui/TQPlainTextEdit.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQPolygon.prg b/harbour/contrib/hbqt/qtgui/TQPolygon.prg index 4f63937476..a5d540ed91 100644 --- a/harbour/contrib/hbqt/qtgui/TQPolygon.prg +++ b/harbour/contrib/hbqt/qtgui/TQPolygon.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQPolygonF.prg b/harbour/contrib/hbqt/qtgui/TQPolygonF.prg index 0ae5604ace..60ab58ca23 100644 --- a/harbour/contrib/hbqt/qtgui/TQPolygonF.prg +++ b/harbour/contrib/hbqt/qtgui/TQPolygonF.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQPrintDialog.prg b/harbour/contrib/hbqt/qtgui/TQPrintDialog.prg index cd4efcd486..05d141c6d4 100644 --- a/harbour/contrib/hbqt/qtgui/TQPrintDialog.prg +++ b/harbour/contrib/hbqt/qtgui/TQPrintDialog.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQPrintEngine.prg b/harbour/contrib/hbqt/qtgui/TQPrintEngine.prg index 4b0724803a..f70389dbec 100644 --- a/harbour/contrib/hbqt/qtgui/TQPrintEngine.prg +++ b/harbour/contrib/hbqt/qtgui/TQPrintEngine.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQPrintPreviewDialog.prg b/harbour/contrib/hbqt/qtgui/TQPrintPreviewDialog.prg index 1bfed17d84..6c85f2ddae 100644 --- a/harbour/contrib/hbqt/qtgui/TQPrintPreviewDialog.prg +++ b/harbour/contrib/hbqt/qtgui/TQPrintPreviewDialog.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQPrinter.prg b/harbour/contrib/hbqt/qtgui/TQPrinter.prg index 00a6729526..fedc8f7073 100644 --- a/harbour/contrib/hbqt/qtgui/TQPrinter.prg +++ b/harbour/contrib/hbqt/qtgui/TQPrinter.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQProgressBar.prg b/harbour/contrib/hbqt/qtgui/TQProgressBar.prg index ff5089750e..8dffda97e1 100644 --- a/harbour/contrib/hbqt/qtgui/TQProgressBar.prg +++ b/harbour/contrib/hbqt/qtgui/TQProgressBar.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQProgressDialog.prg b/harbour/contrib/hbqt/qtgui/TQProgressDialog.prg index e1e83d6b39..70f6beafbb 100644 --- a/harbour/contrib/hbqt/qtgui/TQProgressDialog.prg +++ b/harbour/contrib/hbqt/qtgui/TQProgressDialog.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQPushButton.prg b/harbour/contrib/hbqt/qtgui/TQPushButton.prg index c130022815..6b6566e84f 100644 --- a/harbour/contrib/hbqt/qtgui/TQPushButton.prg +++ b/harbour/contrib/hbqt/qtgui/TQPushButton.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQRadialGradient.prg b/harbour/contrib/hbqt/qtgui/TQRadialGradient.prg index a423d379e3..042b402205 100644 --- a/harbour/contrib/hbqt/qtgui/TQRadialGradient.prg +++ b/harbour/contrib/hbqt/qtgui/TQRadialGradient.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQRadioButton.prg b/harbour/contrib/hbqt/qtgui/TQRadioButton.prg index 709d9f4855..2babc0f015 100644 --- a/harbour/contrib/hbqt/qtgui/TQRadioButton.prg +++ b/harbour/contrib/hbqt/qtgui/TQRadioButton.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQRegion.prg b/harbour/contrib/hbqt/qtgui/TQRegion.prg index 255cdb75fd..e5c3928a1a 100644 --- a/harbour/contrib/hbqt/qtgui/TQRegion.prg +++ b/harbour/contrib/hbqt/qtgui/TQRegion.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQResizeEvent.prg b/harbour/contrib/hbqt/qtgui/TQResizeEvent.prg index cf0c481280..32b54e78cd 100644 --- a/harbour/contrib/hbqt/qtgui/TQResizeEvent.prg +++ b/harbour/contrib/hbqt/qtgui/TQResizeEvent.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQScrollArea.prg b/harbour/contrib/hbqt/qtgui/TQScrollArea.prg index e3556eaa27..b74053e00d 100644 --- a/harbour/contrib/hbqt/qtgui/TQScrollArea.prg +++ b/harbour/contrib/hbqt/qtgui/TQScrollArea.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQScrollBar.prg b/harbour/contrib/hbqt/qtgui/TQScrollBar.prg index 2eae8a8df8..88ef9a6483 100644 --- a/harbour/contrib/hbqt/qtgui/TQScrollBar.prg +++ b/harbour/contrib/hbqt/qtgui/TQScrollBar.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQSessionManager.prg b/harbour/contrib/hbqt/qtgui/TQSessionManager.prg index b22a292626..2b97658dec 100644 --- a/harbour/contrib/hbqt/qtgui/TQSessionManager.prg +++ b/harbour/contrib/hbqt/qtgui/TQSessionManager.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQSizeGrip.prg b/harbour/contrib/hbqt/qtgui/TQSizeGrip.prg index 192b6743c7..d741fffb55 100644 --- a/harbour/contrib/hbqt/qtgui/TQSizeGrip.prg +++ b/harbour/contrib/hbqt/qtgui/TQSizeGrip.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQSizePolicy.prg b/harbour/contrib/hbqt/qtgui/TQSizePolicy.prg index 929b702f53..42059af721 100644 --- a/harbour/contrib/hbqt/qtgui/TQSizePolicy.prg +++ b/harbour/contrib/hbqt/qtgui/TQSizePolicy.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQSlider.prg b/harbour/contrib/hbqt/qtgui/TQSlider.prg index 60864bed66..cd48f0aba9 100644 --- a/harbour/contrib/hbqt/qtgui/TQSlider.prg +++ b/harbour/contrib/hbqt/qtgui/TQSlider.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQSound.prg b/harbour/contrib/hbqt/qtgui/TQSound.prg index 4d353527ba..188f5aa7cf 100644 --- a/harbour/contrib/hbqt/qtgui/TQSound.prg +++ b/harbour/contrib/hbqt/qtgui/TQSound.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQSpacerItem.prg b/harbour/contrib/hbqt/qtgui/TQSpacerItem.prg index eb9a840f03..4ff490301d 100644 --- a/harbour/contrib/hbqt/qtgui/TQSpacerItem.prg +++ b/harbour/contrib/hbqt/qtgui/TQSpacerItem.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQSpinBox.prg b/harbour/contrib/hbqt/qtgui/TQSpinBox.prg index 489a041202..15c9a300e4 100644 --- a/harbour/contrib/hbqt/qtgui/TQSpinBox.prg +++ b/harbour/contrib/hbqt/qtgui/TQSpinBox.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQSplashScreen.prg b/harbour/contrib/hbqt/qtgui/TQSplashScreen.prg index d9f470773a..61a99845b9 100644 --- a/harbour/contrib/hbqt/qtgui/TQSplashScreen.prg +++ b/harbour/contrib/hbqt/qtgui/TQSplashScreen.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQSplitter.prg b/harbour/contrib/hbqt/qtgui/TQSplitter.prg index 56def69e3c..647b24d307 100644 --- a/harbour/contrib/hbqt/qtgui/TQSplitter.prg +++ b/harbour/contrib/hbqt/qtgui/TQSplitter.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -71,7 +71,6 @@ CREATE CLASS QSplitter INHERIT HbQtObjectHandler, QFrame METHOD childrenCollapsible() METHOD count() METHOD getRange( nIndex, nMin, nMax ) - METHOD handle( nIndex ) METHOD handleWidth() METHOD indexOf( pWidget ) METHOD insertWidget( nIndex, pWidget ) @@ -117,10 +116,6 @@ METHOD QSplitter:getRange( nIndex, nMin, nMax ) RETURN Qt_QSplitter_getRange( ::pPtr, nIndex, nMin, nMax ) -METHOD QSplitter:handle( nIndex ) - RETURN Qt_QSplitter_handle( ::pPtr, nIndex ) - - METHOD QSplitter:handleWidth() RETURN Qt_QSplitter_handleWidth( ::pPtr ) diff --git a/harbour/contrib/hbqt/qtgui/TQStandardItem.prg b/harbour/contrib/hbqt/qtgui/TQStandardItem.prg index fc85f6e97c..36e504885f 100644 --- a/harbour/contrib/hbqt/qtgui/TQStandardItem.prg +++ b/harbour/contrib/hbqt/qtgui/TQStandardItem.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStandardItemModel.prg b/harbour/contrib/hbqt/qtgui/TQStandardItemModel.prg index 2ce2df2184..ee6fa8221d 100644 --- a/harbour/contrib/hbqt/qtgui/TQStandardItemModel.prg +++ b/harbour/contrib/hbqt/qtgui/TQStandardItemModel.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -77,7 +77,6 @@ CREATE CLASS QStandardItemModel INHERIT HbQtObjectHandler, QAbstractItemModeL METHOD invisibleRootItem() METHOD item( nRow, nColumn ) METHOD itemFromIndex( pIndex ) - METHOD itemPrototype() METHOD setColumnCount( nColumns ) METHOD setHorizontalHeaderItem( nColumn, pItem ) METHOD setHorizontalHeaderLabels( pLabels ) @@ -146,10 +145,6 @@ METHOD QStandardItemModel:itemFromIndex( pIndex ) RETURN Qt_QStandardItemModel_itemFromIndex( ::pPtr, hbqt_ptr( pIndex ) ) -METHOD QStandardItemModel:itemPrototype() - RETURN Qt_QStandardItemModel_itemPrototype( ::pPtr ) - - METHOD QStandardItemModel:setColumnCount( nColumns ) RETURN Qt_QStandardItemModel_setColumnCount( ::pPtr, nColumns ) diff --git a/harbour/contrib/hbqt/qtgui/TQStatusBar.prg b/harbour/contrib/hbqt/qtgui/TQStatusBar.prg index 94994222bb..bbea4477c6 100644 --- a/harbour/contrib/hbqt/qtgui/TQStatusBar.prg +++ b/harbour/contrib/hbqt/qtgui/TQStatusBar.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStringListModel.prg b/harbour/contrib/hbqt/qtgui/TQStringListModel.prg index 316f3b3dfd..0dd3ed78c9 100644 --- a/harbour/contrib/hbqt/qtgui/TQStringListModel.prg +++ b/harbour/contrib/hbqt/qtgui/TQStringListModel.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyle.prg b/harbour/contrib/hbqt/qtgui/TQStyle.prg index ecff436212..3d94a7932c 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyle.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyle.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleFactory.prg b/harbour/contrib/hbqt/qtgui/TQStyleFactory.prg index c924f634ee..7d78f120e1 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleFactory.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleFactory.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleHintReturn.prg b/harbour/contrib/hbqt/qtgui/TQStyleHintReturn.prg index f4ab4a2af9..6ebc341fa4 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleHintReturn.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleHintReturn.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleHintReturnMask.prg b/harbour/contrib/hbqt/qtgui/TQStyleHintReturnMask.prg index ca668eb928..b2a8757320 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleHintReturnMask.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleHintReturnMask.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleHintReturnVariant.prg b/harbour/contrib/hbqt/qtgui/TQStyleHintReturnVariant.prg index 24c4596720..cd31377780 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleHintReturnVariant.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleHintReturnVariant.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOption.prg b/harbour/contrib/hbqt/qtgui/TQStyleOption.prg index 684b92f84e..dd18a40585 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOption.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOption.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionButton.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionButton.prg index 69f8bd0df6..ad33f71188 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionButton.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionButton.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionComboBox.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionComboBox.prg index 71bd89447f..ead5bdf2b2 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionComboBox.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionComboBox.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionComplex.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionComplex.prg index 4ed820914f..c63fc4bf07 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionComplex.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionComplex.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionDockWidget.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionDockWidget.prg index 73f14fa0ed..0c6bfba709 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionDockWidget.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionDockWidget.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionFocusRect.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionFocusRect.prg index 5dac1f9c46..2e278a8132 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionFocusRect.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionFocusRect.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionFrame.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionFrame.prg index efeb3d9426..efb8214e72 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionFrame.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionFrame.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionGroupBox.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionGroupBox.prg index fc1f3bc04c..77674f9eb6 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionGroupBox.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionGroupBox.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionHeader.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionHeader.prg index 8432f476b8..b98296a58f 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionHeader.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionHeader.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionMenuItem.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionMenuItem.prg index 44a6ceb908..3a7d235bc0 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionMenuItem.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionMenuItem.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionProgressBar.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionProgressBar.prg index b236cbe1ab..1b56737cc2 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionProgressBar.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionProgressBar.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionSizeGrip.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionSizeGrip.prg index f54f41b0eb..5cf235d65b 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionSizeGrip.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionSizeGrip.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionSlider.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionSlider.prg index 547d2c7d11..a94a25e007 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionSlider.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionSlider.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionSpinBox.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionSpinBox.prg index 66421fbfa9..e148005b1b 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionSpinBox.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionSpinBox.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionTab.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionTab.prg index 7289882027..a55e8910bc 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionTab.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionTab.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionTabBarBase.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionTabBarBase.prg index 6267170952..481a1f0d50 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionTabBarBase.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionTabBarBase.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionTabWidgetFrame.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionTabWidgetFrame.prg index eb7e2efe57..68cfaa8b17 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionTabWidgetFrame.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionTabWidgetFrame.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionTitleBar.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionTitleBar.prg index 96c3d00c51..b9e7ef684d 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionTitleBar.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionTitleBar.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionToolBar.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionToolBar.prg index 27378d1061..41b9209d4b 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionToolBar.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionToolBar.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionToolBox.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionToolBox.prg index 606c6f72a1..7d39820659 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionToolBox.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionToolBox.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionToolButton.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionToolButton.prg index ed0dc6d62e..49af98a39a 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionToolButton.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionToolButton.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyleOptionViewItem.prg b/harbour/contrib/hbqt/qtgui/TQStyleOptionViewItem.prg index 1eb186a327..02803fa594 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyleOptionViewItem.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyleOptionViewItem.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStylePainter.prg b/harbour/contrib/hbqt/qtgui/TQStylePainter.prg index d832155a4b..9229b7298b 100644 --- a/harbour/contrib/hbqt/qtgui/TQStylePainter.prg +++ b/harbour/contrib/hbqt/qtgui/TQStylePainter.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQStyledItemDelegate.prg b/harbour/contrib/hbqt/qtgui/TQStyledItemDelegate.prg index 622229682c..8103996233 100644 --- a/harbour/contrib/hbqt/qtgui/TQStyledItemDelegate.prg +++ b/harbour/contrib/hbqt/qtgui/TQStyledItemDelegate.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQSyntaxHighlighter.prg b/harbour/contrib/hbqt/qtgui/TQSyntaxHighlighter.prg index 19203926e7..d073528d9b 100644 --- a/harbour/contrib/hbqt/qtgui/TQSyntaxHighlighter.prg +++ b/harbour/contrib/hbqt/qtgui/TQSyntaxHighlighter.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQSystemTrayIcon.prg b/harbour/contrib/hbqt/qtgui/TQSystemTrayIcon.prg index 3ab9477365..82973ae8fb 100644 --- a/harbour/contrib/hbqt/qtgui/TQSystemTrayIcon.prg +++ b/harbour/contrib/hbqt/qtgui/TQSystemTrayIcon.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTabBar.prg b/harbour/contrib/hbqt/qtgui/TQTabBar.prg index 50e3891ac7..f58c26706d 100644 --- a/harbour/contrib/hbqt/qtgui/TQTabBar.prg +++ b/harbour/contrib/hbqt/qtgui/TQTabBar.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTabWidget.prg b/harbour/contrib/hbqt/qtgui/TQTabWidget.prg index d0a3d4bf8f..1c709d9577 100644 --- a/harbour/contrib/hbqt/qtgui/TQTabWidget.prg +++ b/harbour/contrib/hbqt/qtgui/TQTabWidget.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTableView.prg b/harbour/contrib/hbqt/qtgui/TQTableView.prg index 3d02b87d1d..724aa6db82 100644 --- a/harbour/contrib/hbqt/qtgui/TQTableView.prg +++ b/harbour/contrib/hbqt/qtgui/TQTableView.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTableWidget.prg b/harbour/contrib/hbqt/qtgui/TQTableWidget.prg index 0875e7973b..374b7edecb 100644 --- a/harbour/contrib/hbqt/qtgui/TQTableWidget.prg +++ b/harbour/contrib/hbqt/qtgui/TQTableWidget.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTableWidgetItem.prg b/harbour/contrib/hbqt/qtgui/TQTableWidgetItem.prg index 47ce83b096..193855e17c 100644 --- a/harbour/contrib/hbqt/qtgui/TQTableWidgetItem.prg +++ b/harbour/contrib/hbqt/qtgui/TQTableWidgetItem.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTableWidgetSelectionRange.prg b/harbour/contrib/hbqt/qtgui/TQTableWidgetSelectionRange.prg index 85c9c37771..bf7ab298e6 100644 --- a/harbour/contrib/hbqt/qtgui/TQTableWidgetSelectionRange.prg +++ b/harbour/contrib/hbqt/qtgui/TQTableWidgetSelectionRange.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextBlock.prg b/harbour/contrib/hbqt/qtgui/TQTextBlock.prg index 34aa8eeb17..f5b7be4b0d 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextBlock.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextBlock.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -87,10 +87,12 @@ CREATE CLASS QTextBlock INHERIT HbQtObjectHandler METHOD revision() METHOD setLineCount( nCount ) METHOD setRevision( nRev ) + METHOD setUserData( pData ) METHOD setUserState( nState ) METHOD setVisible( lVisible ) METHOD text() METHOD textList() + METHOD userData() METHOD userState() ENDCLASS @@ -185,6 +187,10 @@ METHOD QTextBlock:setRevision( nRev ) RETURN Qt_QTextBlock_setRevision( ::pPtr, nRev ) +METHOD QTextBlock:setUserData( pData ) + RETURN Qt_QTextBlock_setUserData( ::pPtr, hbqt_ptr( pData ) ) + + METHOD QTextBlock:setUserState( nState ) RETURN Qt_QTextBlock_setUserState( ::pPtr, nState ) @@ -201,6 +207,10 @@ METHOD QTextBlock:textList() RETURN Qt_QTextBlock_textList( ::pPtr ) +METHOD QTextBlock:userData() + RETURN Qt_QTextBlock_userData( ::pPtr ) + + METHOD QTextBlock:userState() RETURN Qt_QTextBlock_userState( ::pPtr ) diff --git a/harbour/contrib/hbqt/qtgui/TQTextBlockFormat.prg b/harbour/contrib/hbqt/qtgui/TQTextBlockFormat.prg index c7f585e2ef..f4c03843aa 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextBlockFormat.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextBlockFormat.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextBlockGroup.prg b/harbour/contrib/hbqt/qtgui/TQTextBlockGroup.prg index 38c61c74bf..8ea1f0b0cb 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextBlockGroup.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextBlockGroup.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextBrowser.prg b/harbour/contrib/hbqt/qtgui/TQTextBrowser.prg index ab956545d6..b1a58be033 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextBrowser.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextBrowser.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextCharFormat.prg b/harbour/contrib/hbqt/qtgui/TQTextCharFormat.prg index 6c31f3893e..d4194f7fb2 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextCharFormat.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextCharFormat.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextCursor.prg b/harbour/contrib/hbqt/qtgui/TQTextCursor.prg index 2d5a4851e7..329827f76b 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextCursor.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextCursor.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -84,7 +84,6 @@ CREATE CLASS QTextCursor INHERIT HbQtObjectHandler METHOD createList_1( nStyle ) METHOD currentFrame() METHOD currentList() - METHOD currentTable() METHOD deleteChar() METHOD deletePreviousChar() METHOD document() @@ -103,8 +102,6 @@ CREATE CLASS QTextCursor INHERIT HbQtObjectHandler METHOD insertImage_3( pImage, cName ) METHOD insertList( pFormat ) METHOD insertList_1( nStyle ) - METHOD insertTable( nRows, nColumns, pFormat ) - METHOD insertTable_1( nRows, nColumns ) METHOD insertText( cText ) METHOD insertText_1( cText, pFormat ) METHOD isCopyOf( pOther ) @@ -209,10 +206,6 @@ METHOD QTextCursor:currentList() RETURN Qt_QTextCursor_currentList( ::pPtr ) -METHOD QTextCursor:currentTable() - RETURN Qt_QTextCursor_currentTable( ::pPtr ) - - METHOD QTextCursor:deleteChar() RETURN Qt_QTextCursor_deleteChar( ::pPtr ) @@ -285,14 +278,6 @@ METHOD QTextCursor:insertList_1( nStyle ) RETURN Qt_QTextCursor_insertList_1( ::pPtr, nStyle ) -METHOD QTextCursor:insertTable( nRows, nColumns, pFormat ) - RETURN Qt_QTextCursor_insertTable( ::pPtr, nRows, nColumns, hbqt_ptr( pFormat ) ) - - -METHOD QTextCursor:insertTable_1( nRows, nColumns ) - RETURN Qt_QTextCursor_insertTable_1( ::pPtr, nRows, nColumns ) - - METHOD QTextCursor:insertText( cText ) RETURN Qt_QTextCursor_insertText( ::pPtr, cText ) diff --git a/harbour/contrib/hbqt/qtgui/TQTextDocument.prg b/harbour/contrib/hbqt/qtgui/TQTextDocument.prg index c9f9c68aa5..6da6272a4f 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextDocument.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextDocument.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextDocumentFragment.prg b/harbour/contrib/hbqt/qtgui/TQTextDocumentFragment.prg index 7b4af24b09..2d6a4656ad 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextDocumentFragment.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextDocumentFragment.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextDocumentWriter.prg b/harbour/contrib/hbqt/qtgui/TQTextDocumentWriter.prg index 7c28307138..a2736a44fb 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextDocumentWriter.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextDocumentWriter.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextEdit.prg b/harbour/contrib/hbqt/qtgui/TQTextEdit.prg index cb4f02219e..d45ec78c13 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextEdit.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextEdit.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextFormat.prg b/harbour/contrib/hbqt/qtgui/TQTextFormat.prg index 699c027db0..b9b216dfdb 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextFormat.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextFormat.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextFragment.prg b/harbour/contrib/hbqt/qtgui/TQTextFragment.prg index 8337ca6d37..f425194348 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextFragment.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextFragment.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextFrame.prg b/harbour/contrib/hbqt/qtgui/TQTextFrame.prg index 3b2e90ce03..d19a1ca452 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextFrame.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextFrame.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextFrameFormat.prg b/harbour/contrib/hbqt/qtgui/TQTextFrameFormat.prg index 6b7f230995..a9b3501a76 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextFrameFormat.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextFrameFormat.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextImageFormat.prg b/harbour/contrib/hbqt/qtgui/TQTextImageFormat.prg index 2cf48a13c6..8609b650e8 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextImageFormat.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextImageFormat.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextInlineObject.prg b/harbour/contrib/hbqt/qtgui/TQTextInlineObject.prg index d1d6c78edb..480ed8325c 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextInlineObject.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextInlineObject.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextItem.prg b/harbour/contrib/hbqt/qtgui/TQTextItem.prg index ff545fd47e..5ef600d69e 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextItem.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextItem.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextLayout.prg b/harbour/contrib/hbqt/qtgui/TQTextLayout.prg index 49703cf219..f38947cdac 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextLayout.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextLayout.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextLength.prg b/harbour/contrib/hbqt/qtgui/TQTextLength.prg index 008da6bfa6..825d841485 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextLength.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextLength.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextLine.prg b/harbour/contrib/hbqt/qtgui/TQTextLine.prg index 37a6d0564f..4cffe27b71 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextLine.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextLine.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextList.prg b/harbour/contrib/hbqt/qtgui/TQTextList.prg new file mode 100644 index 0000000000..21ec55c5c3 --- /dev/null +++ b/harbour/contrib/hbqt/qtgui/TQTextList.prg @@ -0,0 +1,126 @@ +/* + * $Id$ + */ + +/* -------------------------------------------------------------------- */ +/* WARNING: Automatically generated source file. DO NOT EDIT! */ +/* Instead, edit corresponding .qth file, */ +/* or the generator tool itself, and run regenarate. */ +/* -------------------------------------------------------------------- */ + +/* + * Harbour Project source code: + * QT wrapper main header + * + * Copyright 2009-2010 Pritpal Bedi + * + * Copyright 2009 Marcos Antonio Gambeta + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ + + +#include "hbclass.ch" + + +CREATE CLASS QTextList INHERIT HbQtObjectHandler, QTextBlockGroup + + METHOD new( ... ) + + METHOD add( pBlock ) + METHOD count() + METHOD format() + METHOD item( nI ) + METHOD itemNumber( pBlock ) + METHOD itemText( pBlock ) + METHOD remove( pBlock ) + METHOD removeItem( nI ) + METHOD setFormat( pFormat ) + + ENDCLASS + + +METHOD QTextList:new( ... ) + LOCAL p + FOR EACH p IN { ... } + hb_pvalue( p:__enumIndex(), hbqt_ptr( p ) ) + NEXT + ::pPtr := Qt_QTextList( ... ) + RETURN Self + + +METHOD QTextList:add( pBlock ) + RETURN Qt_QTextList_add( ::pPtr, hbqt_ptr( pBlock ) ) + + +METHOD QTextList:count() + RETURN Qt_QTextList_count( ::pPtr ) + + +METHOD QTextList:format() + RETURN Qt_QTextList_format( ::pPtr ) + + +METHOD QTextList:item( nI ) + RETURN Qt_QTextList_item( ::pPtr, nI ) + + +METHOD QTextList:itemNumber( pBlock ) + RETURN Qt_QTextList_itemNumber( ::pPtr, hbqt_ptr( pBlock ) ) + + +METHOD QTextList:itemText( pBlock ) + RETURN Qt_QTextList_itemText( ::pPtr, hbqt_ptr( pBlock ) ) + + +METHOD QTextList:remove( pBlock ) + RETURN Qt_QTextList_remove( ::pPtr, hbqt_ptr( pBlock ) ) + + +METHOD QTextList:removeItem( nI ) + RETURN Qt_QTextList_removeItem( ::pPtr, nI ) + + +METHOD QTextList:setFormat( pFormat ) + RETURN Qt_QTextList_setFormat( ::pPtr, hbqt_ptr( pFormat ) ) + diff --git a/harbour/contrib/hbqt/qtgui/TQTextListFormat.prg b/harbour/contrib/hbqt/qtgui/TQTextListFormat.prg index 9c90667bb0..a8399edd61 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextListFormat.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextListFormat.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextObject.prg b/harbour/contrib/hbqt/qtgui/TQTextObject.prg index 435c42f700..621592cc50 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextObject.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextObject.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextOption.prg b/harbour/contrib/hbqt/qtgui/TQTextOption.prg index f1955ed643..ff79c18f98 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextOption.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextOption.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTextTableFormat.prg b/harbour/contrib/hbqt/qtgui/TQTextTableFormat.prg index 4dc5410bc2..de5978175e 100644 --- a/harbour/contrib/hbqt/qtgui/TQTextTableFormat.prg +++ b/harbour/contrib/hbqt/qtgui/TQTextTableFormat.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTimeEdit.prg b/harbour/contrib/hbqt/qtgui/TQTimeEdit.prg index 2dcefd811a..173bdb5dde 100644 --- a/harbour/contrib/hbqt/qtgui/TQTimeEdit.prg +++ b/harbour/contrib/hbqt/qtgui/TQTimeEdit.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQToolBar.prg b/harbour/contrib/hbqt/qtgui/TQToolBar.prg index a40545e60a..e92f4a6b40 100644 --- a/harbour/contrib/hbqt/qtgui/TQToolBar.prg +++ b/harbour/contrib/hbqt/qtgui/TQToolBar.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQToolBox.prg b/harbour/contrib/hbqt/qtgui/TQToolBox.prg index 870dd1da3d..0e76a84e06 100644 --- a/harbour/contrib/hbqt/qtgui/TQToolBox.prg +++ b/harbour/contrib/hbqt/qtgui/TQToolBox.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQToolButton.prg b/harbour/contrib/hbqt/qtgui/TQToolButton.prg index 0d0406af91..e88b10eca4 100644 --- a/harbour/contrib/hbqt/qtgui/TQToolButton.prg +++ b/harbour/contrib/hbqt/qtgui/TQToolButton.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTransform.prg b/harbour/contrib/hbqt/qtgui/TQTransform.prg index 2e2bf8324b..6712c63621 100644 --- a/harbour/contrib/hbqt/qtgui/TQTransform.prg +++ b/harbour/contrib/hbqt/qtgui/TQTransform.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTreeView.prg b/harbour/contrib/hbqt/qtgui/TQTreeView.prg index 08f2ad7d29..ea88d632ab 100644 --- a/harbour/contrib/hbqt/qtgui/TQTreeView.prg +++ b/harbour/contrib/hbqt/qtgui/TQTreeView.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTreeWidget.prg b/harbour/contrib/hbqt/qtgui/TQTreeWidget.prg index 5cdb1205ea..9ae28f9c94 100644 --- a/harbour/contrib/hbqt/qtgui/TQTreeWidget.prg +++ b/harbour/contrib/hbqt/qtgui/TQTreeWidget.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQTreeWidgetItem.prg b/harbour/contrib/hbqt/qtgui/TQTreeWidgetItem.prg index d4492cd643..0970c62650 100644 --- a/harbour/contrib/hbqt/qtgui/TQTreeWidgetItem.prg +++ b/harbour/contrib/hbqt/qtgui/TQTreeWidgetItem.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQVBoxLayout.prg b/harbour/contrib/hbqt/qtgui/TQVBoxLayout.prg index 26e9add082..0b79b01a89 100644 --- a/harbour/contrib/hbqt/qtgui/TQVBoxLayout.prg +++ b/harbour/contrib/hbqt/qtgui/TQVBoxLayout.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQValidator.prg b/harbour/contrib/hbqt/qtgui/TQValidator.prg index d5dfeba5d4..6f3bbbe678 100644 --- a/harbour/contrib/hbqt/qtgui/TQValidator.prg +++ b/harbour/contrib/hbqt/qtgui/TQValidator.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQWheelEvent.prg b/harbour/contrib/hbqt/qtgui/TQWheelEvent.prg index 53665794dd..8ce1e9c39e 100644 --- a/harbour/contrib/hbqt/qtgui/TQWheelEvent.prg +++ b/harbour/contrib/hbqt/qtgui/TQWheelEvent.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQWidget.prg b/harbour/contrib/hbqt/qtgui/TQWidget.prg index 2567c708bf..a53bd8068f 100644 --- a/harbour/contrib/hbqt/qtgui/TQWidget.prg +++ b/harbour/contrib/hbqt/qtgui/TQWidget.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -101,7 +101,6 @@ CREATE CLASS QWidget INHERIT HbQtObjectHandler, QObject, QPaintDevice METHOD grabMouse() METHOD grabMouse_1( pCursor ) METHOD grabShortcut( pKey, nContext ) - METHOD graphicsProxyWidget() METHOD hasFocus() METHOD hasMouseTracking() METHOD height() @@ -427,10 +426,6 @@ METHOD QWidget:grabShortcut( pKey, nContext ) RETURN Qt_QWidget_grabShortcut( ::pPtr, hbqt_ptr( pKey ), nContext ) -METHOD QWidget:graphicsProxyWidget() - RETURN Qt_QWidget_graphicsProxyWidget( ::pPtr ) - - METHOD QWidget:hasFocus() RETURN Qt_QWidget_hasFocus( ::pPtr ) diff --git a/harbour/contrib/hbqt/qtgui/TQWidgetAction.prg b/harbour/contrib/hbqt/qtgui/TQWidgetAction.prg index f306608eae..b008201ebb 100644 --- a/harbour/contrib/hbqt/qtgui/TQWidgetAction.prg +++ b/harbour/contrib/hbqt/qtgui/TQWidgetAction.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQWidgetItem.prg b/harbour/contrib/hbqt/qtgui/TQWidgetItem.prg index bfe00ba33d..b6096ffbda 100644 --- a/harbour/contrib/hbqt/qtgui/TQWidgetItem.prg +++ b/harbour/contrib/hbqt/qtgui/TQWidgetItem.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQWindowsStyle.prg b/harbour/contrib/hbqt/qtgui/TQWindowsStyle.prg index 116a92971d..5b28915f5c 100644 --- a/harbour/contrib/hbqt/qtgui/TQWindowsStyle.prg +++ b/harbour/contrib/hbqt/qtgui/TQWindowsStyle.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQWizard.prg b/harbour/contrib/hbqt/qtgui/TQWizard.prg index 5d93895d31..92dcda0d4f 100644 --- a/harbour/contrib/hbqt/qtgui/TQWizard.prg +++ b/harbour/contrib/hbqt/qtgui/TQWizard.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/TQWizardPage.prg b/harbour/contrib/hbqt/qtgui/TQWizardPage.prg index 14deced8bb..c7f6a504ab 100644 --- a/harbour/contrib/hbqt/qtgui/TQWizardPage.prg +++ b/harbour/contrib/hbqt/qtgui/TQWizardPage.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtgui/filelist.mk b/harbour/contrib/hbqt/qtgui/filelist.mk index 6911547138..3afc77de28 100644 --- a/harbour/contrib/hbqt/qtgui/filelist.mk +++ b/harbour/contrib/hbqt/qtgui/filelist.mk @@ -9,6 +9,7 @@ # -------------------------------------------------------------------- CPP_SOURCES := \ + HBQTextBlockUserData.cpp \ QAbstractButton.cpp \ QAbstractItemDelegate.cpp \ QAbstractItemView.cpp \ @@ -101,10 +102,11 @@ CPP_SOURCES := \ QMouseEvent.cpp \ QMoveEvent.cpp \ QMovie.cpp \ - QPaintDevice.cpp \ - QPainterPath.cpp \ QPageSetupDialog.cpp \ + QPaintDevice.cpp \ + QPaintEngine.cpp \ QPainter.cpp \ + QPainterPath.cpp \ QPaintEvent.cpp \ QPalette.cpp \ QPen.cpp \ @@ -196,6 +198,7 @@ CPP_SOURCES := \ QTextLayout.cpp \ QTextLength.cpp \ QTextLine.cpp \ + QTextList.cpp \ QTextListFormat.cpp \ QTextObject.cpp \ QTextOption.cpp \ @@ -221,6 +224,7 @@ CPP_SOURCES := \ PRG_SOURCES := \ + THBQTextBlockUserData.prg \ TQAbstractButton.prg \ TQAbstractItemDelegate.prg \ TQAbstractItemView.prg \ @@ -313,10 +317,11 @@ PRG_SOURCES := \ TQMouseEvent.prg \ TQMoveEvent.prg \ TQMovie.prg \ - TQPaintDevice.prg \ - TQPainterPath.prg \ TQPageSetupDialog.prg \ + TQPaintDevice.prg \ + TQPaintEngine.prg \ TQPainter.prg \ + TQPainterPath.prg \ TQPaintEvent.prg \ TQPalette.prg \ TQPen.prg \ @@ -408,6 +413,7 @@ PRG_SOURCES := \ TQTextLayout.prg \ TQTextLength.prg \ TQTextLine.prg \ + TQTextList.prg \ TQTextListFormat.prg \ TQTextObject.prg \ TQTextOption.prg \ diff --git a/harbour/contrib/hbqt/qth/HBQTextBlockUserData.qth b/harbour/contrib/hbqt/qth/HBQTextBlockUserData.qth new file mode 100644 index 0000000000..86e6ac4683 --- /dev/null +++ b/harbour/contrib/hbqt/qth/HBQTextBlockUserData.qth @@ -0,0 +1,95 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT Source Generator for Harbour + * + * Copyright 2009 Pritpal Bedi + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ +; +; Header File to Generate QT Wrapper Sources +; + + +QObject = no +Inherits = +Type = +New = + + + + + + + + + +#include +#include "../hbqt_hbqsyntaxhighlighter.h" + +/* + * HBQTextBlockUserData() + * ~HBQTextBlockUserData() + */ +HB_FUNC( QT_HBQTEXTBLOCKUSERDATA ) +{ + hb_retptr( new HBQTextBlockUserData() ); +} + + + + + + +void setData( int state ) + + + + + + + diff --git a/harbour/contrib/hbqt/qth/QAbstractTextDocumentLayout.qth b/harbour/contrib/hbqt/qth/QAbstractTextDocumentLayout.qth index baa48d6eab..59535be3c5 100644 --- a/harbour/contrib/hbqt/qth/QAbstractTextDocumentLayout.qth +++ b/harbour/contrib/hbqt/qth/QAbstractTextDocumentLayout.qth @@ -83,7 +83,7 @@ QTextDocument * document () const virtual QSizeF documentSize () const = 0 //virtual void draw ( QPainter * painter, const PaintContext & context ) = 0 virtual QRectF frameBoundingRect ( QTextFrame * frame ) const = 0 -QTextObjectInterface * handlerForObject ( int objectType ) const +//QTextObjectInterface * handlerForObject ( int objectType ) const virtual int hitTest ( const QPointF & point, Qt::HitTestAccuracy accuracy ) const = 0 virtual int pageCount () const = 0 QPaintDevice * paintDevice () const diff --git a/harbour/contrib/hbqt/qth/QApplication.qth b/harbour/contrib/hbqt/qth/QApplication.qth index bd2467b71a..79b13c2c60 100644 --- a/harbour/contrib/hbqt/qth/QApplication.qth +++ b/harbour/contrib/hbqt/qth/QApplication.qth @@ -102,6 +102,13 @@ HB_FUNC( QT_QAPPLICATION ) static void hbqt_Exit( void * cargo ) { HB_SYMBOL_UNUSED( cargo ); + + HB_TRACE( HB_TR_ALWAYS, ( "hbqt_exit 0 %p", s_app ) ); + + s_app->quit(); + s_app = NULL; + + HB_TRACE( HB_TR_ALWAYS, ( "hbqt_exit 1 %p", s_app ) ); } static void hbqt_Init( void * cargo ) diff --git a/harbour/contrib/hbqt/qth/QClipboard.qth b/harbour/contrib/hbqt/qth/QClipboard.qth index d376d29a63..cd2cebdd54 100644 --- a/harbour/contrib/hbqt/qth/QClipboard.qth +++ b/harbour/contrib/hbqt/qth/QClipboard.qth @@ -65,6 +65,7 @@ Destructor = no #include #include #include +#include /* * @@ -83,7 +84,7 @@ enum Mode { Clipboard, Selection, FindBuffer } void clear ( Mode mode = Clipboard ) QImage image ( Mode mode = Clipboard ) const -const QMimeData * mimeData ( Mode mode = Clipboard ) const +//const QMimeData * mimeData ( Mode mode = Clipboard ) const bool ownsClipboard () const bool ownsFindBuffer () const bool ownsSelection () const diff --git a/harbour/contrib/hbqt/qth/QComboBox.qth b/harbour/contrib/hbqt/qth/QComboBox.qth index 24348245a6..420536a1e1 100644 --- a/harbour/contrib/hbqt/qth/QComboBox.qth +++ b/harbour/contrib/hbqt/qth/QComboBox.qth @@ -136,7 +136,7 @@ void setValidator ( const QValidator * validator ) void setView ( QAbstractItemView * itemView ) virtual void showPopup () SizeAdjustPolicy sizeAdjustPolicy () const -const QValidator * validator () const +virtual const QValidator * validator () const QAbstractItemView * view () const diff --git a/harbour/contrib/hbqt/qth/QCursor.qth b/harbour/contrib/hbqt/qth/QCursor.qth index 253f5fde9e..933a1d093c 100644 --- a/harbour/contrib/hbqt/qth/QCursor.qth +++ b/harbour/contrib/hbqt/qth/QCursor.qth @@ -72,6 +72,7 @@ oCursor := QCursor():new( pQBitmap, pQBitmapAsMask, [ nHotX = -1 ], [ nHotY = -1 #include #include +#include /* * QCursor () diff --git a/harbour/contrib/hbqt/qth/QDragEnterEvent.qth b/harbour/contrib/hbqt/qth/QDragEnterEvent.qth index 5a8db2e171..ef7f1e05c2 100644 --- a/harbour/contrib/hbqt/qth/QDragEnterEvent.qth +++ b/harbour/contrib/hbqt/qth/QDragEnterEvent.qth @@ -55,6 +55,7 @@ ; +QObject = no Inherits = QDragMoveEvent Type = Core New = @@ -69,7 +70,7 @@ New = */ HB_FUNC( QT_QDRAGENTEREVENT ) { - // hb_retptr( ( * ) new () ); + } diff --git a/harbour/contrib/hbqt/qth/QDragLeaveEvent.qth b/harbour/contrib/hbqt/qth/QDragLeaveEvent.qth index 0ec116f323..55ee93f88e 100644 --- a/harbour/contrib/hbqt/qth/QDragLeaveEvent.qth +++ b/harbour/contrib/hbqt/qth/QDragLeaveEvent.qth @@ -55,6 +55,7 @@ ; +QObject = no Inherits = QEvent Type = Core New = diff --git a/harbour/contrib/hbqt/qth/QDropEvent.qth b/harbour/contrib/hbqt/qth/QDropEvent.qth index 2e22208743..2e942379a1 100644 --- a/harbour/contrib/hbqt/qth/QDropEvent.qth +++ b/harbour/contrib/hbqt/qth/QDropEvent.qth @@ -81,7 +81,14 @@ HB_FUNC( QT_QDROPEVENT ) void acceptProposedAction () Qt::DropAction dropAction () const Qt::KeyboardModifiers keyboardModifiers () const -const QMimeData * mimeData () const + +# This function is OK if called as line below, but do not found a way +# how to construct dynamically - no separate keyword ??? +# +//const QMimeData * mimeData () const +//hb_retptrGC( hbqt_gcAllocate_QMimeData( ( void* ) hbqt_par_QDropEvent( 1 )->mimeData(), false ) ); +# +# Qt::MouseButtons mouseButtons () const const QPoint & pos () const Qt::DropActions possibleActions () const diff --git a/harbour/contrib/hbqt/qth/QFocusEvent.qth b/harbour/contrib/hbqt/qth/QFocusEvent.qth index 20555b91a5..40a59fc0ff 100644 --- a/harbour/contrib/hbqt/qth/QFocusEvent.qth +++ b/harbour/contrib/hbqt/qth/QFocusEvent.qth @@ -55,6 +55,7 @@ ; +QObject = no Inherits = QEvent Type = Core New = diff --git a/harbour/contrib/hbqt/qth/QGradient.qth b/harbour/contrib/hbqt/qth/QGradient.qth index 590f9c4106..c42da04699 100644 --- a/harbour/contrib/hbqt/qth/QGradient.qth +++ b/harbour/contrib/hbqt/qth/QGradient.qth @@ -55,6 +55,7 @@ ; +QObject = no Inherits = Type = Core New = diff --git a/harbour/contrib/hbqt/qth/QKeyEvent.qth b/harbour/contrib/hbqt/qth/QKeyEvent.qth index 4c173e1496..41f269d872 100644 --- a/harbour/contrib/hbqt/qth/QKeyEvent.qth +++ b/harbour/contrib/hbqt/qth/QKeyEvent.qth @@ -55,6 +55,7 @@ ; +QObject = no Inherits = QInputEvent Type = Core New = diff --git a/harbour/contrib/hbqt/qth/QLabel.qth b/harbour/contrib/hbqt/qth/QLabel.qth index d1c177df71..0288a9a307 100644 --- a/harbour/contrib/hbqt/qth/QLabel.qth +++ b/harbour/contrib/hbqt/qth/QLabel.qth @@ -61,6 +61,7 @@ New = pParent, nFlags #include +#include /* diff --git a/harbour/contrib/hbqt/qth/QLayoutItem.qth b/harbour/contrib/hbqt/qth/QLayoutItem.qth index d7d775eaad..e196194d8e 100644 --- a/harbour/contrib/hbqt/qth/QLayoutItem.qth +++ b/harbour/contrib/hbqt/qth/QLayoutItem.qth @@ -55,6 +55,7 @@ ; +QObject = no New = pParent diff --git a/harbour/contrib/hbqt/qth/QLineEdit.qth b/harbour/contrib/hbqt/qth/QLineEdit.qth index b2df6d58ac..385e5da05e 100644 --- a/harbour/contrib/hbqt/qth/QLineEdit.qth +++ b/harbour/contrib/hbqt/qth/QLineEdit.qth @@ -61,6 +61,7 @@ New = pParent #include +#include /* @@ -125,7 +126,7 @@ void setTextMargins ( int left, int top, int right, int bottom ) void setValidator ( const QValidator * v ) virtual QSize sizeHint () const QString text () const -const QValidator * validator () const +virtual const QValidator * validator () const diff --git a/harbour/contrib/hbqt/qth/QMoveEvent.qth b/harbour/contrib/hbqt/qth/QMoveEvent.qth index c5965148a6..921e4f2fe4 100644 --- a/harbour/contrib/hbqt/qth/QMoveEvent.qth +++ b/harbour/contrib/hbqt/qth/QMoveEvent.qth @@ -55,6 +55,7 @@ ; +QObject = no Inherits = QEvent Type = Core New = diff --git a/harbour/contrib/hbqt/qth/QPaintDevice.qth b/harbour/contrib/hbqt/qth/QPaintDevice.qth index 67fc513820..089d1ce0c2 100644 --- a/harbour/contrib/hbqt/qth/QPaintDevice.qth +++ b/harbour/contrib/hbqt/qth/QPaintDevice.qth @@ -55,7 +55,8 @@ ; -New = pParent +QObject = no +New = pParent diff --git a/harbour/contrib/hbqt/qth/QPaintEngine.qth b/harbour/contrib/hbqt/qth/QPaintEngine.qth new file mode 100644 index 0000000000..b9e46cb7a6 --- /dev/null +++ b/harbour/contrib/hbqt/qth/QPaintEngine.qth @@ -0,0 +1,124 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT Source Generator for Harbour + * + * Copyright 2009 Pritpal Bedi + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ +; +; Header File to Generate QT Wrapper Sources +; + + +QObject = no +Inherits = +Type = +New = + + + + + + + + + +#include + + +/* + * QPaintEngine ( PaintEngineFeatures caps = 0 ) + * virtual ~QPaintEngine () + */ +HB_FUNC( QT_QPAINTENGINE ) +{ + +} + + + +enum DirtyFlag { DirtyPen, DirtyBrush, DirtyBrushOrigin, DirtyFont, ..., AllDirty } +flags DirtyFlags +enum PaintEngineFeature { AlphaBlend, Antialiasing, BlendModes, BrushStroke, ..., AllFeatures } +flags PaintEngineFeatures +enum PolygonDrawMode { OddEvenMode, WindingMode, ConvexMode, PolylineMode } +enum Type { X11, Windows, MacPrinter, CoreGraphics, ..., MaxUser } + + + +virtual bool begin ( QPaintDevice * pdev ) = 0 +virtual void drawEllipse ( const QRectF & rect ) +virtual void drawEllipse ( const QRect & rect ) +virtual void drawImage ( const QRectF & rectangle, const QImage & image, const QRectF & sr, Qt::ImageConversionFlags flags = Qt::AutoColor ) +virtual void drawLines ( const QLineF * lines, int lineCount ) +virtual void drawLines ( const QLine * lines, int lineCount ) +virtual void drawPath ( const QPainterPath & path ) +virtual void drawPixmap ( const QRectF & r, const QPixmap & pm, const QRectF & sr ) = 0 +virtual void drawPoints ( const QPointF * points, int pointCount ) +virtual void drawPoints ( const QPoint * points, int pointCount ) +virtual void drawPolygon ( const QPointF * points, int pointCount, PolygonDrawMode mode ) +virtual void drawPolygon ( const QPoint * points, int pointCount, PolygonDrawMode mode ) +virtual void drawRects ( const QRectF * rects, int rectCount ) +virtual void drawRects ( const QRect * rects, int rectCount ) +virtual void drawTextItem ( const QPointF & p, const QTextItem & textItem ) +virtual void drawTiledPixmap ( const QRectF & rect, const QPixmap & pixmap, const QPointF & p ) +virtual bool end () = 0 +bool hasFeature ( PaintEngineFeatures feature ) const +bool isActive () const +QPaintDevice * paintDevice () const +QPainter * painter () const +void setActive ( bool state ) +virtual Type type () const = 0 +virtual void updateState ( const QPaintEngineState & state ) = 0 + + + + + + + diff --git a/harbour/contrib/hbqt/qth/QPrintEngine.qth b/harbour/contrib/hbqt/qth/QPrintEngine.qth index 08c0774b6c..043cc8a7cb 100644 --- a/harbour/contrib/hbqt/qth/QPrintEngine.qth +++ b/harbour/contrib/hbqt/qth/QPrintEngine.qth @@ -55,6 +55,7 @@ ; +QObject = no Inherits = Type = Core New = diff --git a/harbour/contrib/hbqt/qth/QResizeEvent.qth b/harbour/contrib/hbqt/qth/QResizeEvent.qth index f5e0007bb9..075d8b1934 100644 --- a/harbour/contrib/hbqt/qth/QResizeEvent.qth +++ b/harbour/contrib/hbqt/qth/QResizeEvent.qth @@ -55,6 +55,7 @@ ; +QObject = no Inherits = QEvent Type = Core New = diff --git a/harbour/contrib/hbqt/qth/QSplitter.qth b/harbour/contrib/hbqt/qth/QSplitter.qth index d5e5d88775..a8822f6f08 100644 --- a/harbour/contrib/hbqt/qth/QSplitter.qth +++ b/harbour/contrib/hbqt/qth/QSplitter.qth @@ -82,7 +82,12 @@ void addWidget ( QWidget * widget ) bool childrenCollapsible () const int count () const void getRange ( int index, int * min, int * max ) const -QSplitterHandle * handle ( int index ) const +# +# The call below need QSplitterHandle class constructed firts +# Will review later +# +//QSplitterHandle * handle ( int index ) const +# int handleWidth () const int indexOf ( QWidget * widget ) const void insertWidget ( int index, QWidget * widget ) diff --git a/harbour/contrib/hbqt/qth/QStandardItemModel.qth b/harbour/contrib/hbqt/qth/QStandardItemModel.qth index d50be73a6e..53f9ff7705 100644 --- a/harbour/contrib/hbqt/qth/QStandardItemModel.qth +++ b/harbour/contrib/hbqt/qth/QStandardItemModel.qth @@ -94,7 +94,7 @@ void insertRow ( int row, QStandardItem * item ) QStandardItem * invisibleRootItem () const QStandardItem * item ( int row, int column = 0 ) const QStandardItem * itemFromIndex ( const QModelIndex & index ) const -const QStandardItem * itemPrototype () const +// const QStandardItem * itemPrototype () const void setColumnCount ( int columns ) void setHorizontalHeaderItem ( int column, QStandardItem * item ) void setHorizontalHeaderLabels ( const QStringList & labels ) diff --git a/harbour/contrib/hbqt/qth/QStyleHintReturn.qth b/harbour/contrib/hbqt/qth/QStyleHintReturn.qth index 72fc9afe0a..751bc6a90f 100644 --- a/harbour/contrib/hbqt/qth/QStyleHintReturn.qth +++ b/harbour/contrib/hbqt/qth/QStyleHintReturn.qth @@ -55,6 +55,7 @@ ; +QObject = no Inherits = Type = Core New = @@ -80,6 +81,8 @@ enum StyleOptionVersion { Version } +int type +int version diff --git a/harbour/contrib/hbqt/qth/QStyleHintReturnMask.qth b/harbour/contrib/hbqt/qth/QStyleHintReturnMask.qth index 425e3f6844..ea1098e5a2 100644 --- a/harbour/contrib/hbqt/qth/QStyleHintReturnMask.qth +++ b/harbour/contrib/hbqt/qth/QStyleHintReturnMask.qth @@ -55,6 +55,7 @@ ; +QObject = no Inherits = QStyleHintReturn Type = Core New = @@ -76,10 +77,10 @@ HB_FUNC( QT_QSTYLEHINTRETURNMASK ) enum StyleOptionType { Type } enum StyleOptionVersion { Version } -Public Functions +QRegion region diff --git a/harbour/contrib/hbqt/qth/QStyleHintReturnVariant.qth b/harbour/contrib/hbqt/qth/QStyleHintReturnVariant.qth index 152ed23910..d9c147969e 100644 --- a/harbour/contrib/hbqt/qth/QStyleHintReturnVariant.qth +++ b/harbour/contrib/hbqt/qth/QStyleHintReturnVariant.qth @@ -55,6 +55,7 @@ ; +QObject = no Inherits = QStyleHintReturn Type = Core New = @@ -80,6 +81,7 @@ Public Functions +QVariant variant diff --git a/harbour/contrib/hbqt/qth/QTextBlock.qth b/harbour/contrib/hbqt/qth/QTextBlock.qth index fed4e0b1bc..59f0119afd 100644 --- a/harbour/contrib/hbqt/qth/QTextBlock.qth +++ b/harbour/contrib/hbqt/qth/QTextBlock.qth @@ -63,7 +63,8 @@ New = #include - +#include +#include "../hbqt_hbqsyntaxhighlighter.h" /* * QTextBlock ( const QTextBlock & other ) @@ -93,7 +94,13 @@ QTextCharFormat charFormat () const int charFormatIndex () const void clearLayout () bool contains ( int position ) const -const QTextDocument * document () const +# +# +# const QTextDocument * document () const +# +virtual const QTextDocument * document () const +# +# //iterator end () const int firstLineNumber () const bool isValid () const @@ -107,12 +114,12 @@ QTextBlock previous () const int revision () const void setLineCount ( int count ) void setRevision ( int rev ) -// void setUserData ( QTextBlockUserData * data ) +void setUserData ( HBQTextBlockUserData * data ) void setUserState ( int state ) void setVisible ( bool visible ) QString text () const QTextList * textList () const -// QTextBlockUserData * userData () const +HBQTextBlockUserData * userData () const int userState () const diff --git a/harbour/contrib/hbqt/qth/QTextCursor.qth b/harbour/contrib/hbqt/qth/QTextCursor.qth index 6bfaadb5e4..97624c40a4 100644 --- a/harbour/contrib/hbqt/qth/QTextCursor.qth +++ b/harbour/contrib/hbqt/qth/QTextCursor.qth @@ -143,7 +143,7 @@ QTextList * createList ( const QTextListFormat & format ) QTextList * createList ( QTextListFormat::Style style ) QTextFrame * currentFrame () const QTextList * currentList () const -QTextTable * currentTable () const +//QTextTable * currentTable () const void deleteChar () void deletePreviousChar () QTextDocument * document () const @@ -162,8 +162,8 @@ void insertImage ( const QTextImageFormat & format, QTextFrameFormat::Position a void insertImage ( const QImage & image, const QString & name = QString() ) QTextList * insertList ( const QTextListFormat & format ) QTextList * insertList ( QTextListFormat::Style style ) -QTextTable * insertTable ( int rows, int columns, const QTextTableFormat & format ) -QTextTable * insertTable ( int rows, int columns ) +//QTextTable * insertTable ( int rows, int columns, const QTextTableFormat & format ) +//QTextTable * insertTable ( int rows, int columns ) void insertText ( const QString & text ) void insertText ( const QString & text, const QTextCharFormat & format ) bool isCopyOf ( const QTextCursor & other ) const diff --git a/harbour/contrib/hbqt/qth/QTextList.qth b/harbour/contrib/hbqt/qth/QTextList.qth new file mode 100644 index 0000000000..61a7741fdd --- /dev/null +++ b/harbour/contrib/hbqt/qth/QTextList.qth @@ -0,0 +1,103 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * QT Source Generator for Harbour + * + * Copyright 2009 Pritpal Bedi + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ +/*----------------------------------------------------------------------*/ +; +; Header File to Generate QT Wrapper Sources +; + + +QObject = +Inherits = QTextBlockGroup +Type = +New = + + + + + + + + + +#include + + +/* + * + * + */ +HB_FUNC( QT_QTEXTLIST ) +{ + +} + + + + + + +void add ( const QTextBlock & block ) +int count () const +QTextListFormat format () const +QTextBlock item ( int i ) const +int itemNumber ( const QTextBlock & block ) const +QString itemText ( const QTextBlock & block ) const +void remove ( const QTextBlock & block ) +void removeItem ( int i ) +void setFormat ( const QTextListFormat & format ) + + + + + + + diff --git a/harbour/contrib/hbqt/qth/QWheelEvent.qth b/harbour/contrib/hbqt/qth/QWheelEvent.qth index d463016893..781e9e81eb 100644 --- a/harbour/contrib/hbqt/qth/QWheelEvent.qth +++ b/harbour/contrib/hbqt/qth/QWheelEvent.qth @@ -55,6 +55,7 @@ ; +QObject = no Inherits = QInputEvent Type = Core New = diff --git a/harbour/contrib/hbqt/qth/QWidget.qth b/harbour/contrib/hbqt/qth/QWidget.qth index 18fa2a3b81..2b09f75d32 100644 --- a/harbour/contrib/hbqt/qth/QWidget.qth +++ b/harbour/contrib/hbqt/qth/QWidget.qth @@ -124,7 +124,7 @@ void grabKeyboard () void grabMouse () void grabMouse ( const QCursor & cursor ) int grabShortcut ( const QKeySequence & key, Qt::ShortcutContext context = Qt::WindowShortcut ) -QGraphicsProxyWidget * graphicsProxyWidget () const +// QGraphicsProxyWidget * graphicsProxyWidget () const // bool hasEditFocus () const bool hasFocus () const bool hasMouseTracking () const diff --git a/harbour/contrib/hbqt/qtnetwork/QFtp.cpp b/harbour/contrib/hbqt/qtnetwork/QFtp.cpp index 2576627dc1..98f81f960d 100644 --- a/harbour/contrib/hbqt/qtnetwork/QFtp.cpp +++ b/harbour/contrib/hbqt/qtnetwork/QFtp.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -102,6 +102,7 @@ HB_FUNC( QT_QFTP_READ ) typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QFtp > pq; } QGC_POINTER_QFtp; @@ -110,48 +111,47 @@ QT_G_FUNC( hbqt_gcRelease_QFtp ) { QGC_POINTER_QFtp * p = ( QGC_POINTER_QFtp * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFtp p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFtp ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QFtp * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QFtp * ) p->ph )->~QFtp(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QFtp * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QFtp ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QFtp ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QFtp Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QFtp Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QFtp Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QFtp Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QFtp Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QFtp( void * pObj ) +void * hbqt_gcAllocate_QFtp( void * pObj, bool bNew ) { QGC_POINTER_QFtp * p = ( QGC_POINTER_QFtp * ) hb_gcAllocate( sizeof( QGC_POINTER_QFtp ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QFtp; - new( & p->pq ) QPointer< QFtp >( ( QFtp * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QFtp %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QFtp >( ( QFtp * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QFtp ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -161,7 +161,7 @@ HB_FUNC( QT_QFTP ) pObj = new QFtp( hbqt_par_QObject( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QFtp( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QFtp( pObj, true ) ); } /* * qint64 bytesAvailable () const @@ -216,7 +216,7 @@ HB_FUNC( QT_QFTP_CURRENTCOMMAND ) */ HB_FUNC( QT_QFTP_CURRENTDEVICE ) { - hb_retptr( ( QIODevice* ) hbqt_par_QFtp( 1 )->currentDevice() ); + hb_retptrGC( hbqt_gcAllocate_QIODevice( hbqt_par_QFtp( 1 )->currentDevice(), false ) ); } /* @@ -312,7 +312,7 @@ HB_FUNC( QT_QFTP_RAWCOMMAND ) */ HB_FUNC( QT_QFTP_READALL ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QFtp( 1 )->readAll() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QFtp( 1 )->readAll() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtnetwork/QHttp.cpp b/harbour/contrib/hbqt/qtnetwork/QHttp.cpp index 174bb0006b..97090f25bd 100644 --- a/harbour/contrib/hbqt/qtnetwork/QHttp.cpp +++ b/harbour/contrib/hbqt/qtnetwork/QHttp.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -102,6 +102,7 @@ HB_FUNC( QT_QHTTP_READ ) typedef struct { void * ph; + bool bNew; QT_G_FUNC_PTR func; QPointer< QHttp > pq; } QGC_POINTER_QHttp; @@ -110,48 +111,47 @@ QT_G_FUNC( hbqt_gcRelease_QHttp ) { QGC_POINTER_QHttp * p = ( QGC_POINTER_QHttp * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QHttp p=%p", p)); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QHttp ph=%p pq=%p", p->ph, (void *)(p->pq))); - - if( p && p->ph && p->pq ) + if( p && p->bNew ) { - const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); - if( ( QString ) m->className() != ( QString ) "QObject" ) + if( p->ph && p->pq ) { - switch( hbqt_get_object_release_method() ) + const QMetaObject * m = ( ( QObject * ) p->ph )->metaObject(); + if( ( QString ) m->className() != ( QString ) "QObject" ) { - case HBQT_RELEASE_WITH_DELETE: delete ( ( QHttp * ) p->ph ); - break; - case HBQT_RELEASE_WITH_DESTRUTOR: - ( ( QHttp * ) p->ph )->~QHttp(); - break; - case HBQT_RELEASE_WITH_DELETE_LATER: - ( ( QHttp * ) p->ph )->deleteLater(); - break; + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QHttp ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "NO__rel_QHttp ph=%p pq=%p %i B %i KB", p->ph, (void *)(p->pq), ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QHttp Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); } else { - HB_TRACE( HB_TR_DEBUG, ( "NO hbqt_gcRelease_QHttp Object Name Missing!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QHttp Object already deleted!" ) ); } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QHttp Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QHttp Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QHttp( void * pObj ) +void * hbqt_gcAllocate_QHttp( void * pObj, bool bNew ) { QGC_POINTER_QHttp * p = ( QGC_POINTER_QHttp * ) hb_gcAllocate( sizeof( QGC_POINTER_QHttp ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QHttp; - new( & p->pq ) QPointer< QHttp >( ( QHttp * ) pObj ); - HB_TRACE( HB_TR_DEBUG, ( " new_QHttp %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + new( & p->pq ) QPointer< QHttp >( ( QHttp * ) pObj ); + HB_TRACE( HB_TR_DEBUG, ( " _new_QHttp ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -161,7 +161,7 @@ HB_FUNC( QT_QHTTP ) pObj = new QHttp( hbqt_par_QObject( 1 ) ) ; - hb_retptrGC( hbqt_gcAllocate_QHttp( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QHttp( pObj, true ) ); } /* * qint64 bytesAvailable () const @@ -192,7 +192,7 @@ HB_FUNC( QT_QHTTP_CLOSE ) */ HB_FUNC( QT_QHTTP_CURRENTDESTINATIONDEVICE ) { - hb_retptr( ( QIODevice* ) hbqt_par_QHttp( 1 )->currentDestinationDevice() ); + hb_retptrGC( hbqt_gcAllocate_QIODevice( hbqt_par_QHttp( 1 )->currentDestinationDevice(), false ) ); } /* @@ -208,7 +208,7 @@ HB_FUNC( QT_QHTTP_CURRENTID ) */ HB_FUNC( QT_QHTTP_CURRENTREQUEST ) { - hb_retptrGC( hbqt_gcAllocate_QHttpRequestHeader( new QHttpRequestHeader( hbqt_par_QHttp( 1 )->currentRequest() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QHttpRequestHeader( new QHttpRequestHeader( hbqt_par_QHttp( 1 )->currentRequest() ), true ) ); } /* @@ -216,7 +216,7 @@ HB_FUNC( QT_QHTTP_CURRENTREQUEST ) */ HB_FUNC( QT_QHTTP_CURRENTSOURCEDEVICE ) { - hb_retptr( ( QIODevice* ) hbqt_par_QHttp( 1 )->currentSourceDevice() ); + hb_retptrGC( hbqt_gcAllocate_QIODevice( hbqt_par_QHttp( 1 )->currentSourceDevice(), false ) ); } /* @@ -264,7 +264,7 @@ HB_FUNC( QT_QHTTP_HEAD ) */ HB_FUNC( QT_QHTTP_LASTRESPONSE ) { - hb_retptrGC( hbqt_gcAllocate_QHttpResponseHeader( new QHttpResponseHeader( hbqt_par_QHttp( 1 )->lastResponse() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QHttpResponseHeader( new QHttpResponseHeader( hbqt_par_QHttp( 1 )->lastResponse() ), true ) ); } /* @@ -288,7 +288,7 @@ HB_FUNC( QT_QHTTP_POST_1 ) */ HB_FUNC( QT_QHTTP_READALL ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QHttp( 1 )->readAll() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QHttp( 1 )->readAll() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtnetwork/QHttpHeader.cpp b/harbour/contrib/hbqt/qtnetwork/QHttpHeader.cpp index 35fc29873c..616b70ddf9 100644 --- a/harbour/contrib/hbqt/qtnetwork/QHttpHeader.cpp +++ b/harbour/contrib/hbqt/qtnetwork/QHttpHeader.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -87,11 +87,33 @@ * virtual ~QHttpHeader () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QHttpHeader; + QT_G_FUNC( hbqt_gcRelease_QHttpHeader ) { HB_SYMBOL_UNUSED( Cargo ); } +void * hbqt_gcAllocate_QHttpHeader( void * pObj, bool bNew ) +{ + QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); + + p->ph = pObj; + p->bNew = bNew; + p->func = hbqt_gcRelease_QHttpHeader; + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QHttpHeader ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } + return p; +} + HB_FUNC( QT_QHTTPHEADER ) { } @@ -108,7 +130,7 @@ HB_FUNC( QT_QHTTPHEADER_ADDVALUE ) */ HB_FUNC( QT_QHTTPHEADER_ALLVALUES ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QHttpHeader( 1 )->allValues( hbqt_par_QString( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QHttpHeader( 1 )->allValues( hbqt_par_QString( 2 ) ) ), true ) ); } /* @@ -164,7 +186,7 @@ HB_FUNC( QT_QHTTPHEADER_ISVALID ) */ HB_FUNC( QT_QHTTPHEADER_KEYS ) { - hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QHttpHeader( 1 )->keys() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QStringList( new QStringList( hbqt_par_QHttpHeader( 1 )->keys() ), true ) ); } /* diff --git a/harbour/contrib/hbqt/qtnetwork/QHttpRequestHeader.cpp b/harbour/contrib/hbqt/qtnetwork/QHttpRequestHeader.cpp index c0274e8a68..64dccbdee5 100644 --- a/harbour/contrib/hbqt/qtnetwork/QHttpRequestHeader.cpp +++ b/harbour/contrib/hbqt/qtnetwork/QHttpRequestHeader.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -77,32 +77,49 @@ * QHttpRequestHeader ( const QString & str ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QHttpRequestHeader; + QT_G_FUNC( hbqt_gcRelease_QHttpRequestHeader ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QHttpRequestHeader p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QHttpRequestHeader ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QHttpRequestHeader * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QHttpRequestHeader Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QHttpRequestHeader * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QHttpRequestHeader ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QHttpRequestHeader Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QHttpRequestHeader Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QHttpRequestHeader Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QHttpRequestHeader( void * pObj ) +void * hbqt_gcAllocate_QHttpRequestHeader( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QHttpRequestHeader; - HB_TRACE( HB_TR_DEBUG, ( " new_QHttpRequestHeader %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QHttpRequestHeader ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -112,7 +129,7 @@ HB_FUNC( QT_QHTTPREQUESTHEADER ) pObj = new QHttpRequestHeader() ; - hb_retptrGC( hbqt_gcAllocate_QHttpRequestHeader( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QHttpRequestHeader( pObj, true ) ); } /* * virtual int majorVersion () const diff --git a/harbour/contrib/hbqt/qtnetwork/QHttpResponseHeader.cpp b/harbour/contrib/hbqt/qtnetwork/QHttpResponseHeader.cpp index d8eef62364..ba1b90b28d 100644 --- a/harbour/contrib/hbqt/qtnetwork/QHttpResponseHeader.cpp +++ b/harbour/contrib/hbqt/qtnetwork/QHttpResponseHeader.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -77,32 +77,49 @@ * QHttpResponseHeader ( int code, const QString & text = QString(), int majorVer = 1, int minorVer = 1 ) */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QHttpResponseHeader; + QT_G_FUNC( hbqt_gcRelease_QHttpResponseHeader ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QHttpResponseHeader p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QHttpResponseHeader ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QHttpResponseHeader * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QHttpResponseHeader Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QHttpResponseHeader * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QHttpResponseHeader ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QHttpResponseHeader Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QHttpResponseHeader Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QHttpResponseHeader Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QHttpResponseHeader( void * pObj ) +void * hbqt_gcAllocate_QHttpResponseHeader( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QHttpResponseHeader; - HB_TRACE( HB_TR_DEBUG, ( " new_QHttpResponseHeader %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QHttpResponseHeader ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -112,7 +129,7 @@ HB_FUNC( QT_QHTTPRESPONSEHEADER ) pObj = new QHttpResponseHeader() ; - hb_retptrGC( hbqt_gcAllocate_QHttpResponseHeader( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QHttpResponseHeader( pObj, true ) ); } /* * virtual int majorVersion () const diff --git a/harbour/contrib/hbqt/qtnetwork/QNetworkRequest.cpp b/harbour/contrib/hbqt/qtnetwork/QNetworkRequest.cpp index 5dc2dfc800..52efd56c11 100644 --- a/harbour/contrib/hbqt/qtnetwork/QNetworkRequest.cpp +++ b/harbour/contrib/hbqt/qtnetwork/QNetworkRequest.cpp @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org @@ -96,32 +96,49 @@ * ~QNetworkRequest () */ +typedef struct +{ + void * ph; + bool bNew; + QT_G_FUNC_PTR func; +} QGC_POINTER_QNetworkRequest; + QT_G_FUNC( hbqt_gcRelease_QNetworkRequest ) { - QGC_POINTER * p = ( QGC_POINTER * ) Cargo; + QGC_POINTER * p = ( QGC_POINTER * ) Cargo; - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QNetworkRequest p=%p", p ) ); - HB_TRACE( HB_TR_DEBUG, ( "hbqt_gcRelease_QNetworkRequest ph=%p", p->ph ) ); - - if( p && p->ph ) + if( p && p->bNew ) { - delete ( ( QNetworkRequest * ) p->ph ); - p->ph = NULL; - HB_TRACE( HB_TR_DEBUG, ( "YES hbqt_gcRelease_QNetworkRequest Object deleted! %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + if( p->ph ) + { + delete ( ( QNetworkRequest * ) p->ph ); + HB_TRACE( HB_TR_DEBUG, ( "YES_rel_QNetworkRequest ph=%p %i B %i KB", p->ph, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + p->ph = NULL; + } + else + { + HB_TRACE( HB_TR_DEBUG, ( "DEL_rel_QNetworkRequest Object already deleted!" ) ); + } } else { - HB_TRACE( HB_TR_DEBUG, ( "DEL hbqt_gcRelease_QNetworkRequest Object Already deleted!" ) ); + HB_TRACE( HB_TR_DEBUG, ( "PTR_rel_QNetworkRequest Object not created with - new" ) ); + p->ph = NULL; } } -void * hbqt_gcAllocate_QNetworkRequest( void * pObj ) +void * hbqt_gcAllocate_QNetworkRequest( void * pObj, bool bNew ) { QGC_POINTER * p = ( QGC_POINTER * ) hb_gcAllocate( sizeof( QGC_POINTER ), hbqt_gcFuncs() ); p->ph = pObj; + p->bNew = bNew; p->func = hbqt_gcRelease_QNetworkRequest; - HB_TRACE( HB_TR_DEBUG, ( " new_QNetworkRequest %i B %i KB", ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + + if( bNew ) + { + HB_TRACE( HB_TR_DEBUG, ( " _new_QNetworkRequest ph=%p %i B %i KB", pObj, ( int ) hb_xquery( 1001 ), hbqt_getmemused() ) ); + } return p; } @@ -131,14 +148,14 @@ HB_FUNC( QT_QNETWORKREQUEST ) pObj = new QNetworkRequest() ; - hb_retptrGC( hbqt_gcAllocate_QNetworkRequest( pObj ) ); + hb_retptrGC( hbqt_gcAllocate_QNetworkRequest( pObj, true ) ); } /* * QVariant attribute ( Attribute code, const QVariant & defaultValue = QVariant() ) const */ HB_FUNC( QT_QNETWORKREQUEST_ATTRIBUTE ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QNetworkRequest( 1 )->attribute( ( QNetworkRequest::Attribute ) hb_parni( 2 ), ( HB_ISPOINTER( 3 ) ? *hbqt_par_QVariant( 3 ) : QVariant() ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QNetworkRequest( 1 )->attribute( ( QNetworkRequest::Attribute ) hb_parni( 2 ), ( HB_ISPOINTER( 3 ) ? *hbqt_par_QVariant( 3 ) : QVariant() ) ) ), true ) ); } /* @@ -154,7 +171,7 @@ HB_FUNC( QT_QNETWORKREQUEST_HASRAWHEADER ) */ HB_FUNC( QT_QNETWORKREQUEST_HEADER ) { - hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QNetworkRequest( 1 )->header( ( QNetworkRequest::KnownHeaders ) hb_parni( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QVariant( new QVariant( hbqt_par_QNetworkRequest( 1 )->header( ( QNetworkRequest::KnownHeaders ) hb_parni( 2 ) ) ), true ) ); } /* @@ -162,7 +179,7 @@ HB_FUNC( QT_QNETWORKREQUEST_HEADER ) */ HB_FUNC( QT_QNETWORKREQUEST_RAWHEADER ) { - hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QNetworkRequest( 1 )->rawHeader( *hbqt_par_QByteArray( 2 ) ) ) ) ); + hb_retptrGC( hbqt_gcAllocate_QByteArray( new QByteArray( hbqt_par_QNetworkRequest( 1 )->rawHeader( *hbqt_par_QByteArray( 2 ) ) ), true ) ); } /* @@ -202,7 +219,7 @@ HB_FUNC( QT_QNETWORKREQUEST_SETURL ) */ HB_FUNC( QT_QNETWORKREQUEST_URL ) { - hb_retptrGC( hbqt_gcAllocate_QUrl( new QUrl( hbqt_par_QNetworkRequest( 1 )->url() ) ) ); + hb_retptrGC( hbqt_gcAllocate_QUrl( new QUrl( hbqt_par_QNetworkRequest( 1 )->url() ), true ) ); } diff --git a/harbour/contrib/hbqt/qtnetwork/TQFtp.prg b/harbour/contrib/hbqt/qtnetwork/TQFtp.prg index 9f0ab0f1cd..9fb4e66df6 100644 --- a/harbour/contrib/hbqt/qtnetwork/TQFtp.prg +++ b/harbour/contrib/hbqt/qtnetwork/TQFtp.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtnetwork/TQHttp.prg b/harbour/contrib/hbqt/qtnetwork/TQHttp.prg index 194ee3a050..37df2fa70d 100644 --- a/harbour/contrib/hbqt/qtnetwork/TQHttp.prg +++ b/harbour/contrib/hbqt/qtnetwork/TQHttp.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtnetwork/TQHttpHeader.prg b/harbour/contrib/hbqt/qtnetwork/TQHttpHeader.prg index 7fa2b7baf0..afe9bc41fb 100644 --- a/harbour/contrib/hbqt/qtnetwork/TQHttpHeader.prg +++ b/harbour/contrib/hbqt/qtnetwork/TQHttpHeader.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtnetwork/TQHttpRequestHeader.prg b/harbour/contrib/hbqt/qtnetwork/TQHttpRequestHeader.prg index 05157046c4..36ab6afd13 100644 --- a/harbour/contrib/hbqt/qtnetwork/TQHttpRequestHeader.prg +++ b/harbour/contrib/hbqt/qtnetwork/TQHttpRequestHeader.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtnetwork/TQHttpResponseHeader.prg b/harbour/contrib/hbqt/qtnetwork/TQHttpResponseHeader.prg index 9a1ce0e6d6..e5eda56301 100644 --- a/harbour/contrib/hbqt/qtnetwork/TQHttpResponseHeader.prg +++ b/harbour/contrib/hbqt/qtnetwork/TQHttpResponseHeader.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/qtnetwork/TQNetworkRequest.prg b/harbour/contrib/hbqt/qtnetwork/TQNetworkRequest.prg index 3a51a08103..24d1269347 100644 --- a/harbour/contrib/hbqt/qtnetwork/TQNetworkRequest.prg +++ b/harbour/contrib/hbqt/qtnetwork/TQNetworkRequest.prg @@ -12,7 +12,7 @@ * Harbour Project source code: * QT wrapper main header * - * Copyright 2009 Pritpal Bedi + * Copyright 2009-2010 Pritpal Bedi * * Copyright 2009 Marcos Antonio Gambeta * www - http://www.harbour-project.org diff --git a/harbour/contrib/hbqt/tests/demoqt.prg b/harbour/contrib/hbqt/tests/demoqt.prg index 15dc0da08d..dd349622ba 100644 --- a/harbour/contrib/hbqt/tests/demoqt.prg +++ b/harbour/contrib/hbqt/tests/demoqt.prg @@ -108,7 +108,9 @@ EXIT PROCEDURE Qt_End() /*----------------------------------------------------------------------*/ FUNCTION My_Events() -HBQT_DEBUG( "Key Pressed" ) + + HB_TRACE( HB_TR_ALWAYS, "Key Pressed" ) + RETURN nil /*----------------------------------------------------------------------*/ @@ -122,22 +124,8 @@ PROCEDURE Main() s_events := QT_EVENTS_NEW() s_slots := QT_SLOTS_NEW() - DO CASE - CASE HbQt_Set_Release_Method() == HBQT_RELEASE_WITH_DELETE -HBQT_DEBUG( "HbQt_Set_Release_Method DEFAULT : HBQT_RELEASE_WITH_DELETE" ) - CASE HbQt_Set_Release_Method() == HBQT_RELEASE_WITH_DESTRUTOR -HBQT_DEBUG( "HbQt_Set_Release_Method DEFAULT : HBQT_RELEASE_WITH_DESTRUTOR" ) - CASE HbQt_Set_Release_Method() == HBQT_RELEASE_WITH_DELETE_LATER -HBQT_DEBUG( "HbQt_Set_Release_Method DEFAULT : HBQT_RELEASE_WITH_DELETE_LATER" ) - ENDCASE - -// HbQt_Set_Release_Method( HBQT_RELEASE_WITH_DELETE_LATER ) -//HBQT_DEBUG( "HbQt_Set_Release_Method SET : HBQT_RELEASE_WITH_DELETE_LATER" ) - HbQt_Set_Release_Method( HBQT_RELEASE_WITH_DELETE ) -HBQT_DEBUG( "HbQt_Set_Release_Method SET : HBQT_RELEASE_WITH_DELETE" ) - -HBQT_DEBUG( " " ) -HBQT_DEBUG( "-----------------b-----------------" ) +HB_TRACE( HB_TR_ALWAYS, ( " " ) ) +HB_TRACE( HB_TR_ALWAYS, ( "-----------------b-----------------" ) ) FOR i := 1 TO 1 oWnd := QMainWindow():new() @@ -171,20 +159,21 @@ HBQT_DEBUG( "-----------------b-----------------" ) oProg := Build_ProgressBar( oDA, { 30,300 }, { 200,30 } ) aList := Build_ListBox( oDA, { 310,240 }, { 150, 100 } ) + oWnd:installEventFilter( s_events ) QT_EVENTS_CONNECT( s_events, oWnd, 6, {|o,e| My_Events( o, e ) } ) oWnd:Show() s_qApp:exec() -HBQT_DEBUG( "----------------- s_qApp:exec -----------------" ) +HB_TRACE( HB_TR_ALWAYS, ( "----------------- qApp:exec -----------------" ) ) - HbQt_Set_Release_Method( HBQT_RELEASE_WITH_DELETE ) -HBQT_DEBUG( "HbQt_Set_Release_Method SET : HBQT_RELEASE_WITH_DELETE" ) + //HbQt_Set_Release_Method( HBQT_RELEASE_WITH_DELETE ) +//HB_TRACE( HB_TR_ALWAYS, ( "HbQt_Set_Release_Method SET : HBQT_RELEASE_WITH_DELETE" ) ) xReleaseMemory( { oBtn, oLabel, oProg, oSBar, aGrid, aList, aMenu, aTool, aTabs, oDA, oWnd } ) -HBQT_DEBUG( "-------------------- exit -------------------" ) +HB_TRACE( HB_TR_ALWAYS, ( "-------------------- exit -------------------" ) ) RETURN @@ -193,7 +182,7 @@ HBQT_DEBUG( "-------------------- exit -------------------" ) FUNCTION xReleaseMemory( aObj ) #if 1 LOCAL i -HBQT_DEBUG( "----------------- Releasing Memory -----------------" ) +HB_TRACE( HB_TR_ALWAYS, ( "----------------- Releasing Memory -----------------" ) ) FOR i := 1 TO len( aObj ) IF hb_isObject( aObj[ i ] ) aObj[ i ]:pPtr := 1 @@ -201,7 +190,7 @@ HBQT_DEBUG( "----------------- Releasing Memory -----------------" ) xReleaseMemory( aObj[ i ] ) ENDIF NEXT -HBQT_DEBUG( "------------------ Memory Released ------------------" ) +HB_TRACE( HB_TR_ALWAYS, ( "------------------ Memory Released ------------------" ) ) #else HB_SYMBOL_UNUSED( aObj ) #endif @@ -478,7 +467,7 @@ STATIC FUNCTION Build_TreeView( oWnd ) oTV := QTreeView():new( oWnd ) oTV:setMouseTracking( .t. ) - //QT_SLOTS_CONNECT( s_slots, oTV, QT_EVE_HOVERED, {|o,i| HBQT_DEBUG( "oTV:hovered" ) } ) + //QT_SLOTS_CONNECT( s_slots, oTV, QT_EVE_HOVERED, {|o,i| HB_TRACE( HB_TR_ALWAYS, ( "oTV:hovered" ) } ) oDirModel := QDirModel():new() oTV:setModel( oDirModel ) oTV:move( 5, 7 ) @@ -494,7 +483,7 @@ STATIC FUNCTION Build_ListBox( oWnd, aPos, aSize ) oListBox := QListView():New( oWnd ) oListBox:setMouseTracking( .t. ) - //QT_SLOTS_CONNECT( s_slots, oListBox, QT_EVE_HOVERED, {|o,i| HBQT_DEBUG( "oListBox:hovered" ) } ) + //QT_SLOTS_CONNECT( s_slots, oListBox, QT_EVE_HOVERED, {|o,i| HB_TRACE( HB_TR_ALWAYS, ( "oListBox:hovered" ) } ) oStrList := QStringList():new() @@ -549,7 +538,6 @@ STATIC FUNCTION Build_Controls( oWnd ) oComboBox:addItem( "First" ) oComboBox:addItem( "Second" ) oComboBox:addItem( "Third" ) - //QT_SLOTS_CONNECT( s_slots, oComboBox, QT_EVE_HIGHLIGHTED_I , {|o,i| HBQT_DEBUG( oComboBox:itemText( i ) ) } ) QT_SLOTS_CONNECT( s_slots, oComboBox, QT_EVE_CURRENTINDEXCHANGED_I, {|o,i| o := o, i := i, MsgInfo( oComboBox:itemText( i ) ) } ) oComboBox:move( 5, 60 ) oComboBox:resize( 345, 30 ) diff --git a/harbour/contrib/hbxbp/tests/demoxbp.prg b/harbour/contrib/hbxbp/tests/demoxbp.prg index 9bc738a68f..f766ed05d4 100644 --- a/harbour/contrib/hbxbp/tests/demoxbp.prg +++ b/harbour/contrib/hbxbp/tests/demoxbp.prg @@ -94,10 +94,6 @@ STATIC oMLE PROCEDURE Main() - //HBQT_SET_RELEASE_METHOD( HBQT_RELEASE_WITH_DESTRUTOR ) // Exits cleanly - HBQT_SET_RELEASE_METHOD( HBQT_RELEASE_WITH_DELETE ) // Exits cleanly - //HBQT_SET_RELEASE_METHOD( HBQT_RELEASE_WITH_DELETE_LATER ) // Exit with GPF - //hb_threadStart( {|| _BuildADialog() } ) _BuildADialog() diff --git a/harbour/contrib/hbxbp/xbpgeneric.prg b/harbour/contrib/hbxbp/xbpgeneric.prg index ea5506280d..738950db85 100644 --- a/harbour/contrib/hbxbp/xbpgeneric.prg +++ b/harbour/contrib/hbxbp/xbpgeneric.prg @@ -107,6 +107,7 @@ INIT PROCEDURE hbxbp_Start() /*----------------------------------------------------------------------*/ EXIT PROCEDURE hbxbp_End() + HB_TRACE( HB_TR_ALWAYS, "................................... EXIT PROCEDURE hbxbp_End() begin " ) t_oAppWindow := NIL @@ -114,8 +115,11 @@ EXIT PROCEDURE hbxbp_End() s_oDeskTop:oWidget:pPtr := 0 endif - s_oApp:quit() + /* These must never be called from here as QApplication.cpp's EXIT routine does it */ + //s_oApp:quit() + //s_oApp := NIL + HB_TRACE( HB_TR_ALWAYS, "................................... EXIT PROCEDURE hbxbp_End() end " ) RETURN /*----------------------------------------------------------------------*/ @@ -396,3 +400,4 @@ FUNCTION HbXbp_SetCodecForTr( cCodec ) RETURN NIL /*----------------------------------------------------------------------*/ + diff --git a/harbour/contrib/hbxbp/xbpmenubar.prg b/harbour/contrib/hbxbp/xbpmenubar.prg index 1e42469061..bb2d71699b 100644 --- a/harbour/contrib/hbxbp/xbpmenubar.prg +++ b/harbour/contrib/hbxbp/xbpmenubar.prg @@ -260,9 +260,12 @@ METHOD xbpMenuBar:delItem( nItemIndex ) ENDIF ADEL( ::aMenuItems, nItemIndex ) ASIZE( ::aMenuItems, LEN( ::aMenuItems ) - 1 ) + IF hb_isObject( oAction ) .AND. __ObjGetClsName( oAction ) == "QACTION" - Qt_Slots_disConnect( ::pSlots, oAction, "triggered(bool)" ) - Qt_Slots_disConnect( ::pSlots, oAction, "hovered()" ) + IF !oAction:isSeparator() + Qt_Slots_disConnect( ::pSlots, oAction, "triggered(bool)" ) + Qt_Slots_disConnect( ::pSlots, oAction, "hovered()" ) + ENDIF ::oWidget:removeAction( oAction ) oAction:pPtr := 0 oAction := NIL @@ -289,11 +292,10 @@ METHOD xbpMenuBar:placeItem( xCaption, bAction, nStyle, nAttrb, nMode, nPos ) cType := valtype( xCaption ) DO CASE CASE cType == "U" .OR. empty( xCaption ) .OR. nStyle == XBPMENUBAR_MIS_SEPARATOR - oAction := QAction() IF lInsert - oAction:pPtr := ::oWidget:insertSeparator() + oAction := QAction():configure( ::oWidget:insertSeparator() ) ELSE - oAction:pPtr := ::oWidget:addSeparator() + QAction():configure( ::oWidget:addSeparator() ) ENDIF aItem := { QMF_SEPARATOR, 0, 0, NIL, oAction }