From a4beb6a684df184a7113bef488d85e83998cac52 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Fri, 22 Jun 2012 22:12:00 +0000 Subject: [PATCH] 2012-06-22 15:09 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/hbmk2_qt.hb ! Optimized to not add code for constructors which do not have Qt objects. Results can be viewed in QLibraryInfo.cpp. --- harbour/ChangeLog | 5 +++++ harbour/contrib/hbqt/hbmk2_qt.hb | 30 +++++++++++++++++++++--------- 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index f1e558c796..691c4964e3 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,11 @@ The license applies to all entries newer than 2009-04-28. */ +2012-06-22 15:09 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/hbmk2_qt.hb + ! Optimized to not add code for constructors which do not + have Qt objects. Results can be viewed in QLibraryInfo.cpp. + 2012-06-22 12:47 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/hbmk2_qt.hb * contrib/hbqt/qtcore/hbqt.h diff --git a/harbour/contrib/hbqt/hbmk2_qt.hb b/harbour/contrib/hbqt/hbmk2_qt.hb index cd7c700369..a903ea6783 100644 --- a/harbour/contrib/hbqt/hbmk2_qt.hb +++ b/harbour/contrib/hbqt/hbmk2_qt.hb @@ -1044,6 +1044,7 @@ CREATE CLASS HbQtSource VAR isList INIT .F. VAR isDestructor INIT .T. VAR isConstructor INIT .F. + VAR isQtObjectAvailable INIT .F. VAR isObject INIT .T. VAR isDetached INIT .F. VAR areMethodsClubbed INIT .T. @@ -1337,7 +1338,15 @@ METHOD HbQtSource:build() AAdd( aLine, "" ) ENDIF - IF ::isConstructor + FOR i := 3 TO Len( ::new_ ) - 1 + IF !( Left( LTrim( ::new_[ i ] ), 2 ) == "//" ) + IF "__HB_RETPTRGC__(" $ ::new_[ i ] + ::isQtObjectAvailable := .T. + ENDIF + ENDIF + NEXT + + IF ::isConstructor .AND. ::isQtObjectAvailable FOR i := 3 TO Len( ::new_ ) - 1 IF !( Left( LTrim( ::new_[ i ] ), 2 ) == "//" ) IF "__HB_RETPTRGC__(" $ ::new_[ i ] @@ -1593,12 +1602,14 @@ METHOD HbQtSource:getConstructor() AAdd( aLine, "#if QT_VERSION >= " + ::cQtVer ) ENDIF IF ::isConstructor - IF ::isList - AAdd( aLine, " " + cObjPfx + ::cQtObject + "< void * > * pObj = NULL;" ) - ELSE - AAdd( aLine, " " + cObjPfx + ::cQtObject + " * pObj = NULL;" ) + IF ::isQtObjectAvailable + IF ::isList + AAdd( aLine, " " + cObjPfx + ::cQtObject + "< void * > * pObj = NULL;" ) + ELSE + AAdd( aLine, " " + cObjPfx + ::cQtObject + " * pObj = NULL;" ) + ENDIF + AAdd( aLine, " " ) ENDIF - AAdd( aLine, " " ) FOR i := 3 TO Len( ::new_ ) - 1 IF !( Left( LTrim( ::new_[ i ] ), 2 ) == "//" ) IF "__HB_RETPTRGC__(" $ ::new_[ i ] @@ -1615,9 +1626,10 @@ METHOD HbQtSource:getConstructor() ENDIF ENDIF NEXT - AAdd( aLine, " " ) - - AAdd( aLine, ' hb_itemReturnRelease( hbqt_bindSetHbObject( NULL, pObj, "' + 'HB_' + upper( ::cQtObject ) +'", hbqt_del_' + ::cQtObject + ', ' + qth_get_bits( ::cQtObject, ! ::isDetached ) + ' ) );' ) + IF ::isQtObjectAvailable + AAdd( aLine, " " ) + AAdd( aLine, ' hb_itemReturnRelease( hbqt_bindSetHbObject( NULL, pObj, "' + 'HB_' + upper( ::cQtObject ) +'", hbqt_del_' + ::cQtObject + ', ' + qth_get_bits( ::cQtObject, ! ::isDetached ) + ' ) );' ) + ENDIF ELSE FOR i := 3 TO Len( ::new_ ) - 1 AAdd( aLine, ::new_[ i ] )