diff --git a/harbour/ChangeLog b/harbour/ChangeLog index c7f0deab40..ae7976ad81 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,21 @@ The license applies to all entries newer than 2009-04-28. */ +2011-02-27 09:25 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbqt/qtgui/hbqt_init.cpp + * contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp + * contrib/hbqt/qtcore/hbqt_pointer.cpp + * contrib/hbqt/qtcore/hbqt.h + * contrib/hbqt/qtcore/hbqt_hbqslots.cpp + * contrib/hbqt/qtcore/hbqt_init.cpp + + Applied (fully manually) Francesco's patch to address inefficiency + (to avoid using macro evaluation and calling back to a .prg stub to + create objects) in recent raw pointer modification. + It contains modifications of mine. + ; TOFIX: Add puller code for internally created objects. Or, even better + use pure C++ object creation code, so this is not a problem. + ; TODO: Delete remains of old method. + 2011-02-27 08:46 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/qtcore/hbqt_hbqevents.cpp ! Fixed to convert object name to uppercase when registering an event. diff --git a/harbour/contrib/hbqt/qtcore/hbqt.h b/harbour/contrib/hbqt/qtcore/hbqt.h index 9f8e06da2a..ace55077e4 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt.h +++ b/harbour/contrib/hbqt/qtcore/hbqt.h @@ -67,6 +67,7 @@ #include #include +#include #if !( QT_VERSION >= 0x040500 ) # error QT library version 4.5.0 or upper is required for hbqt. @@ -84,7 +85,7 @@ typedef struct HB_U32 type; } HBQT_GC_T; -typedef void ( * PHBQT_SLOT_FUNC )( PHB_ITEM * codeblock, void ** arguments, QByteArray pList ); +typedef void ( * PHBQT_SLOT_FUNC )( PHB_ITEM * codeblock, void ** arguments, QStringList pList ); HB_EXTERN_BEGIN @@ -101,7 +102,7 @@ extern HB_EXPORT void hbqt_errRT_ARG( void ); extern HB_EXPORT PHB_ITEM hbqt_defineClassBegin( const char* szClsName, PHB_ITEM s_oClass, const char* szParentClsStr ); extern HB_EXPORT void hbqt_defineClassEnd( PHB_ITEM s_oClass, PHB_ITEM oClass ); extern HB_EXPORT void * hbqt_getqtptr( void ); -extern HB_EXPORT PHB_ITEM hbqt_create_object( void * p, const char * objectList, int iIndex ); +extern HB_EXPORT PHB_ITEM hbqt_create_object( void * p, const char * objectName ); extern HB_EXPORT PHB_ITEM hbqt_create_objectFromEventType( void * pEvent, int type ); extern HB_EXPORT PHB_ITEM hbqt_create_objectFromEventType2( void * pEvent, const char * pszName ); HB_EXTERN_END diff --git a/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp b/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp index 6708ead851..7fb57a3a66 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp @@ -148,6 +148,7 @@ int HBQSlots::qt_metacall( QMetaObject::Call c, int id, void ** arguments ) const QMetaMethod meta = object->metaObject()->method( id ); QList arrayOfTypes = meta.parameterTypes(); int parameterCount = arrayOfTypes.size(); + QStringList pList; if( parameterCount > 0 ) { @@ -157,11 +158,11 @@ int HBQSlots::qt_metacall( QMetaObject::Call c, int id, void ** arguments ) char szPList[ 20 ]; hb_snprintf( szPList, sizeof( szPList ), "PLIST_%d", id ); - pString = object->property( szPList ).toByteArray(); + pList = object->property( szPList ).toStringList(); if( paramString.isNull() ) { - QStringList parList, pList; + QStringList parList; HB_TRACE( HB_TR_DEBUG, ( "SlotsProxy signature %s", meta.signature() ) ); @@ -177,12 +178,13 @@ int HBQSlots::qt_metacall( QMetaObject::Call c, int id, void ** arguments ) if( arrayOfTypes.at( i ).contains( "*" ) ) { parList += "pointer"; - pList += arrayOfTypes.at( i ); + // use [] because .at returns const QByteArray + pList += arrayOfTypes[ i ].replace( "*", "" ).trimmed().toUpper(); } else { - parList += arrayOfTypes.at( i ); - pList += arrayOfTypes.at( i ); + parList += arrayOfTypes.at( i ).trimmed().toUpper(); + pList += arrayOfTypes.at( i ).trimmed().toUpper(); } } } @@ -190,7 +192,7 @@ int HBQSlots::qt_metacall( QMetaObject::Call c, int id, void ** arguments ) object->setProperty( szParams, paramString ); pString = pList.join( "$" ).toAscii(); - object->setProperty( szPList, pString ); + object->setProperty( szPList, pList ); HB_TRACE( HB_TR_DEBUG, ( " SlotsProxy parList %s ", ( char * ) paramString.data() ) ); } @@ -215,7 +217,7 @@ int HBQSlots::qt_metacall( QMetaObject::Call c, int id, void ** arguments ) pCallback = s_pCallback.at( paramId ); if( pCallback ) - pCallback( ( PHB_ITEM * ) this->listBlock.at( i - 1 ), arguments, pString ); + pCallback( ( PHB_ITEM * ) this->listBlock.at( i - 1 ), arguments, pList ); } hb_vmRequestRestore(); } @@ -352,4 +354,3 @@ HB_FUNC( __HBQT_SLOTS_NEW ) } #endif - diff --git a/harbour/contrib/hbqt/qtcore/hbqt_init.cpp b/harbour/contrib/hbqt/qtcore/hbqt_init.cpp index 280dffcb22..db2e29c693 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_init.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_init.cpp @@ -74,6 +74,8 @@ #include #include +#include + HB_EXTERN_BEGIN extern void * hbqt_gcAllocate_QObject( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QTime( void * pObj, bool bNew ); @@ -92,39 +94,39 @@ HB_EXTERN_END /*----------------------------------------------------------------------*/ -static void hbqt_SlotsExecPointer( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecPointer( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QObject( ( *reinterpret_cast< void*( * ) >( arguments[ 1 ] ) ), false ), ( const char * ) pList.data(), 1 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QObject( ( *reinterpret_cast< void*( * ) >( arguments[ 1 ] ) ), false ), ( const char * ) pList.at( 0 ).data() ) ); hb_vmSend( 1 ); } -static void hbqt_SlotsExecPointerPointer( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecPointerPointer( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QObject( ( *reinterpret_cast< void*( * ) >( arguments[ 1 ] ) ), false ), ( const char * ) pList.data(), 1 ) ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QObject( ( *reinterpret_cast< void*( * ) >( arguments[ 2 ] ) ), false ), ( const char * ) pList.data(), 2 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QObject( ( *reinterpret_cast< void*( * ) >( arguments[ 1 ] ) ), false ), ( const char * ) pList.at( 0 ).data() ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QObject( ( *reinterpret_cast< void*( * ) >( arguments[ 2 ] ) ), false ), ( const char * ) pList.at( 1 ).data() ) ); hb_vmSend( 2 ); } -static void hbqt_SlotsExecPointerInt( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecPointerInt( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QObject( ( *reinterpret_cast< void*( * ) >( arguments[ 1 ] ) ), false ), ( const char * ) pList.data(), 1 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QObject( ( *reinterpret_cast< void*( * ) >( arguments[ 1 ] ) ), false ), ( const char * ) pList.at( 0 ).data() ) ); hb_vmPushInteger( *reinterpret_cast< int( * ) >( arguments[ 2 ] ) ); hb_vmSend( 2 ); } -static void hbqt_SlotsExecBool( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecBool( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); @@ -134,7 +136,7 @@ static void hbqt_SlotsExecBool( PHB_ITEM * codeBlock, void ** arguments, QByteAr hb_vmSend( 1 ); } -static void hbqt_SlotsExecDouble( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecDouble( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); @@ -144,7 +146,7 @@ static void hbqt_SlotsExecDouble( PHB_ITEM * codeBlock, void ** arguments, QByte hb_vmSend( 1 ); } -static void hbqt_SlotsExecInt( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecInt( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); @@ -154,7 +156,7 @@ static void hbqt_SlotsExecInt( PHB_ITEM * codeBlock, void ** arguments, QByteArr hb_vmSend( 1 ); } -static void hbqt_SlotsExecIntInt( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecIntInt( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); @@ -165,7 +167,7 @@ static void hbqt_SlotsExecIntInt( PHB_ITEM * codeBlock, void ** arguments, QByte hb_vmSend( 2 ); } -static void hbqt_SlotsExecIntIntInt( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecIntIntInt( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); @@ -177,7 +179,7 @@ static void hbqt_SlotsExecIntIntInt( PHB_ITEM * codeBlock, void ** arguments, QB hb_vmSend( 3 ); } -static void hbqt_SlotsExecIntIntIntInt( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecIntIntIntInt( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); @@ -190,7 +192,7 @@ static void hbqt_SlotsExecIntIntIntInt( PHB_ITEM * codeBlock, void ** arguments, hb_vmSend( 4 ); } -static void hbqt_SlotsExecString( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecString( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); @@ -201,141 +203,141 @@ static void hbqt_SlotsExecString( PHB_ITEM * codeBlock, void ** arguments, QByte hb_vmSend( 1 ); } -static void hbqt_SlotsExecModel( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecModel( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QModelIndex", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QModelIndex" ) ); hb_vmSend( 1 ); } -static void hbqt_SlotsExecModelModel( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecModelModel( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QModelIndex", 0 ) ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QModelIndex", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QModelIndex" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QModelIndex" ) ); hb_vmSend( 2 ); } -static void hbqt_SlotsExecStringList( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecStringList( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QStringList( new QStringList( ( *reinterpret_cast< QStringList( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QStringList", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QStringList( new QStringList( ( *reinterpret_cast< QStringList( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QStringList" ) ); hb_vmSend( 1 ); } -static void hbqt_SlotsExecQPoint( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecQPoint( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QPoint( new QPoint( ( *reinterpret_cast< QPoint( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QPoint", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QPoint( new QPoint( ( *reinterpret_cast< QPoint( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QPoint" ) ); hb_vmSend( 1 ); } -static void hbqt_SlotsExecQUrl( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecQUrl( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QUrl( new QUrl( ( *reinterpret_cast< QUrl( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QUrl", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QUrl( new QUrl( ( *reinterpret_cast< QUrl( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QUrl" ) ); hb_vmSend( 1 ); } -static void hbqt_SlotsExecQDate( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecQDate( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QDate( new QDate( ( *reinterpret_cast< QDate( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QDate", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QDate( new QDate( ( *reinterpret_cast< QDate( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QDate" ) ); hb_vmSend( 1 ); } -static void hbqt_SlotsExecQDateTime( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecQDateTime( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QDateTime( new QDateTime( ( *reinterpret_cast< QDateTime( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QDateTime", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QDateTime( new QDateTime( ( *reinterpret_cast< QDateTime( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QDateTime" ) ); hb_vmSend( 1 ); } -static void hbqt_SlotsExecQTime( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecQTime( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QTime( new QTime( ( *reinterpret_cast< QTime( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QTime", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QTime( new QTime( ( *reinterpret_cast< QTime( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QTime" ) ); hb_vmSend( 1 ); } -static void hbqt_SlotsExecQRectF( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecQRectF( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QRectF( new QRectF( ( *reinterpret_cast< QRectF( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QRectF", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QRectF( new QRectF( ( *reinterpret_cast< QRectF( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QRectF" ) ); hb_vmSend( 1 ); } -static void hbqt_SlotsExecQRectInt( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecQRectInt( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QRect( new QRect( ( *reinterpret_cast< QRect( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QRect", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QRect( new QRect( ( *reinterpret_cast< QRect( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QRect" ) ); hb_vmPushInteger( *reinterpret_cast< int( * ) >( arguments[ 2 ] ) ); hb_vmSend( 2 ); } -static void hbqt_SlotsExecQRect( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecQRect( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QRect( new QRect( ( *reinterpret_cast< QRect( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QRect", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QRect( new QRect( ( *reinterpret_cast< QRect( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QRect" ) ); hb_vmSend( 1 ); } -static void hbqt_SlotsExecQSizeF( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecQSizeF( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QSizeF( new QSizeF( ( *reinterpret_cast< QSizeF( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QSizeF", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QSizeF( new QSizeF( ( *reinterpret_cast< QSizeF( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QSizeF" ) ); hb_vmSend( 1 ); } -static void hbqt_SlotsExecModelIndexIntInt( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecModelIndexIntInt( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QModelIndex", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QModelIndex" ) ); hb_vmPushInteger( *reinterpret_cast< int( * ) >( arguments[ 2 ] ) ); hb_vmPushInteger( *reinterpret_cast< int( * ) >( arguments[ 3 ] ) ); hb_vmSend( 3 ); } -static void hbqt_SlotsExecModelIndexList( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecModelIndexList( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); diff --git a/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp b/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp index 1579803df4..dfbcb6643d 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp @@ -432,19 +432,17 @@ void * hbqt_getqtptr( void ) return NULL; } -PHB_ITEM hbqt_create_object( void * p, const char * objectList, int iIndex ) +PHB_ITEM hbqt_create_object( void * p, const char * objectName ) { - static PHB_DYNS s_createObject = NULL; + PHB_ITEM pItem = hb_itemPutPtr( NULL, p ); - if( s_createObject == NULL ) - s_createObject = hb_dynsymGetCase( "HBQT_CREATEQTOBJECT" ); - - hb_vmPushDynSym( s_createObject ); + hb_vmPushDynSym( hb_dynsymGet( objectName ) ); hb_vmPushNil(); - hb_vmPushString( objectList, strlen( objectList ) ); - hb_vmPushInteger( iIndex ); - hb_vmPushPointerGC( p ); - hb_vmDo( 3 ); + hb_vmDo( 0 ); + + hb_objSendMsg( hb_stackReturnItem(), "_PPTR", 1, pItem ); + + hb_itemRelease( pItem ); return hb_stackReturnItem(); } @@ -470,7 +468,7 @@ PHB_ITEM hbqt_create_objectFromEventType2( void * pEvent, const char * pszName ) { PHB_ITEM pItemEvent = hb_itemPutPtr( NULL, pEvent ); - hb_vmPushDynSym( hb_dynsymGetCase( pszName ) ); + hb_vmPushDynSym( hb_dynsymGet( pszName ) ); hb_vmPushNil(); hb_vmDo( 0 ); diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp index deda9522e8..b8c745add4 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp @@ -769,7 +769,7 @@ void HBQGraphicsItem::paint( QPainter * painter, const QStyleOptionGraphicsItem QRectF rect = ( option->type == QStyleOption::SO_GraphicsItem ) ? boundingRect() : option->exposedRect; PHB_ITEM p1 = hb_itemPutNI( NULL, 21017 ); - PHB_ITEM p2 = hbqt_create_object( hbqt_gcAllocate_QPainter( painter, false ), ( const char * ) "QPainter*", 0 ); + PHB_ITEM p2 = hbqt_create_object( hbqt_gcAllocate_QPainter( painter, false ), ( const char * ) "QPainter*" ); PHB_ITEM p3 = hb_itemPutPtr( NULL, &rect ); hb_vmEvalBlockV( block, 3, p1, p2, p3 ); hb_itemRelease( p1 ); diff --git a/harbour/contrib/hbqt/qtgui/hbqt_init.cpp b/harbour/contrib/hbqt/qtgui/hbqt_init.cpp index e4663a37f4..ba263d4d68 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_init.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_init.cpp @@ -71,6 +71,8 @@ #include #include +#include + HB_EXTERN_BEGIN extern void * hbqt_gcAllocate_QColor( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QItemSelection( void * pObj, bool bNew ); @@ -82,64 +84,64 @@ HB_EXTERN_END /*----------------------------------------------------------------------*/ -static void hbqt_SlotsExecQColor( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecQColor( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QColor( new QColor( ( *reinterpret_cast< QColor( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QColor", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QColor( new QColor( ( *reinterpret_cast< QColor( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QColor" ) ); hb_vmSend( 1 ); } -static void hbqt_SlotsExecItemSelItemSel( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecItemSelItemSel( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QItemSelection( new QItemSelection( ( *reinterpret_cast< QItemSelection( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QItemSelection", 0 ) ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QItemSelection( new QItemSelection( ( *reinterpret_cast< QItemSelection( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QItemSelection", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QItemSelection( new QItemSelection( ( *reinterpret_cast< QItemSelection( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QItemSelection" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QItemSelection( new QItemSelection( ( *reinterpret_cast< QItemSelection( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QItemSelection" ) ); hb_vmSend( 2 ); } -static void hbqt_SlotsExecQTextCharFormat( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecQTextCharFormat( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( ( *reinterpret_cast< QTextCharFormat( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QTextCharFormat", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QTextCharFormat( new QTextCharFormat( ( *reinterpret_cast< QTextCharFormat( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QTextCharFormat" ) ); hb_vmSend( 1 ); } -static void hbqt_SlotsExecQFont( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecQFont( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QFont( new QFont( ( *reinterpret_cast< QFont( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QFont", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QFont( new QFont( ( *reinterpret_cast< QFont( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QFont" ) ); hb_vmSend( 1 ); } -static void hbqt_SlotsExecQTextCursor( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecQTextCursor( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QTextCursor( new QTextCursor( ( *reinterpret_cast< QTextCursor( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QTextCursor", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QTextCursor( new QTextCursor( ( *reinterpret_cast< QTextCursor( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QTextCursor" ) ); hb_vmSend( 1 ); } -static void hbqt_SlotsExecQTextBlock( PHB_ITEM * codeBlock, void ** arguments, QByteArray pList ) +static void hbqt_SlotsExecQTextBlock( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) { Q_UNUSED( pList ); hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QTextBlock( new QTextBlock( ( *reinterpret_cast< QTextBlock( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QTextBlock", 0 ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QTextBlock( new QTextBlock( ( *reinterpret_cast< QTextBlock( * ) >( arguments[ 1 ] ) ) ), true ), ( const char * ) "QTextBlock" ) ); hb_vmSend( 1 ); }