From ee390e4586d1a8b4a30f8a25d0ffcc9553158a1b Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Tue, 5 Apr 2011 01:30:33 +0000 Subject: [PATCH] 2011-04-04 18:22 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtcore/qth/HBQString.qth * contrib/hbqt/qtcore/qth/QByteArray.qth * contrib/hbqt/qtcore/qth/QLocale.qth * contrib/hbqt/qtcore/qth/QVariant.qth * contrib/hbqt/qtgui/qth/QLabel.qth * contrib/hbqt/qtgui/qth/QLCDNumber.qth * contrib/hbqt/qtgui/qth/QMatrix.qth * contrib/hbqt/qtgui/qth/QPainter.qth * contrib/hbqt/qtgui/qth/QTransform.qth * contrib/hbqt/qtgui/qth/QWidget.qth * contrib/hbqt/qtnetwork/qth/QHttp.qth - Commented out: methods of duplicating parameters (Harbour types) to go through the modified generator engine. * contrib/hbqt/hbmk2_qt.hbs ! Restructured: c++ code which now handles arguments efficiently. hbIDE seems to be working fine but regression cannot be ruled out. NOTE: code is now less tolerent to number and type of arguments. ;TOREVIEW: all c++ source files one-by-one to detect wrong constructs which might be waiting to be fixed. --- harbour/ChangeLog | 22 + harbour/contrib/hbqt/hbmk2_qt.hbs | 535 +++++++++--------- harbour/contrib/hbqt/qtcore/qth/HBQString.qth | 60 +- .../contrib/hbqt/qtcore/qth/QByteArray.qth | 40 +- harbour/contrib/hbqt/qtcore/qth/QLocale.qth | 16 +- harbour/contrib/hbqt/qtcore/qth/QVariant.qth | 1 - harbour/contrib/hbqt/qtgui/qth/QLCDNumber.qth | 4 +- harbour/contrib/hbqt/qtgui/qth/QLabel.qth | 2 +- harbour/contrib/hbqt/qtgui/qth/QMatrix.qth | 4 +- harbour/contrib/hbqt/qtgui/qth/QPainter.qth | 163 +----- harbour/contrib/hbqt/qtgui/qth/QTransform.qth | 4 +- harbour/contrib/hbqt/qtgui/qth/QWidget.qth | 4 +- harbour/contrib/hbqt/qtnetwork/qth/QHttp.qth | 2 +- 13 files changed, 375 insertions(+), 482 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 4016f3414d..60326b2622 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,28 @@ The license applies to all entries newer than 2009-04-28. */ +2011-04-04 18:22 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbqt/qtcore/qth/HBQString.qth + * contrib/hbqt/qtcore/qth/QByteArray.qth + * contrib/hbqt/qtcore/qth/QLocale.qth + * contrib/hbqt/qtcore/qth/QVariant.qth + * contrib/hbqt/qtgui/qth/QLabel.qth + * contrib/hbqt/qtgui/qth/QLCDNumber.qth + * contrib/hbqt/qtgui/qth/QMatrix.qth + * contrib/hbqt/qtgui/qth/QPainter.qth + * contrib/hbqt/qtgui/qth/QTransform.qth + * contrib/hbqt/qtgui/qth/QWidget.qth + * contrib/hbqt/qtnetwork/qth/QHttp.qth + - Commented out: methods of duplicating parameters (Harbour types) + to go through the modified generator engine. + + * contrib/hbqt/hbmk2_qt.hbs + ! Restructured: c++ code which now handles arguments efficiently. + hbIDE seems to be working fine but regression cannot be ruled out. + NOTE: code is now less tolerent to number and type of arguments. + ;TOREVIEW: all c++ source files one-by-one to detect wrong + constructs which might be waiting to be fixed. + 2011-04-04 10:48 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/src/rtl/gtxwc/gtxwc.c % small optimization diff --git a/harbour/contrib/hbqt/hbmk2_qt.hbs b/harbour/contrib/hbqt/hbmk2_qt.hbs index 206d3fb050..1ea0a35676 100644 --- a/harbour/contrib/hbqt/hbmk2_qt.hbs +++ b/harbour/contrib/hbqt/hbmk2_qt.hbs @@ -34,7 +34,7 @@ #include "hbclass.ch" #define I_( x ) hb_i18n_gettext( x ) -#define _GEN_TRACE_ +#define _xGEN_TRACE_ #if defined( __HBSCRIPT__HBMK ) @@ -1073,14 +1073,15 @@ CREATE CLASS HbQtSource METHOD parseProto( cProto, fBody_ ) METHOD parseVariables( cProto ) METHOD build() - METHOD getConstructor( nClsType ) + METHOD getConstructor() METHOD getConstructorW() METHOD buildCppCode( oMtd ) METHOD buildMethodBody( oMtd ) METHOD buildDOC() - METHOD getMethodBody( oMtd, cMtdName, aMethods, nClsType ) + METHOD getMethodBody( oMtd, cMtdName, aMethods ) METHOD normalizeCmd( oMtd, v ) METHOD getReturnAsList( oMtd, FP, cPrefix ) + METHOD getReturnMethod( oMtd, lAddRet ) ENDCLASS @@ -1286,9 +1287,7 @@ METHOD HbQtSource:new( cQtModule, cQtVer, cQTHFileName, cCPPFileName, cDOCFileNa /*----------------------------------------------------------------------*/ METHOD HbQtSource:build() - LOCAL i, s, oMtd, tmp, tmp1, n, k - LOCAL aLine - LOCAL uQtObject + LOCAL i, s, oMtd, tmp, tmp1, n, k, aLine, uQtObject uQtObject := upper( ::cQtObject ) @@ -1638,11 +1637,9 @@ METHOD HbQtSource:build() /*----------------------------------------------------------------------*/ -METHOD HbQtSource:getConstructor( nClsType ) +METHOD HbQtSource:getConstructor() LOCAL i, s, aLine := {} - HB_SYMBOL_UNUSED( nClsType ) - IF ::isConstructor IF ::isList aadd( aLine, " " + ::cQtObject + "< void * > * pObj = NULL;" ) @@ -1680,7 +1677,7 @@ METHOD HbQtSource:getConstructor( nClsType ) /*----------------------------------------------------------------------*/ METHOD HbQtSource:getConstructorW() - LOCAL aLine := ::getConstructor( 0 ) + LOCAL aLine := ::getConstructor() aeval( aLine, {|e,i| aLine[ i ] := strtran( e, "hbqt_itemPushReturn", "hbqt_create_objectGC" ) } ) aeval( aLine, {|e,i| aLine[ i ] := strtran( e, "hb_stackSelfItem()" , '"HB_' + upper( ::cQtObject ) + '"' ) } ) @@ -1692,6 +1689,8 @@ METHOD HbQtSource:getConstructorW() METHOD HbQtSource:normalizeCmd( oMtd, v ) LOCAL FP + oMtd:cCmd := StrTran( oMtd:cCmd, "( )", "()" ) + IF ! oMtd:isConstructor FP := strtran( oMtd:cCmd, "hbqt_par_" + ::cQtObject + "( 1 )", v, 1, 1 ) ELSE @@ -1767,31 +1766,78 @@ METHOD HbQtSource:getReturnAsList( oMtd, FP, cPrefix ) /*----------------------------------------------------------------------*/ -METHOD HbQtSource:getMethodBody( oMtd, cMtdName, aMethods, nClsType ) - LOCAL FP, cTmp, n, v, t_, q, nStrCnt, ooMtd, i, a_ - LOCAL txt_:= {} +METHOD HbQtSource:getReturnMethod( oMtd, lAddRet ) + LOCAL txt_, nStrCnt, n, FP, v + + txt_:= {} + + v := "p" /* NEVER change this */ + FP := ::normalizeCmd( oMtd, v ) + + IF ! empty( oMtd:aPre ) + FOR n := 1 TO len( oMtd:aPre ) + aadd( txt_, oMtd:aPre[ n,1 ] ) + NEXT + aadd( txt_, "" ) + ENDIF + + /* Manage detached Argument */ + IF oMtd:nDetach > 0 + aadd( txt_, "hbqt_detachgcpointer( " + hb_ntos( oMtd:nDetach ) + " );" ) + ENDIF + + nStrCnt := 0 + DO WHILE "%%%" $ FP + ++nStrCnt + FP := StrTran( FP, "%%%", StrZero( nStrCnt, 2, 0 ), 1, 1 ) + aadd( txt_, "void * pText" + StrZero( nStrCnt, 2, 0 ) + " = NULL;" ) + ENDDO + + aeval( ::getReturnAsList( oMtd, FP, "" ), {|e| aadd( txt_, e ) } ) + + FOR n := nStrCnt TO 1 STEP -1 + aadd( txt_, "hb_strfree( pText" + StrZero( n, 2, 0 ) + " );" ) + NEXT + + /* Return values back to PRG */ + IF ! empty( oMtd:aPre ) + aadd( txt_, "" ) + FOR n := 1 TO len( oMtd:aPre ) + aadd( txt_, oMtd:aPre[ n,4 ] + "( " + oMtd:aPre[ n,3 ] + ", " + hb_ntos( oMtd:aPre[ n,2 ] ) + " );" ) + NEXT + ENDIF + + IF lAddRet + aadd( txt_, "return;" ) + ENDIF + + RETURN txt_ + +/*----------------------------------------------------------------------*/ + +METHOD HbQtSource:getMethodBody( oMtd, cMtdName, aMethods ) + LOCAL cTmp, n, v, ooMtd, i, nArgs, nArgGrps + LOCAL txt_:= {}, a_:= {}, b_:= {}, c_:= {}, d_:= {} + LOCAL cCrc, nMtds, lInIf, lFirst, nTySame HB_SYMBOL_UNUSED( cMtdName ) - // list all the overloaded methods - a_ := {} + /* check for methods already been worked on */ + IF ascan( ::func_, {|e_| e_[ 1 ] == oMtd:cFun } ) > 0 + RETURN {} + ENDIF + aadd( ::func_, { oMtd:cFun, 0, "" } ) + + oMtd:cHBFunc := oMtd:cFun + oMtd:cCmd := StrTran( oMtd:cCmd, "( )", "()" ) + FOR EACH ooMtd IN aMethods IF ooMtd:cFun == oMtd:cFun - aadd( a_, ooMtd ) + aadd( a_, ooMtd ) ENDIF NEXT - oMtd:cCmd := StrTran( oMtd:cCmd, "( )", "()" ) - - // check for methods already worked - IF ( ascan( ::func_, {|e_| e_[ 1 ] == oMtd:cFun } ) ) > 0 - return {} - ENDIF - - oMtd:cHBFunc := oMtd:cFun - aadd( ::func_, { oMtd:cFun, 0, "" } ) - -// aadd( txt_, "/* " + strtran( oMtd:cProto, chr( 13 ) ) + " */" ) + /* Display method prototypes on top of the method body */ FOR EACH ooMtd IN a_ aadd( txt_, "/* " + strtran( ooMtd:cProto, chr( 13 ) ) + " */" ) NEXT @@ -1801,139 +1847,177 @@ METHOD HbQtSource:getMethodBody( oMtd, cMtdName, aMethods, nClsType ) aadd( txt_, "HB_FUNC_STATIC( " + upper( oMtd:cHBFunc ) + " )" ) aadd( txt_, "{" ) #ifdef _GEN_TRACE_ -// aadd( txt_, ' HB_TRACE( ' + ::cTrMode + ', ( "' + ::cQtObject + ":" + oMtd:cHBFunc + '" ) );' ) - aadd( txt_, ' HB_TRACE( HB_TR_DEBUG, ( "' + ::cQtObject + ":" + oMtd:cHBFunc + '" ) );' ) + aadd( txt_, ' HB_TRACE( ' + ::cTrMode + ', ( "' + ::cQtObject + ":" + oMtd:cHBFunc + '" ) );' ) + //aadd( txt_, ' HB_TRACE( HB_TR_DEBUG, ( "' + ::cQtObject + ":" + oMtd:cHBFunc + '" ) );' ) #endif + /* If method is manually written in .qth - no more processing */ IF !empty( oMtd:fBody_ ) aeval( oMtd:fBody_, {|e| aadd( txt_, e ) } ) - ELSE - IF ! oMtd:isConstructor - cTmp := ::cQtObject + iif( ::isList, "< void * >", "" ) - IF nClsType == 0 - aadd( txt_, " " + cTmp + " * " + v + " = ( " + cTmp + " * ) hbqt_pPtrFromObj( 0 );" ) - ELSEIF nClsType == 1 - aadd( txt_, " " + cTmp + " * " + v + " = ( " + cTmp + " * ) hbqt_getqtptr();" ) - ENDIF - ENDIF - - IF len( a_ ) == 1 .AND. a_[ 1 ]:nArgs == 0 - IF ! oMtd:isConstructor - FP := ::normalizeCmd( a_[ 1 ], v ) - - aadd( txt_, " if( " + v + " )" ) - aadd( txt_, " {" ) - aeval( ::getReturnAsList( a_[ 1 ], FP, " " ), {|e| aadd( txt_, e ) } ) - IF oMtd:oRet:cCast == "void" - aadd( txt_, " hb_itemReturn( hb_stackSelfItem() );" ) - ENDIF - aadd( txt_, " }" ) - ENDIF - ELSE - IF ! oMtd:isConstructor - aadd( txt_, " if( " + v + " )" ) - aadd( txt_, " {" ) - aadd( txt_, " int pcount = hb_pcount();" ) - aadd( txt_, " " ) - ENDIF - - FOR i := 1 TO len( a_ ) - FP := ::normalizeCmd( a_[ i ], v ) - - DO CASE - CASE a_[ i ]:nArgs == 0 - aadd( txt_, " " + iif( i > 1 , "else if", "if" ) + "( pcount == 0 )" ) - aadd( txt_, " {" ) - aeval( ::getReturnAsList( a_[ i ], FP, " " ), {|e| aadd( txt_, e ) } ) -#if 0 - IF oMtd:oRet:cCast == "void" - aadd( txt_, " hb_itemReturn( hb_stackSelfItem() );" ) - ENDIF -#endif - aadd( txt_, " }" ) - - OTHERWISE - t_ := __TY_TYPEScpp( a_[ i ], a_[ i ]:nArgsReal ) // return string of checks for real arguments - - IF ! empty( t_ ) - t_ := " && " + t_ - ENDIF - - FOR n := a_[ i ]:nArgsReal + 1 TO a_[ i ]:nArgs - t_ += " && ( pcount < " + hb_ntos( n )+ " || " + hbide_paramCheckStrCpp( a_[i]:hArgs[ n ]:cTypeHB, n, a_[i]:hArgs[ n ]:cCast ) + " )" - NEXT - - aadd( txt_, " " + iif( i > 1 , "else if", "if" ) + "( pcount " + ; - iif( a_[i]:nArgsReal == a_[i]:nArgs , "==", "<=" ) + " " + ; - hb_ntos( a_[i]:nArgs ) + t_ + " )" ) - - aadd( txt_, " {" ) - - IF ! empty( a_[ i ]:aPre ) - FOR n := 1 TO len( a_[i]:aPre ) - aadd( txt_, " " + a_[i]:aPre[ n ][ 1 ] ) - NEXT - aadd( txt_, "" ) - ENDIF - - /* Manage detached Argument */ - IF a_[ i ]:nDetach > 0 - aadd( txt_, " hbqt_detachgcpointer( " + hb_ntos( a_[i]:nDetach ) + " );" ) - ENDIF - - nStrCnt := 0 - DO WHILE "%%%" $ FP - ++nStrCnt - FP := StrTran( FP, "%%%", StrZero( nStrCnt, 2, 0 ), 1, 1 ) - aadd( txt_, " void * pText" + StrZero( nStrCnt, 2, 0 ) + " = NULL;" ) - ENDDO - - aeval( ::getReturnAsList( a_[ i ], FP, iif( ! a_[ i ]:isConstructor, " ", " " ) ), {|e| aadd( txt_, e ) } ) - - FOR q := nStrCnt TO 1 STEP -1 - aadd( txt_, " hb_strfree( pText" + StrZero( q, 2, 0 ) + " );" ) - NEXT - - /* Return values back to PRG */ - IF ! empty( a_[ i ]:aPre ) - aadd( txt_, "" ) - FOR q := 1 TO len( a_[ i ]:aPre ) - aadd( txt_, " " + a_[i]:aPre[ q ][ 4 ] + "( " + a_[i]:aPre[ q ][ 3 ] + ", " + hb_ntos( a_[i]:aPre[ q ][ 2 ] ) + " );" ) - NEXT - ENDIF - - aadd( txt_, " }" ) - ENDCASE - NEXT - - aadd( txt_, " else " ) - aadd( txt_, " {" ) - aadd( txt_, " hb_errRT_BASE( EG_ARG, 9999, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS ); " ) - aadd( txt_, " }" ) - IF oMtd:oRet:cCast == "void" - aadd( txt_, " " ) - aadd( txt_, " hb_itemReturn( hb_stackSelfItem() );" ) - ENDIF - aadd( txt_, " }" ) - - ENDIF + aadd( txt_, "}" ) + aadd( txt_, "" ) + RETURN txt_ ENDIF - aadd( txt_, "}" ) - aadd( txt_, "" ) + /* Sort per number of arguments */ + asort( a_, , , {|e,f| strzero( e:nArgs,2 ) + iif( e:nArgs == 0, "", e:hArgs[ 1 ]:cTypeHB ) > strzero( f:nArgs, 2 ) + iif( f:nArgs == 0, "", f:hArgs[ 1 ]:cTypeHB ) } ) + + /* know the maximum groups by number of parameters - first CASE */ + aeval( a_, {|o| iif( ascan( b_, o:nArgs ) == 0, aadd( b_, o:nArgs ), NIL ) } ) + + /* also take into account optional arguments if any */ + FOR EACH ooMtd IN a_ + IF ooMtd:nArgsReal < ooMtd:nArgs + FOR i := ooMtd:nArgs - 1 TO ooMtd:nArgsReal STEP -1 + IF ascan( b_, i ) == 0 + aadd( b_, i ) + ENDIF + NEXT + ENDIF + NEXT + + /* Build the structure number of parameters wise */ + FOR EACH nArgs IN b_ + aadd( c_, { nArgs, {}, {}, {} } ) + n := len( c_ ) + FOR EACH ooMtd IN a_ + IF ooMtd:nArgs == nArgs + aadd( c_[ n,2 ], ooMtd ) + ENDIF + NEXT + /* Again append methods with optional arguments */ + FOR EACH ooMtd IN a_ + IF ooMtd:nArgsReal < ooMtd:nArgs + FOR i := ooMtd:nArgs - 1 TO ooMtd:nArgsReal STEP -1 + IF i == nArgs + aadd( c_[ n,2 ], ooMtd ) + ENDIF + NEXT + ENDIF + NEXT + NEXT + + /* stack groups based on parameters descending */ + asort( c_, , , {|e,f| e[ 1 ] > f[ 1 ] } ) + + /* again sort no of arguments based methods by type of arguments */ + FOR i := 10 TO 0 STEP -1 /* consider maximum 10 arguments */ + IF ( n := ascan( c_, {|e_| e_[ 1 ] == i } ) ) > 0 + d_:= c_[ n,2 ] // d_ == a_ + asort( d_, , , {|e,f| __TY( e, c_[ n,1 ] ) < __TY( f, c_[ n,1 ] ) } ) + ENDIF + NEXT + + + cTmp := ::cQtObject + iif( ::isList, "< void * >", "" ) + aadd( txt_, " " + cTmp + " * " + v + " = ( " + cTmp + " * ) hbqt_pPtrFromObj( 0 );" ) + + aadd( txt_, " if( " + v + " )" ) + aadd( txt_, " {" ) + + IF len( a_ ) == 1 .and. oMtd:nArgs == oMtd:nArgsReal /* Only one method - no overloads */ + FOR EACH b_ IN c_ + nArgs := b_[ 1 ] + a_ := b_[ 2 ] + FOR EACH oMtd IN a_ + IF oMtd:nArgs > 0 + aadd( txt_, " " + iif( oMtd:__enumIndex() == 1, "if", "else if" ) + "( " + __TY_TYPEScpp( oMtd,nArgs ) + " )" ) + aadd( txt_, " {" ) + ENDIF + // + aeval( ::getReturnMethod( oMtd, ( oMtd:nArgs > 0 ) ), {|e| aadd( txt_, space( iif( oMtd:nArgs > 0, 9, 6 ) ) + e ) } ) + // + IF oMtd:nArgs > 0 + aadd( txt_, " }" ) + aadd( txt_, " hb_errRT_BASE( EG_ARG, 9999, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );" ) + ENDIF + NEXT + NEXT + + ELSE + + nArgs := 0 + aadd( txt_, " switch( hb_pcount() )" ) + aadd( txt_, " {" ) + + FOR EACH b_ IN c_ + nArgs := b_[ 1 ] + a_ := b_[ 2 ] + nArgGrps := len( c_ ) + cCrc := "xxx" + nMtds := 0 + lInIf := .f. + nTySame := 0 + lFirst := nArgs > 0 + + aadd( txt_, " case " + hb_ntos( nArgs ) + ":" ) /* number of parameters */ + aadd( txt_, " {" ) + + FOR EACH oMtd IN a_ + IF nArgs > 0 + IF cCrc != __TY( oMtd, nArgs ) + cCrc := __TY( oMtd, nArgs ) + nMtds := 0 + nTySame := 0 + aeval( a_, {|o| iif( __TY( o,nArgs ) == cCrc, nTySame++, NIL ) } ) + lInIf := oMtd:nArgQCast > 0 .AND. oMtd:nArgQCast <= nArgs .AND. nTySame > 1 + aadd( txt_, " " + iif( lFirst, "if( ", "else if( " ) + __TY_TYPEScpp( oMtd,nArgs ) + " )" ) + aadd( txt_, " {" ) + ENDIF + ENDIF + IF lFirst + lFirst := .f. + ENDIF + + nMtds++ + + IF lInIf + aadd( txt_, " " + iif( nMtds == 1, "if( ", "else if( " ) + __TY_Method( oMtd,nArgs ) + " )" ) + aadd( txt_, " {" ) + ENDIF + // + aeval( ::getReturnMethod( oMtd, .t. ), {|e| aadd( txt_, space( iif( nArgs == 0, 12, 15 ) + iif( lInIf, 3, 0 ) ) + e ) } ) + // + IF lInIf + aadd( txt_, " }" ) + ENDIF + + IF nArgs > 0 .AND. ! lInIf + aadd( txt_, " }" ) + ELSEIF nArgs > 0 .AND. lInIf .AND. nMtds == nTySame + aadd( txt_, " }" ) + ENDIF + NEXT + IF nArgs > 0 + aadd( txt_, " break;" ) + aadd( txt_, " }" ) + ENDIF + NEXT + IF nArgs == 0 + aadd( txt_, " }" ) // CASE + ENDIF + aadd( txt_, " }" ) // SWITCH + aadd( txt_, " hb_errRT_BASE( EG_ARG, 9999, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );" ) + + ENDIF + + aadd( txt_, " }" ) // if( p ) + aadd( txt_, "}" ) // HB_FUNC() + aadd( txt_, "" ) + + HB_SYMBOL_UNUSED( d_ ) + HB_SYMBOL_UNUSED( nArgGrps ) RETURN txt_ /*----------------------------------------------------------------------*/ METHOD HbQtSource:buildMethodBody( oMtd ) - LOCAL aBdy - LOCAL cFunc + LOCAL aBdy, cFunc oMtd:cCmd := StrTran( oMtd:cCmd, "( )", "()" ) - oMtd:cCmdN := StrTran( oMtd:cCmdN, "( )", "()" ) - aBdy := ::getMethodBody( oMtd, "QT_" + upper( ::cQtObject ) + "_" + upper( oMtd:cHBFunc ), ::aMethods, 0 ) + aBdy := ::getMethodBody( oMtd, "QT_" + upper( ::cQtObject ) + "_" + upper( oMtd:cHBFunc ), ::aMethods ) aeval( aBdy, {|e| aadd( ::txt_, e ) } ) @@ -1960,7 +2044,7 @@ STATIC FUNCTION hbqtgen_prgRetNormalize( cPrgRet ) /*----------------------------------------------------------------------*/ -STATIC FUNCTION hbide_paramCheckStrCpp( cType, nArg, cCast ) +STATIC FUNCTION hbqtgen_paramCheckStrCpp( cType, nArg, cCast ) HB_SYMBOL_UNUSED( cCast ) @@ -1991,7 +2075,7 @@ STATIC FUNCTION hbide_paramCheckStrCpp( cType, nArg, cCast ) STATIC FUNCTION __TY_TYPEScpp( oM, nArgs ) LOCAL i, s := "" FOR i := 1 TO nArgs - s += hbide_paramCheckStrCpp( oM:hArgs[ i ]:cTypeHB, i, oM:hArgs[ i ]:cCast ) + " && " + s += hbqtgen_paramCheckStrCpp( oM:hArgs[ i ]:cTypeHB, i, oM:hArgs[ i ]:cCast ) + " && " NEXT IF " && " $ s s := Left( s, len( s ) - 4 ) @@ -2412,7 +2496,7 @@ METHOD HbQtSource:parseProto( cProto, fBody_ ) ENDIF NEXT FOR EACH oArg IN oMtd:hArgs - IF oArg:cTypeHB $ "O" // "PO" + IF oArg:cTypeHB $ "O" oMtd:nArgHBObj := oArg:__enumIndex() EXIT ENDIF @@ -2896,120 +2980,6 @@ STATIC FUNCTION hbqtgen_stripLastFrom( cStr, cDlm ) ENDIF RETURN cStr -/*----------------------------------------------------------------------*/ -#if 0 /* KEEP AS IS - A Work in progress */ -/*----------------------------------------------------------------------*/ - -STATIC FUNCTION hbide_pullSameMethods( cFun, aMethods, cQtObject ) - LOCAL i, oMtd, a_:={}, b_:={}, c_:={}, nArgs, n, txt_:={} - LOCAL cSpc, cCrc, lFirst, nMtds, nTySame, lInIf - - FOR EACH oMtd IN aMethods - IF oMtd:cFun == cFun - aadd( a_, oMtd ) - ENDIF - NEXT - asort( a_, , , {|e,f| strzero( e:nArgs,2 ) + iif( e:nArgs == 0, "", e:hArgs[ 1 ]:cTypeHB ) > strzero( f:nArgs, 2 ) + iif( f:nArgs == 0, "", f:hArgs[ 1 ]:cTypeHB ) } ) - - /* know the maximum groups by number of parameters - first CASE */ - aeval( a_, {|o| iif( ascan( b_, o:nArgs ) == 0, aadd( b_, o:nArgs ), NIL ) } ) - - /* also take into account optional arguments if any */ - FOR EACH oMtd IN a_ - IF oMtd:nArgsReal < oMtd:nArgs - FOR i := oMtd:nArgs - 1 TO oMtd:nArgsReal STEP -1 - IF ascan( b_, i ) == 0 - aadd( b_, i ) - ENDIF - NEXT - ENDIF - NEXT - - /* Build the structure number of parameters wise */ - FOR EACH nArgs IN b_ - aadd( c_, { nArgs, {}, {}, {} } ) - n := len( c_ ) - FOR EACH oMtd IN a_ - IF oMtd:nArgs == nArgs - aadd( c_[ n,2 ], oMtd ) - ENDIF - NEXT - /* Again append methods with optional arguments */ - FOR EACH oMtd IN a_ - IF oMtd:nArgsReal < oMtd:nArgs - FOR i := oMtd:nArgs - 1 TO oMtd:nArgsReal STEP -1 - IF i == nArgs - aadd( c_[ n,2 ], oMtd ) - ENDIF - NEXT - ENDIF - NEXT - NEXT - - /* stack groups based on parameters descending */ - asort( c_, , , {|e,f| e[ 1 ] > f[ 1 ] } ) - - /* again sort no of arguments based methods by type of arguments */ - FOR i := 10 TO 0 STEP -1 /* consider maximum 10 arguments */ - IF ( n := ascan( c_, {|e_| e_[ 1 ] == i } ) ) > 0 - a_:= c_[ n,2 ] - asort( a_, , , {|e,f| __TY( e, c_[ n,1 ] ) < __TY( f, c_[ n,1 ] ) } ) - ENDIF - NEXT - - cSpc := " " - aadd( txt_, cSpc + "SWITCH PCount()" ) - FOR EACH b_ IN c_ - n := b_[ 1 ] - a_:= b_[ 2 ] - aadd( txt_, cSpc + "CASE " + hb_ntos( n ) ) /* number of parameters */ - cCrc := "xxx" - nMtds := 0 - lInIf := .f. - nTySame := 0 - IF n > 0 - lFirst := .t. - aadd( txt_, cSpc + cSpc + "DO CASE" ) /* type of parameters */ - ENDIF - FOR EACH oMtd IN a_ - IF n > 0 - IF cCrc != __TY( oMtd, n ) - cCrc := __TY( oMtd, n ) - nMtds := 0 - nTySame := 0 - aeval( a_, {|o| iif( __TY( o,n ) == cCrc, nTySame++, NIL ) } ) - lInIf := oMtd:nArgQCast > 0 .AND. oMtd:nArgQCast <= n .AND. nTySame > 1 - IF ! lFirst - lFirst := .t. - aadd( txt_, cSpc + cSpc + "ENDCASE" ) - ENDIF - aadd( txt_, cSpc + cSpc + "CASE " + __TY_TYPES( oMtd,n ) ) - ENDIF - ENDIF - nMtds++ - hbide_addReturnMethod( txt_, oMtd, cQtObject, iif( n == 0, 6, 9 ), nMtds, .t., lInIf, nTySame, n ) - NEXT - IF n > 0 - aadd( txt_, cSpc + cSpc + "ENDCASE" ) - aadd( txt_, cSpc + cSpc + "EXIT" ) - ENDIF - NEXT - aadd( txt_, cSpc + "ENDSWITCH" ) - - RETURN txt_ - -/*----------------------------------------------------------------------*/ - -STATIC FUNCTION __TY_TYPES( oM, nArgs ) - LOCAL i, s := "" - FOR i := 1 TO nArgs - s += hbide_paramCheckStr( oM:hArgs[ i ]:cTypeHB, i ) + " .AND. " - NEXT - IF " .AND. " $ s - s := substr( s, 1, len( s ) - 7 ) - ENDIF - RETURN s - /*----------------------------------------------------------------------*/ STATIC FUNCTION __TY( oM, nArgs ) @@ -3021,28 +2991,27 @@ STATIC FUNCTION __TY( oM, nArgs ) /*----------------------------------------------------------------------*/ -STATIC FUNCTION hbide_paramCheckStr( cType, nArg ) +STATIC FUNCTION __TY_Method( oMtd, nArgs ) + LOCAL nArg, oArg, aIdx := {}, cRet - SWITCH cType - CASE "PB" - RETURN "( " + " hb_pvalue( " + hb_ntos( nArg ) + " )" + " != NIL )" - CASE "P" - RETURN "hb_isPointer( hb_pvalue( " + hb_ntos( nArg ) + " ) )" - CASE "O" - RETURN "hb_isObject( hb_pvalue( " + hb_ntos( nArg ) + " ) )" - CASE "CO" - RETURN "( hb_isObject( hb_pvalue( " + hb_ntos( nArg ) + " ) ) .OR. hb_isChar( hb_pvalue( " + hb_ntos( nArg ) + " ) ) )" - CASE "N" - RETURN "hb_isNumeric( hb_pvalue( " + hb_ntos( nArg ) + " ) )" - CASE "L" - RETURN "hb_isLogical( hb_pvalue( " + hb_ntos( nArg ) + " ) )" - CASE "C" - RETURN "hb_isChar( hb_pvalue( " + hb_ntos( nArg ) + " ) )" - ENDSWITCH - RETURN "" + FOR EACH oArg IN oMtd:hArgs + IF oArg:__enumIndex() >= oMtd:nArgQCast + IF ! ( "::" $ oArg:cCast ) .AND. ! ( oArg:cCast == "QString" ) .AND. ( left( oArg:cCast, 1 ) == "Q" ) + aadd( aIdx, oArg:__enumIndex() ) + ENDIF + ENDIF + IF oArg:__enumIndex() == nArgs + EXIT + ENDIF + NEXT + + cRet := "" + FOR EACH nArg IN aIdx + cRet += "hbqt_isObjectType( " + hb_ntos( nArg ) + ", " + "HBQT_TYPE_" + oMtd:hArgs[ nArg ]:cCast + " )" + " && " + NEXT + cRet := substr( cRet, 1, len( cRet ) - 4 ) + + RETURN cRet /*----------------------------------------------------------------------*/ -#endif -/*----------------------------------------------------------------------*/ - diff --git a/harbour/contrib/hbqt/qtcore/qth/HBQString.qth b/harbour/contrib/hbqt/qtcore/qth/HBQString.qth index f1224b22d9..57b32941da 100644 --- a/harbour/contrib/hbqt/qtcore/qth/HBQString.qth +++ b/harbour/contrib/hbqt/qtcore/qth/HBQString.qth @@ -75,8 +75,9 @@ QString & append ( const QString & str ) QString & append ( const QStringRef & reference ) QString & append ( const QLatin1String & str ) QString & append ( const QByteArray & ba ) -QString & append ( const char * str ) +//QString & append ( const char * str ) QString & append ( QChar ch ) + QString arg ( const QString & a, int fieldWidth = 0, const QChar & fillChar = QLatin1Char( ' ' ) ) const QString arg ( const QString & a1, const QString & a2 ) const QString arg ( const QString & a1, const QString & a2, const QString & a3 ) const @@ -87,16 +88,17 @@ QString arg ( const QString & a1, const QString & a2, const QString & a3, const QString arg ( const QString & a1, const QString & a2, const QString & a3, const QString & a4, const QString & a5, const QString & a6, const QString & a7, const QString & a8 ) const QString arg ( const QString & a1, const QString & a2, const QString & a3, const QString & a4, const QString & a5, const QString & a6, const QString & a7, const QString & a8, const QString & a9 ) const QString arg ( int a, int fieldWidth = 0, int base = 10, const QChar & fillChar = QLatin1Char( ' ' ) ) const -QString arg ( uint a, int fieldWidth = 0, int base = 10, const QChar & fillChar = QLatin1Char( ' ' ) ) const -QString arg ( long a, int fieldWidth = 0, int base = 10, const QChar & fillChar = QLatin1Char( ' ' ) ) const -QString arg ( ulong a, int fieldWidth = 0, int base = 10, const QChar & fillChar = QLatin1Char( ' ' ) ) const -QString arg ( qlonglong a, int fieldWidth = 0, int base = 10, const QChar & fillChar = QLatin1Char( ' ' ) ) const -QString arg ( qulonglong a, int fieldWidth = 0, int base = 10, const QChar & fillChar = QLatin1Char( ' ' ) ) const -QString arg ( short a, int fieldWidth = 0, int base = 10, const QChar & fillChar = QLatin1Char( ' ' ) ) const -QString arg ( ushort a, int fieldWidth = 0, int base = 10, const QChar & fillChar = QLatin1Char( ' ' ) ) const +//QString arg ( uint a, int fieldWidth = 0, int base = 10, const QChar & fillChar = QLatin1Char( ' ' ) ) const +//QString arg ( long a, int fieldWidth = 0, int base = 10, const QChar & fillChar = QLatin1Char( ' ' ) ) const +//QString arg ( ulong a, int fieldWidth = 0, int base = 10, const QChar & fillChar = QLatin1Char( ' ' ) ) const +//QString arg ( qlonglong a, int fieldWidth = 0, int base = 10, const QChar & fillChar = QLatin1Char( ' ' ) ) const +//QString arg ( qulonglong a, int fieldWidth = 0, int base = 10, const QChar & fillChar = QLatin1Char( ' ' ) ) const +//QString arg ( short a, int fieldWidth = 0, int base = 10, const QChar & fillChar = QLatin1Char( ' ' ) ) const +//QString arg ( ushort a, int fieldWidth = 0, int base = 10, const QChar & fillChar = QLatin1Char( ' ' ) ) const QString arg ( QChar a, int fieldWidth = 0, const QChar & fillChar = QLatin1Char( ' ' ) ) const -QString arg ( char a, int fieldWidth = 0, const QChar & fillChar = QLatin1Char( ' ' ) ) const -QString arg ( double a, int fieldWidth = 0, char format = 'g', int precision = -1, const QChar & fillChar = QLatin1Char( ' ' ) ) const +//QString arg ( char a, int fieldWidth = 0, const QChar & fillChar = QLatin1Char( ' ' ) ) const +//QString arg ( double a, int fieldWidth = 0, char format = 'g', int precision = -1, const QChar & fillChar = QLatin1Char( ' ' ) ) const + const QChar at ( int position ) const //iterator begin () //const_iterator begin () const @@ -152,11 +154,13 @@ QString mid ( int position, int n = -1 ) const QStringRef midRef ( int position, int n = -1 ) const QString normalized ( NormalizationForm mode ) const QString normalized ( NormalizationForm mode, QChar::UnicodeVersion version ) const + QString & prepend ( const QString & str ) QString & prepend ( const QLatin1String & str ) QString & prepend ( const QByteArray & ba ) -QString & prepend ( const char * str ) +//QString & prepend ( const char * str ) QString & prepend ( QChar ch ) + void push_back ( const QString & other ) void push_back ( QChar ch ) void push_front ( const QString & other ) @@ -186,16 +190,18 @@ QStringRef rightRef ( int n ) const QString section ( QChar sep, int start, int end = -1, SectionFlags flags = SectionDefault ) const QString section ( const QString & sep, int start, int end = -1, SectionFlags flags = SectionDefault ) const QString section ( const QRegExp & reg, int start, int end = -1, SectionFlags flags = SectionDefault ) const + QString & setNum ( int n, int base = 10 ) -QString & setNum ( uint n, int base = 10 ) -QString & setNum ( long n, int base = 10 ) -QString & setNum ( ulong n, int base = 10 ) -QString & setNum ( qlonglong n, int base = 10 ) -QString & setNum ( qulonglong n, int base = 10 ) -QString & setNum ( short n, int base = 10 ) -QString & setNum ( ushort n, int base = 10 ) -QString & setNum ( double n, char format = 'g', int precision = 6 ) -QString & setNum ( float n, char format = 'g', int precision = 6 ) +//QString & setNum ( uint n, int base = 10 ) +//QString & setNum ( long n, int base = 10 ) +//QString & setNum ( ulong n, int base = 10 ) +//QString & setNum ( qlonglong n, int base = 10 ) +//QString & setNum ( qulonglong n, int base = 10 ) +//QString & setNum ( short n, int base = 10 ) +//QString & setNum ( ushort n, int base = 10 ) +//QString & setNum ( double n, char format = 'g', int precision = 6 ) +//QString & setNum ( float n, char format = 'g', int precision = 6 ) + QString & setUnicode ( const QChar * unicode, int size ) QString & setUtf16 ( const ushort * unicode, int size ) QString simplified () const @@ -252,13 +258,15 @@ QString fromUtf16 ( const ushort * unicode, int size = -1 ) //QString fromWCharArray ( const wchar_t * string, int size = -1 ) int localeAwareCompare ( const QString & s1, const QString & s2 ) int localeAwareCompare ( const QString & s1, const QStringRef & s2 ) -QString number ( long n, int base = 10 ) -QString number ( double n, char format = 'g', int precision = 6 ) -QString number ( ulong n, int base = 10 ) + +//QString number ( long n, int base = 10 ) +//QString number ( double n, char format = 'g', int precision = 6 ) +//QString number ( ulong n, int base = 10 ) QString number ( int n, int base = 10 ) -QString number ( uint n, int base = 10 ) -QString number ( qlonglong n, int base = 10 ) -QString number ( qulonglong n, int base = 10 ) +//QString number ( uint n, int base = 10 ) +//QString number ( qlonglong n, int base = 10 ) +//QString number ( qulonglong n, int base = 10 ) + diff --git a/harbour/contrib/hbqt/qtcore/qth/QByteArray.qth b/harbour/contrib/hbqt/qtcore/qth/QByteArray.qth index a6be2b7a30..7ac03cc038 100644 --- a/harbour/contrib/hbqt/qtcore/qth/QByteArray.qth +++ b/harbour/contrib/hbqt/qtcore/qth/QByteArray.qth @@ -49,9 +49,10 @@ HB_FUNC( QT_QBYTEARRAY ) QByteArray & append ( const QByteArray & ba ) QByteArray & append ( const QString & str ) -QByteArray & append ( const char * str ) +//QByteArray & append ( const char * str ) QByteArray & append ( const char * str, int len ) QByteArray & append ( char ch ) + char at ( int i ) const int capacity () const void chop ( int n ) @@ -70,35 +71,45 @@ bool endsWith ( const QByteArray & ba ) const bool endsWith ( const char * str ) const bool endsWith ( char ch ) const QByteArray & fill ( char ch, int size = -1 ) + int indexOf ( const QByteArray & ba, int from = 0 ) const int indexOf ( const QString & str, int from = 0 ) const -int indexOf ( const char * str, int from = 0 ) const +//int indexOf ( const char * str, int from = 0 ) const int indexOf ( char ch, int from = 0 ) const + QByteArray & insert ( int i, const QByteArray & ba ) QByteArray & insert ( int i, const QString & str ) -QByteArray & insert ( int i, const char * str ) +//QByteArray & insert ( int i, const char * str ) QByteArray & insert ( int i, char ch ) + bool isEmpty () const bool isNull () const + int lastIndexOf ( const QByteArray & ba, int from = -1 ) const int lastIndexOf ( const QString & str, int from = -1 ) const -int lastIndexOf ( const char * str, int from = -1 ) const +//int lastIndexOf ( const char * str, int from = -1 ) const int lastIndexOf ( char ch, int from = -1 ) const + QByteArray left ( int len ) const QByteArray leftJustified ( int width, char fill = ' ', bool truncate = false ) const int length () const QByteArray mid ( int pos, int len = -1 ) const + QByteArray & prepend ( const QByteArray & ba ) QByteArray & prepend ( const char * str ) QByteArray & prepend ( char ch ) + void push_back ( const QByteArray & other ) void push_back ( const char * str ) void push_back ( char ch ) + void push_front ( const QByteArray & other ) void push_front ( const char * str ) void push_front ( char ch ) + QByteArray & remove ( int pos, int len ) QByteArray repeated ( int times ) const + QByteArray & replace ( int pos, int len, const QByteArray & after ) QByteArray & replace ( int pos, int len, const char * after ) QByteArray & replace ( const QByteArray & before, const QByteArray & after ) @@ -107,23 +118,26 @@ QByteArray & replace ( const char * before, int bsize, const char * after, int a QByteArray & replace ( const QByteArray & before, const char * after ) QByteArray & replace ( const QString & before, const QByteArray & after ) QByteArray & replace ( const QString & before, const char * after ) -QByteArray & replace ( const char * before, const char * after ) +//QByteArray & replace ( const char * before, const char * after ) QByteArray & replace ( char before, const QByteArray & after ) QByteArray & replace ( char before, const QString & after ) -QByteArray & replace ( char before, const char * after ) +//QByteArray & replace ( char before, const char * after ) QByteArray & replace ( char before, char after ) + void reserve ( int size ) void resize ( int size ) QByteArray right ( int len ) const QByteArray rightJustified ( int width, char fill = ' ', bool truncate = false ) const + QByteArray & setNum ( int n, int base = 10 ) -QByteArray & setNum ( uint n, int base = 10 ) -QByteArray & setNum ( short n, int base = 10 ) -QByteArray & setNum ( ushort n, int base = 10 ) -QByteArray & setNum ( qlonglong n, int base = 10 ) -QByteArray & setNum ( qulonglong n, int base = 10 ) -QByteArray & setNum ( double n, char f = 'g', int prec = 6 ) -QByteArray & setNum ( float n, char f = 'g', int prec = 6 ) +//QByteArray & setNum ( uint n, int base = 10 ) +//QByteArray & setNum ( short n, int base = 10 ) +//QByteArray & setNum ( ushort n, int base = 10 ) +//QByteArray & setNum ( qlonglong n, int base = 10 ) +//QByteArray & setNum ( qulonglong n, int base = 10 ) +//QByteArray & setNum ( double n, char f = 'g', int prec = 6 ) +//QByteArray & setNum ( float n, char f = 'g', int prec = 6 ) + QByteArray simplified () const int size () const QList split ( char sep ) const diff --git a/harbour/contrib/hbqt/qtcore/qth/QLocale.qth b/harbour/contrib/hbqt/qtcore/qth/QLocale.qth index 344da0a999..0995714a8a 100644 --- a/harbour/contrib/hbqt/qtcore/qth/QLocale.qth +++ b/harbour/contrib/hbqt/qtcore/qth/QLocale.qth @@ -74,20 +74,22 @@ float toFloat ( const QString & s, bool * ok = 0 ) const int toInt ( const QString & s, bool * ok = 0, int base = 0 ) const qlonglong toLongLong ( const QString & s, bool * ok = 0, int base = 0 ) const short toShort ( const QString & s, bool * ok = 0, int base = 0 ) const -QString toString ( qlonglong i ) const + +//QString toString ( qlonglong i ) const QString toString ( const QDate & date, const QString & format ) const QString toString ( const QDate & date, FormatType format = LongFormat ) const QString toString ( const QTime & time, const QString & format ) const QString toString ( const QTime & time, FormatType format = LongFormat ) const QString toString ( const QDateTime & dateTime, FormatType format = LongFormat ) const QString toString ( const QDateTime & dateTime, const QString & format ) const -QString toString ( qulonglong i ) const -QString toString ( double i, char f = 'g', int prec = 6 ) const -QString toString ( short i ) const -QString toString ( ushort i ) const +//QString toString ( qulonglong i ) const +//QString toString ( double i, char f = 'g', int prec = 6 ) const +//QString toString ( short i ) const +//QString toString ( ushort i ) const QString toString ( int i ) const -QString toString ( uint i ) const -QString toString ( float i, char f = 'g', int prec = 6 ) const +//QString toString ( uint i ) const +//QString toString ( float i, char f = 'g', int prec = 6 ) const + QTime toTime ( const QString & string, FormatType format = LongFormat ) const QTime toTime ( const QString & string, const QString & format ) const uint toUInt ( const QString & s, bool * ok = 0, int base = 0 ) const diff --git a/harbour/contrib/hbqt/qtcore/qth/QVariant.qth b/harbour/contrib/hbqt/qtcore/qth/QVariant.qth index c6c83362bc..6f8569251c 100644 --- a/harbour/contrib/hbqt/qtcore/qth/QVariant.qth +++ b/harbour/contrib/hbqt/qtcore/qth/QVariant.qth @@ -79,7 +79,6 @@ enum Type { Invalid, BitArray, Bitmap, Bool, ..., UserType } bool canConvert ( Type t ) const -bool canConvert ( Type t ) const void clear () bool convert ( Type t ) bool isNull () const diff --git a/harbour/contrib/hbqt/qtgui/qth/QLCDNumber.qth b/harbour/contrib/hbqt/qtgui/qth/QLCDNumber.qth index 438a8130b4..e906367d4c 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QLCDNumber.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QLCDNumber.qth @@ -38,7 +38,7 @@ enum SegmentStyle { Outline, Filled, Flat } bool checkOverflow ( double num ) const -bool checkOverflow ( int num ) const +//bool checkOverflow ( int num ) const int intValue () const Mode mode () const int numDigits () const @@ -53,7 +53,7 @@ double value () const void display ( const QString & s ) void display ( double num ) -void display ( int num ) +//void display ( int num ) void setBinMode () void setDecMode () void setHexMode () diff --git a/harbour/contrib/hbqt/qtgui/qth/QLabel.qth b/harbour/contrib/hbqt/qtgui/qth/QLabel.qth index 912755651b..c32f5b434c 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QLabel.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QLabel.qth @@ -61,7 +61,7 @@ bool wordWrap () const void clear () void setMovie ( QMovie * movie ) void setNum ( int num ) -void setNum ( double num ) +//void setNum ( double num ) void setPicture ( const QPicture & picture ) void setPixmap ( const QPixmap & ) void setText ( const QString & ) diff --git a/harbour/contrib/hbqt/qtgui/qth/QMatrix.qth b/harbour/contrib/hbqt/qtgui/qth/QMatrix.qth index 7ecdcf4d31..4e64adb7e5 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QMatrix.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QMatrix.qth @@ -48,8 +48,9 @@ qreal dy () const QMatrix inverted ( bool * invertible = 0 ) const bool isIdentity () const bool isInvertible () const + void map ( qreal x, qreal y, qreal * tx, qreal * ty ) const -void map ( int x, int y, int * tx, int * ty ) const +//void map ( int x, int y, int * tx, int * ty ) const QPointF map ( const QPointF & point ) const QPoint map ( const QPoint & point ) const QLineF map ( const QLineF & line ) const @@ -57,6 +58,7 @@ QLine map ( const QLine & line ) const QPolygonF map ( const QPolygonF & polygon ) const QPolygon map ( const QPolygon & polygon ) const QRegion map ( const QRegion & region ) const + QPainterPath map ( const QPainterPath & path ) const QRectF mapRect ( const QRectF & rectangle ) const QRect mapRect ( const QRect & rectangle ) const diff --git a/harbour/contrib/hbqt/qtgui/qth/QPainter.qth b/harbour/contrib/hbqt/qtgui/qth/QPainter.qth index 27b79a7ee4..e26b682257 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QPainter.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QPainter.qth @@ -150,32 +150,9 @@ void drawPolyline ( const QPoint * points, int pointCount ) void drawPolyline ( const QPolygonF & points ) void drawPolyline ( const QPolygon & points ) -//void drawRect ( const QRectF & rectangle ) -//void drawRect ( const QRect & rectangle ) -void drawRect ( int x, int y, int width, int height ){ - QPainter * p = ( QPainter * ) hbqt_pPtrFromObj( 0 ); - if( p ) - { - int pcount = hb_pcount(); - - if( pcount == 1 && HB_ISOBJECT( 1 ) ) - { - if( hbqt_isObjectType( 1, HBQT_TYPE_QRectF ) ) - { - p->drawRect( *hbqt_par_QRectF( 1 ) ); - } - else if( hbqt_isObjectType( 1, HBQT_TYPE_QRect ) ) - { - p->drawRect( *hbqt_par_QRect( 1 ) ); - } - } - else if( pcount == 4 && HB_ISNUM( 1 ) && HB_ISNUM( 2 ) && HB_ISNUM( 3 ) && HB_ISNUM( 4 ) ) - { - p->drawRect( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ) ); - } - hb_itemReturn( hb_stackSelfItem() ); - } -} +void drawRect ( const QRectF & rectangle ) +void drawRect ( const QRect & rectangle ) +void drawRect ( int x, int y, int width, int height ) void drawRects ( const QRectF * rectangles, int rectCount ) void drawRects ( const QRect * rectangles, int rectCount ) @@ -186,61 +163,13 @@ void drawRoundedRect ( const QRectF & rect, qreal xRadius, qreal yRadius, Qt::Si void drawRoundedRect ( const QRect & rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize ) void drawRoundedRect ( int x, int y, int w, int h, qreal xRadius, qreal yRadius, Qt::SizeMode mode = Qt::AbsoluteSize ) -//void drawText ( const QPointF & position, const QString & text ) -//void drawText ( const QPoint & position, const QString & text ) -//void drawText ( const QRectF & rectangle, const QString & text, const QTextOption & option = QTextOption() ) -//void drawText ( const QRectF & rectangle, int flags, const QString & text, QRectF * boundingRect = 0 ) -//void drawText ( const QRect & rectangle, int flags, const QString & text, QRect * boundingRect = 0 ) -//void drawText ( int x, int y, const QString & text ) -void drawText ( int x, int y, int width, int height, int flags, const QString & text, QRect * boundingRect = 0 ){ - QPainter * p = ( QPainter * ) hbqt_pPtrFromObj( 0 ); - if( p ) - { - void * pText01 = NULL; - int pcount = hb_pcount(); - - if( pcount >= 2 && HB_ISOBJECT( 1 ) && HB_ISCHAR( 2 ) ) - { - if( hbqt_isObjectType( 1, HBQT_TYPE_QPointF ) ) - { - p->drawText( *hbqt_par_QPointF( 1 ), hb_parstr_utf8( 2, &pText01, NULL ) ); - } - else if( hbqt_isObjectType( 1, HBQT_TYPE_QPoint ) ) - { - p->drawText( *hbqt_par_QPoint( 1 ), hb_parstr_utf8( 2, &pText01, NULL ) ); - } - else if( hbqt_isObjectType( 1, HBQT_TYPE_QRectF ) ) - { - p->drawText( *hbqt_par_QRectF( 1 ), hb_parstr_utf8( 2, &pText01, NULL ), ( HB_ISOBJECT( 3 ) ? *hbqt_par_QTextOption( 3 ) : QTextOption() ) ); - } - } - else if( pcount >= 3 && HB_ISOBJECT( 1 ) && HB_ISNUM( 2 ) && HB_ISCHAR( 3 ) ) - { - if( hbqt_isObjectType( 1, HBQT_TYPE_QRectF ) ) - { - p->drawText( *hbqt_par_QRectF( 1 ), hb_parni( 2 ), hb_parstr_utf8( 3, &pText01, NULL ), ( HB_ISOBJECT( 4 ) ? hbqt_par_QRectF( 4 ) : 0 ) ); - } - else if( hbqt_isObjectType( 1, HBQT_TYPE_QRect ) ) - { - p->drawText( *hbqt_par_QRect( 1 ), hb_parni( 2 ), hb_parstr_utf8( 3, &pText01, NULL ), ( HB_ISOBJECT( 4 ) ? hbqt_par_QRect( 4 ) : 0 ) ); - } - } - else if( pcount >= 3 && HB_ISNUM( 1 ) && HB_ISNUM( 2 ) && HB_ISCHAR( 3 ) ) - { - p->drawText( hb_parni( 1 ), hb_parni( 2 ), hb_parstr_utf8( 3, &pText01, NULL ) ); - } - else if( pcount >= 6 && HB_ISNUM( 1 ) && HB_ISNUM( 2 ) && HB_ISNUM( 3 ) && HB_ISNUM( 4 ) && HB_ISNUM( 5 ) && HB_ISCHAR( 6 ) ) - { - p->drawText( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), hb_parni( 5 ), hb_parstr_utf8( 6, &pText01, NULL ), ( HB_ISOBJECT( 7 ) ? hbqt_par_QRect( 7 ) : 0 ) ); - } - - if( pText01 ) - hb_strfree( pText01 ); - - hb_itemReturn( hb_stackSelfItem() ); - } -} - +void drawText ( const QPointF & position, const QString & text ) +void drawText ( const QPoint & position, const QString & text ) +void drawText ( const QRectF & rectangle, const QString & text, const QTextOption & option = QTextOption() ) +void drawText ( const QRectF & rectangle, int flags, const QString & text, QRectF * boundingRect = 0 ) +void drawText ( const QRect & rectangle, int flags, const QString & text, QRect * boundingRect = 0 ) +void drawText ( int x, int y, const QString & text ) +void drawText ( int x, int y, int width, int height, int flags, const QString & text, QRect * boundingRect = 0 ) void drawTiledPixmap ( const QRectF & rectangle, const QPixmap & pixmap, const QPointF & position = QPointF() ) void drawTiledPixmap ( const QRect & rectangle, const QPixmap & pixmap, const QPoint & position = QPoint() ) @@ -254,72 +183,18 @@ void eraseRect ( int x, int y, int width, int height ) void fillPath ( const QPainterPath & path, const QBrush & brush ) -//void fillRect ( const QRectF & rectangle, const QBrush & brush ) -//void fillRect ( const QRect & rectangle, const QBrush & brush ) -//void fillRect ( const QRectF & rectangle, const QColor & color ) -//void fillRect ( const QRect & rectangle, const QColor & color ) +void fillRect ( const QRectF & rectangle, const QBrush & brush ) +void fillRect ( const QRect & rectangle, const QBrush & brush ) +void fillRect ( const QRectF & rectangle, const QColor & color ) +void fillRect ( const QRect & rectangle, const QColor & color ) +void fillRect ( const QRectF & rectangle, Qt::GlobalColor color ) +void fillRect ( const QRect & rectangle, Qt::GlobalColor color ) //void fillRect ( const QRectF & rectangle, Qt::BrushStyle style ) //void fillRect ( const QRect & rectangle, Qt::BrushStyle style ) -//void fillRect ( int x, int y, int width, int height, const QBrush & brush ) -//void fillRect ( int x, int y, int width, int height, const QColor & color ) -//void fillRect ( int x, int y, int width, int height, Qt::GlobalColor color ) +void fillRect ( int x, int y, int width, int height, const QBrush & brush ) +void fillRect ( int x, int y, int width, int height, const QColor & color ) +void fillRect ( int x, int y, int width, int height, Qt::GlobalColor color ) //void fillRect ( int x, int y, int width, int height, Qt::BrushStyle style ) -//void fillRect ( const QRect & rectangle, Qt::GlobalColor color ) -void fillRect ( const QRectF & rectangle, Qt::GlobalColor color ){ - QPainter * p = ( QPainter * ) hbqt_pPtrFromObj( 0 ); - if( p ) - { - int pcount = hb_pcount(); - - if( pcount == 2 && HB_ISOBJECT( 1 ) && HB_ISOBJECT( 2 ) ) - { - if( hbqt_isObjectType( 1, HBQT_TYPE_QRectF ) && hbqt_isObjectType( 2, HBQT_TYPE_QBrush ) ) - { - p->fillRect( *hbqt_par_QRectF( 1 ), *hbqt_par_QBrush( 2 ) ); - } - else if( hbqt_isObjectType( 1, HBQT_TYPE_QRect ) && hbqt_isObjectType( 2, HBQT_TYPE_QBrush ) ) - { - p->fillRect( *hbqt_par_QRect( 1 ), *hbqt_par_QBrush( 2 ) ); - } - else if( hbqt_isObjectType( 1, HBQT_TYPE_QRectF ) && hbqt_isObjectType( 2, HBQT_TYPE_QColor ) ) - { - p->fillRect( *hbqt_par_QRectF( 1 ), *hbqt_par_QColor( 2 ) ); - } - else if( hbqt_isObjectType( 1, HBQT_TYPE_QRect ) && hbqt_isObjectType( 2, HBQT_TYPE_QColor ) ) - { - p->fillRect( *hbqt_par_QRect( 1 ), *hbqt_par_QColor( 2 ) ); - } - } - else if( pcount == 2 && HB_ISOBJECT( 1 ) && HB_ISNUM( 2 ) ) - { - if( hbqt_isObjectType( 1, HBQT_TYPE_QRectF ) ) - { - p->fillRect( *hbqt_par_QRectF( 1 ), ( Qt::GlobalColor ) hb_parni( 2 ) ); - } - else if( hbqt_isObjectType( 1, HBQT_TYPE_QRect ) ) - { - p->fillRect( *hbqt_par_QRect( 1 ), ( Qt::GlobalColor ) hb_parni( 2 ) ); - } - } - else if( pcount == 5 && HB_ISNUM( 1 ) && HB_ISNUM( 2 ) && HB_ISNUM( 3 ) && HB_ISNUM( 4 ) && HB_ISOBJECT( 5 ) ) - { - if( hbqt_isObjectType( 5, HBQT_TYPE_QBrush ) ) - { - p->fillRect( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), *hbqt_par_QBrush( 5 ) ); - } - else if( hbqt_isObjectType( 5, HBQT_TYPE_QColor ) ) - { - p->fillRect( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), *hbqt_par_QColor( 5 ) ); - } - } - else if( pcount == 5 && HB_ISNUM( 1 ) && HB_ISNUM( 2 ) && HB_ISNUM( 3 ) && HB_ISNUM( 4 ) && HB_ISNUM( 5 ) ) - { - p->fillRect( hb_parni( 1 ), hb_parni( 2 ), hb_parni( 3 ), hb_parni( 4 ), ( Qt::GlobalColor ) hb_parni( 5 ) ); - } - - hb_itemReturn( hb_stackSelfItem() ); - } -} const QFont & font () const QFontInfo fontInfo () const diff --git a/harbour/contrib/hbqt/qtgui/qth/QTransform.qth b/harbour/contrib/hbqt/qtgui/qth/QTransform.qth index 7661c183f3..63d0787926 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QTransform.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QTransform.qth @@ -60,6 +60,7 @@ bool isInvertible () const bool isRotating () const bool isScaling () const bool isTranslating () const + void map ( qreal x, qreal y, qreal * tx, qreal * ty ) const QPointF map ( const QPointF & p ) const QPoint map ( const QPoint & point ) const @@ -69,7 +70,8 @@ QPolygonF map ( const QPolygonF & polygon ) const QPolygon map ( const QPolygon & polygon ) const QRegion map ( const QRegion & region ) const QPainterPath map ( const QPainterPath & path ) const -void map ( int x, int y, int * tx, int * ty ) const +//void map ( int x, int y, int * tx, int * ty ) const + QRectF mapRect ( const QRectF & rectangle ) const QRect mapRect ( const QRect & rectangle ) const QPolygon mapToPolygon ( const QRect & rectangle ) const diff --git a/harbour/contrib/hbqt/qtgui/qth/QWidget.qth b/harbour/contrib/hbqt/qtgui/qth/QWidget.qth index 9e2543d426..4f9bbd5f9c 100644 --- a/harbour/contrib/hbqt/qtgui/qth/QWidget.qth +++ b/harbour/contrib/hbqt/qtgui/qth/QWidget.qth @@ -223,8 +223,8 @@ void setMinimumWidth ( int minw ) void setMouseTracking ( bool enable ) void setPalette ( const QPalette & ) -void setParent ( QWidget * parent = 0 ) -void setParent ( QWidget * parent, Qt::WindowFlags f = 0 ) +//void setParent ( QWidget * parent = 0 ) +void setParent ( QWidget * parent = 0, Qt::WindowFlags f = 0 ) void setShortcutAutoRepeat ( int id, bool enable = true ) void setShortcutEnabled ( int id, bool enable = true ) diff --git a/harbour/contrib/hbqt/qtnetwork/qth/QHttp.qth b/harbour/contrib/hbqt/qtnetwork/qth/QHttp.qth index 749bdca5bf..1c00b13bae 100644 --- a/harbour/contrib/hbqt/qtnetwork/qth/QHttp.qth +++ b/harbour/contrib/hbqt/qtnetwork/qth/QHttp.qth @@ -80,7 +80,7 @@ int post ( const QString & path, const QByteArray & data, QIODevice * to = 0 ) QByteArray readAll () int request ( const QHttpRequestHeader & header, QIODevice * data = 0, QIODevice * to = 0 ) int request ( const QHttpRequestHeader & header, const QByteArray & data, QIODevice * to = 0 ) -int setHost ( const QString & hostName, quint16 port = 80 ) +//int setHost ( const QString & hostName, quint16 port = 80 ) int setHost ( const QString & hostName, ConnectionMode mode, quint16 port = 0 ) int setProxy ( const QString & host, int port, const QString & username = QString(), const QString & password = QString() ) // int setProxy ( const QNetworkProxy & proxy )