diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 37d354e141..3e5e61dccd 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,14 @@ The license applies to all entries newer than 2009-04-28. */ +2011-02-27 18:25 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbqt/qtgui/hbqt_init.cpp + * contrib/hbqt/qtcore/hbqt_pointer.cpp + * contrib/hbqt/qtcore/hbqt_hbqslots.cpp + * contrib/hbqt/qtcore/hbqt_init.cpp + + Adding more signal handlers plus some other mods. + Patch from Francesco (with some minor mods and fixex, pls check) + 2011-02-27 14:22 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/qtcore/hbqt.h + contrib/hbqt/qtcore/hbqtinit.h diff --git a/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp b/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp index e64b0aba1f..c8dce7b9d3 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp @@ -144,7 +144,7 @@ int HBQSlots::qt_metacall( QMetaObject::Call c, int id, void ** arguments ) if( i > 0 && i <= this->listBlock.size() ) { - QByteArray pString, paramString; + QByteArray paramString; const QMetaMethod meta = object->metaObject()->method( id ); QList arrayOfTypes = meta.parameterTypes(); int parameterCount = arrayOfTypes.size(); @@ -163,7 +163,6 @@ int HBQSlots::qt_metacall( QMetaObject::Call c, int id, void ** arguments ) if( paramString.isNull() ) { QStringList parList; - HB_TRACE( HB_TR_DEBUG, ( "SlotsProxy signature %s", meta.signature() ) ); for( int i = 0; i < parameterCount; i++ ) @@ -175,33 +174,27 @@ int HBQSlots::qt_metacall( QMetaObject::Call c, int id, void ** arguments ) } else { - if( arrayOfTypes.at( i ).contains( "*" ) ) - { - parList += "pointer"; - // use [] because .at returns const QByteArray - pList += arrayOfTypes[ i ].replace( "*", "" ).trimmed().toUpper(); - } - else - { - parList += arrayOfTypes.at( i ).trimmed(); + // if( arrayOfTypes.at( i ).contains( "*" ) ) + // { + // parList += "pointer"; + // // use [] because .at returns const QByteArray + // HB_TRACE( HB_TR_ALWAYS, ( "SlotsProxy callback object %s", arrayOfTypes[i].replace( "*","").trimmed().toUpper().data() ) ); + // pList += arrayOfTypes[ i ].replace( "*", "" ).trimmed().toUpper(); + // } + // else + // { + parList += arrayOfTypes.at( i ).trimmed() ; pList += arrayOfTypes.at( i ).trimmed().toUpper(); - } + // } } } paramString = parList.join( "$" ).toAscii(); object->setProperty( szParams, paramString ); - pString = pList.join( "$" ).toAscii(); object->setProperty( szPList, pList ); HB_TRACE( HB_TR_DEBUG, ( " SlotsProxy parList %s ", ( char * ) paramString.data() ) ); } - #if 0 - else - { - HB_TRACE( HB_TR_ALWAYS, ( " pList is assigned %s ", ( char * ) pString.data() ) ); - } - #endif } if( hb_vmRequestReenter() ) diff --git a/harbour/contrib/hbqt/qtcore/hbqt_init.cpp b/harbour/contrib/hbqt/qtcore/hbqt_init.cpp index f547648a9a..01857f1a52 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_init.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_init.cpp @@ -74,11 +74,14 @@ #include #include #include +#include +#include #include HB_EXTERN_BEGIN extern void * hbqt_gcAllocate_QObject( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWidget( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QTime( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QSize( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QSizeF( void * pObj, bool bNew ); @@ -91,6 +94,7 @@ extern void * hbqt_gcAllocate_QDateTime( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QTime( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QModelIndex( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QStringList( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTreeWidgetItem( void * pObj, bool bNew ); HB_EXTERN_END /*----------------------------------------------------------------------*/ @@ -101,8 +105,37 @@ static void hbqt_SlotsExecPointer( PHB_ITEM * codeBlock, void ** arguments, QStr hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QObject( ( *reinterpret_cast< void*( * ) >( arguments[ 1 ] ) ), false ), ( const char * ) pList.at( 0 ).data() ) ); + HB_TRACE( HB_TR_DEBUG, ( "ExecPointer 1 %s", pList.at( 0 ).toAscii().data() ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QObject( ( *reinterpret_cast< void*( * ) >( arguments[ 1 ] ) ), false ), ( const char * ) pList.at( 0 ).toAscii().data() ) ); + HB_TRACE( HB_TR_DEBUG, ( "ExecPointer 2 %s", pList.at( 0 ).toAscii().data() ) ); hb_vmSend( 1 ); + HB_TRACE( HB_TR_DEBUG, ( "ExecPointer 3 %s", pList.at( 0 ).toAscii().data() ) ); +} + +static void hbqt_SlotsExecQMdiSubWindow( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) +{ + Q_UNUSED( pList ); + + hb_vmPushEvalSym(); + hb_vmPush( codeBlock ); + HB_TRACE( HB_TR_DEBUG, ( "ExecQMdiSubWindow 1 %s", pList.at( 0 ).toAscii().data() ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QMdiSubWindow( ( *reinterpret_cast< void*( * ) >( arguments[ 1 ] ) ), false ), "QMdiSubWindow" ) ); + HB_TRACE( HB_TR_DEBUG, ( "ExecQMdiSubWindow 2 %s", pList.at( 0 ).toAscii().data() ) ); + hb_vmSend( 1 ); + HB_TRACE( HB_TR_DEBUG, ( "ExecQMdiSubWindow 3 %s", pList.at( 0 ).toAscii().data() ) ); +} + +static void hbqt_SlotsExecQTreeWidgetItem( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) +{ + Q_UNUSED( pList ); + + hb_vmPushEvalSym(); + hb_vmPush( codeBlock ); + HB_TRACE( HB_TR_DEBUG, ( "ExecQTreeWidgetItem 1 %s", pList.at( 0 ).toAscii().data() ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QTreeWidgetItem( ( *reinterpret_cast< void*( * ) >( arguments[ 1 ] ) ), false ), "QTreeWidgetItem" ) ); + HB_TRACE( HB_TR_DEBUG, ( "ExecQTreeWidgetItem 2 %s", pList.at( 0 ).toAscii().data() ) ); + hb_vmSend( 1 ); + HB_TRACE( HB_TR_DEBUG, ( "ExecQTreeWidgetItem 3 %s", pList.at( 0 ).toAscii().data() ) ); } static void hbqt_SlotsExecPointerPointer( PHB_ITEM * codeBlock, void ** arguments, QStringList pList ) @@ -122,7 +155,7 @@ static void hbqt_SlotsExecPointerInt( PHB_ITEM * codeBlock, void ** arguments, Q hb_vmPushEvalSym(); hb_vmPush( codeBlock ); - 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[ 1 ] ) ), false ), ( const char * ) pList.at( 0 ).toAscii().data() ) ); hb_vmPushInteger( *reinterpret_cast< int( * ) >( arguments[ 2 ] ) ); hb_vmSend( 2 ); } @@ -221,7 +254,7 @@ static void hbqt_SlotsExecModelModel( PHB_ITEM * codeBlock, void ** arguments, Q hb_vmPushEvalSym(); hb_vmPush( codeBlock ); hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), true ), "QModelIndex" ) ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 1 ] ) ) ), true ), "QModelIndex" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QModelIndex( new QModelIndex( ( *reinterpret_cast< QModelIndex( * ) >( arguments[ 2 ] ) ) ), true ), "QModelIndex" ) ); hb_vmSend( 2 ); } @@ -373,6 +406,8 @@ static void hbqt_registerCallbacks( void ) hbqt_slots_register_callback( "double" , hbqt_SlotsExecDouble ); hbqt_slots_register_callback( "pointer" , hbqt_SlotsExecPointer ); hbqt_slots_register_callback( "pointer$pointer" , hbqt_SlotsExecPointerPointer ); + hbqt_slots_register_callback( "QTreeWidgetItem*" , hbqt_SlotsExecQTreeWidgetItem ); + hbqt_slots_register_callback( "QMdiSubWindow*" , hbqt_SlotsExecQMdiSubWindow ); hbqt_slots_register_callback( "pointer$int" , hbqt_SlotsExecPointerInt ); hbqt_slots_register_callback( "QDate" , hbqt_SlotsExecQDate ); hbqt_slots_register_callback( "QDateTime" , hbqt_SlotsExecQDateTime ); @@ -389,6 +424,8 @@ static void hbqt_registerCallbacks( void ) hbqt_slots_register_callback( "QStringList" , hbqt_SlotsExecStringList ); hbqt_slots_register_callback( "QTime" , hbqt_SlotsExecQTime ); hbqt_slots_register_callback( "QUrl" , hbqt_SlotsExecQUrl ); +// hbqt_slots_register_callback( "QObject*" , hbqt_SlotsExecQObject ); +// hbqt_slots_register_callback( "QWidget*" , hbqt_SlotsExecQWidget ); hbqt_events_register_createobj( QEvent::Timer , "hb_QEvent" ); } diff --git a/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp b/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp index a57173d5a7..d8910cc943 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp @@ -437,6 +437,8 @@ PHB_ITEM hbqt_create_object( void * pObject, const char * pszObjectName ) PHB_ITEM pRetVal; PHB_ITEM pItem = hb_itemPutPtr( NULL, pObject ); + HB_TRACE( HB_TR_DEBUG, ( "create_object %s", pszObjectName ) ); + hb_vmPushDynSym( hb_dynsymGet( pszObjectName ) ); hb_vmPushNil(); hb_vmDo( 0 ); diff --git a/harbour/contrib/hbqt/qtgui/hbqt_init.cpp b/harbour/contrib/hbqt/qtgui/hbqt_init.cpp index 6723c89c86..0c19581477 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_init.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_init.cpp @@ -71,6 +71,14 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include #include @@ -81,6 +89,14 @@ extern void * hbqt_gcAllocate_QTextCharFormat( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QFont( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QTextCursor( void * pObj, bool bNew ); extern void * hbqt_gcAllocate_QTextBlock( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QAbstractButton( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QAction( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QMdiSubWindow( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QPrinter( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QStandardItem( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QListWidgetItem( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QTreeWidgetItem( void * pObj, bool bNew ); +extern void * hbqt_gcAllocate_QWidget( void * pObj, bool bNew ); HB_EXTERN_END /*----------------------------------------------------------------------*/ @@ -102,7 +118,7 @@ static void hbqt_SlotsExecItemSelItemSel( PHB_ITEM * codeBlock, void ** argument hb_vmPushEvalSym(); hb_vmPush( codeBlock ); hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QItemSelection( new QItemSelection( ( *reinterpret_cast< QItemSelection( * ) >( arguments[ 1 ] ) ) ), true ), "QItemSelection" ) ); - hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QItemSelection( new QItemSelection( ( *reinterpret_cast< QItemSelection( * ) >( arguments[ 1 ] ) ) ), true ), "QItemSelection" ) ); + hb_vmPush( hbqt_create_object( hbqt_gcAllocate_QItemSelection( new QItemSelection( ( *reinterpret_cast< QItemSelection( * ) >( arguments[ 2 ] ) ) ), true ), "QItemSelection" ) ); hb_vmSend( 2 ); } @@ -146,6 +162,27 @@ static void hbqt_SlotsExecQTextBlock( PHB_ITEM * codeBlock, void ** arguments, Q hb_vmSend( 1 ); } +HBQT_SLOT_CALLBACK_OBJ( QAbstractButton ) +HBQT_SLOT_CALLBACK_OBJ( QAction ) +HBQT_SLOT_CALLBACK_OBJ( QMdiSubWindow ) +HBQT_SLOT_CALLBACK_OBJ( QPrinter ) +HBQT_SLOT_CALLBACK_OBJ( QStandardItem ) +HBQT_SLOT_CALLBACK_OBJ_OBJ( QListWidgetItem, QListWidgetItem ) +HBQT_SLOT_CALLBACK_OBJ_OBJ( QTableWidgetItem, QTableWidgetItem ) +HBQT_SLOT_CALLBACK_OBJ_OBJ( QTreeWidgetItem, QTreeWidgetItem ) +HBQT_SLOT_CALLBACK_OBJ_OBJ( QWidget, QWidget ) +HBQT_SLOT_CALLBACK_OBJ_INT( QTreeWidgetItem ) + + +HB_FUNC_EXTERN( HB_QABSTRACTBUTTON ); +HB_FUNC_EXTERN( HB_QACTION ); +HB_FUNC_EXTERN( HB_QMDISUBWINDOW ); +HB_FUNC_EXTERN( HB_QPRINTER ); +HB_FUNC_EXTERN( HB_QSTANDARDITEM ); +HB_FUNC_EXTERN( HB_QLISTWIDGETITEM ); +HB_FUNC_EXTERN( HB_QTABLEWIDGETITEM ); +HB_FUNC_EXTERN( HB_QTREEWIDGETITEM ); + /*----------------------------------------------------------------------*/ HB_FUNC_EXTERN( HB_QCONTEXTMENUEVENT ); @@ -203,16 +240,36 @@ void _hbqtgui_force_link_for_event( void ) HB_FUNC_EXEC( HB_QSHOWEVENT ); HB_FUNC_EXEC( HB_QWHEELEVENT ); HB_FUNC_EXEC( HB_QWINDOWSTATECHANGEEVENT ); + + HB_FUNC_EXEC( HB_QABSTRACTBUTTON ); + HB_FUNC_EXEC( HB_QACTION ); + HB_FUNC_EXEC( HB_QMDISUBWINDOW ); + HB_FUNC_EXEC( HB_QPRINTER ); + HB_FUNC_EXEC( HB_QSTANDARDITEM ); + HB_FUNC_EXEC( HB_QLISTWIDGETITEM ); + HB_FUNC_EXEC( HB_QTABLEWIDGETITEM ); + HB_FUNC_EXEC( HB_QTREEWIDGETITEM ); } static void hbqt_registerCallbacks( void ) { - hbqt_slots_register_callback( "QColor" , hbqt_SlotsExecQColor ); - hbqt_slots_register_callback( "QFont" , hbqt_SlotsExecQFont ); - hbqt_slots_register_callback( "QItemSelection$QItemSelection" , hbqt_SlotsExecItemSelItemSel ); - hbqt_slots_register_callback( "QTextBlock" , hbqt_SlotsExecQTextBlock ); - hbqt_slots_register_callback( "QTextCharFormat" , hbqt_SlotsExecQTextCharFormat ); - hbqt_slots_register_callback( "QTextCursor" , hbqt_SlotsExecQTextCursor ); + hbqt_slots_register_callback( "QColor" , hbqt_SlotsExecQColor ); + hbqt_slots_register_callback( "QFont" , hbqt_SlotsExecQFont ); + hbqt_slots_register_callback( "QItemSelection$QItemSelection" , hbqt_SlotsExecItemSelItemSel ); + hbqt_slots_register_callback( "QTextBlock" , hbqt_SlotsExecQTextBlock ); + hbqt_slots_register_callback( "QTextCharFormat" , hbqt_SlotsExecQTextCharFormat ); + hbqt_slots_register_callback( "QTextCursor" , hbqt_SlotsExecQTextCursor ); + hbqt_slots_register_callback( "QAbstractButton*" , hbqt_SlotsExecQAbstractButton ); + hbqt_slots_register_callback( "QAction*" , hbqt_SlotsExecQAction ); + hbqt_slots_register_callback( "QListWidgetItem*$QListWidgetItem*" , hbqt_SlotsExecQListWidgetItemQListWidgetItem ); + hbqt_slots_register_callback( "QMdiSubWindow*" , hbqt_SlotsExecQMdiSubWindow ); + hbqt_slots_register_callback( "QPrinter*" , hbqt_SlotsExecQPrinter ); + hbqt_slots_register_callback( "QStandardItem*" , hbqt_SlotsExecQStandardItem ); + hbqt_slots_register_callback( "QTableWidgetItem*$QTableWidgetItem*" , hbqt_SlotsExecQTableWidgetItemQTableWidgetItem ); + hbqt_slots_register_callback( "QTreeWidgetItem*$int" , hbqt_SlotsExecQTreeWidgetItemInt ); + hbqt_slots_register_callback( "QTreeWidgetItem*$QTreeWidgetItem*" , hbqt_SlotsExecQTreeWidgetItemQTreeWidgetItem ); + hbqt_slots_register_callback( "QWidget*$int" , hbqt_SlotsExecQWidgetInt ); + hbqt_slots_register_callback( "QWidget*$QWidget*" , hbqt_SlotsExecQWidgetQWidget ); hbqt_events_register_createobj( QEvent::MouseButtonPress , "hb_QMouseEvent" ); hbqt_events_register_createobj( QEvent::MouseButtonRelease , "hb_QMouseEvent" );