From 8db3fa77a4246763e70c17957310e3c00bb5e4fa Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 16 Oct 2010 23:48:40 +0000 Subject: [PATCH] 2010-10-17 01:38 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/qtcore/hbqt_pointer.cpp * contrib/hbqt/qtcore/hbqt_hbqslots.cpp * contrib/hbqt/qtcore/hbqt_hbqevents.cpp * contrib/hbqt/qtcore/hbqt_misc.prg * contrib/hbqt/utils/hbqtgen.prg * Renamed HBQT_PTR() -> __HBQT_PTR(). (HBQT_PTR() still present and can be renamed once sources were regenerated) * Renamed QT_[SLOTS|EVENTS]_*() -> __HBQT_[SLOTS|EVENTS]_*() This also fixes the problem where these were missing from .hbx file. * Renamed HBQT_ERROR() -> __HBQT_ERROR(). + Added NOTE about contradiction where :hasValidPointer() will never return .T. for valid objects created with FromPointer() call. Another reason to drop this object instantiation method. + Added more TODO/NOTE/TOFIX text. * contrib/hbqt/qtcore/hbqtcore.hbx * contrib/hbqt/qtnetwork/hbqtnetwork.hbx * Refreshed. * contrib/hbqt/tests/dialogqt.prg * contrib/hbide/plugins/hbide_script_qtgui.hbs * QT_[SLOTS|EVENTS]_*() -> __HBQT_[SLOTS|EVENTS]_*() ; QUESTION: Should these examples changed to use :connect()/:disconnect()? --- harbour/ChangeLog | 25 +++++++ .../hbide/plugins/hbide_script_qtgui.hbs | 8 +-- .../contrib/hbqt/qtcore/hbqt_hbqevents.cpp | 6 +- harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp | 16 ++--- harbour/contrib/hbqt/qtcore/hbqt_misc.prg | 20 +++--- harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp | 22 +++++- harbour/contrib/hbqt/qtcore/hbqtcore.hbx | 64 ++++++++++++++++- .../contrib/hbqt/qtnetwork/hbqtnetwork.hbx | 6 ++ harbour/contrib/hbqt/tests/dialogqt.prg | 70 +++++++++---------- harbour/contrib/hbqt/utils/hbqtgen.prg | 12 ++-- 10 files changed, 181 insertions(+), 68 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d21b9d13c8..fc7a014beb 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,31 @@ The license applies to all entries newer than 2009-04-28. */ +2010-10-17 01:38 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbqt/qtcore/hbqt_pointer.cpp + * contrib/hbqt/qtcore/hbqt_hbqslots.cpp + * contrib/hbqt/qtcore/hbqt_hbqevents.cpp + * contrib/hbqt/qtcore/hbqt_misc.prg + * contrib/hbqt/utils/hbqtgen.prg + * Renamed HBQT_PTR() -> __HBQT_PTR(). + (HBQT_PTR() still present and can be renamed once sources were regenerated) + * Renamed QT_[SLOTS|EVENTS]_*() -> __HBQT_[SLOTS|EVENTS]_*() + This also fixes the problem where these were missing from .hbx file. + * Renamed HBQT_ERROR() -> __HBQT_ERROR(). + + Added NOTE about contradiction where :hasValidPointer() will never + return .T. for valid objects created with FromPointer() call. + Another reason to drop this object instantiation method. + + Added more TODO/NOTE/TOFIX text. + + * contrib/hbqt/qtcore/hbqtcore.hbx + * contrib/hbqt/qtnetwork/hbqtnetwork.hbx + * Refreshed. + + * contrib/hbqt/tests/dialogqt.prg + * contrib/hbide/plugins/hbide_script_qtgui.hbs + * QT_[SLOTS|EVENTS]_*() -> __HBQT_[SLOTS|EVENTS]_*() + ; QUESTION: Should these examples changed to use :connect()/:disconnect()? + 2010-10-16 14:36 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbqt/qtcore/hbqt_misc.prg ! Adopted: HB_*Class:from( pPtr ) => *ClassFromPointer( pPtr ). diff --git a/harbour/contrib/hbide/plugins/hbide_script_qtgui.hbs b/harbour/contrib/hbide/plugins/hbide_script_qtgui.hbs index 59cbd9321f..bbed7a5db9 100644 --- a/harbour/contrib/hbide/plugins/hbide_script_qtgui.hbs +++ b/harbour/contrib/hbide/plugins/hbide_script_qtgui.hbs @@ -55,8 +55,8 @@ FUNCTION Main( oIde ) LOCAL nRet, cText, lOtherLib, cOpt LOCAL qDlg, qLbl, qCheck, qEdit, qCombo, qBtnOk, qBtnCn - LOCAL pEvents := QT_EVENTS_NEW() - LOCAL pSlots := QT_SLOTS_NEW() + LOCAL pEvents := HBQT_EVENTS_NEW() + LOCAL pSlots := HBQT_SLOTS_NEW() IF ! hb_isObject( oIde ) oIde := hbide_setIde() @@ -97,8 +97,8 @@ FUNCTION Main( oIde ) QT_EVENTS_CONNECT( pEvents, qDlg, 10, {|| qDlg:done( 0 ) } ) - QT_SLOTS_CONNECT( pSlots, qBtnOk, "clicked()", {|| qDlg:done( 1 ) } ) - QT_SLOTS_CONNECT( pSlots, qBtnCn, "clicked()", {|| qDlg:done( 2 ) } ) + HBQT_SLOTS_CONNECT( pSlots, qBtnOk, "clicked()", {|| qDlg:done( 1 ) } ) + HBQT_SLOTS_CONNECT( pSlots, qBtnCn, "clicked()", {|| qDlg:done( 2 ) } ) nRet := qDlg:exec() diff --git a/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp b/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp index c2347fe0c6..a905ab7db6 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_hbqevents.cpp @@ -183,7 +183,7 @@ bool HBQEvents::eventFilter( QObject * object, QEvent * event ) return ret; } -HB_FUNC( QT_EVENTS_CONNECT ) +HB_FUNC( __HBQT_EVENTS_CONNECT ) { HB_BOOL bRet = HB_FALSE; HBQEvents * t_events = hbqt_par_HBQEvents( 1 ); @@ -215,7 +215,7 @@ HB_FUNC( QT_EVENTS_CONNECT ) hb_retl( bRet ); } -HB_FUNC( QT_EVENTS_DISCONNECT ) +HB_FUNC( __HBQT_EVENTS_DISCONNECT ) { HB_BOOL bRet = HB_FALSE; HBQEvents * t_events = hbqt_par_HBQEvents( 1 ); @@ -248,7 +248,7 @@ HB_FUNC( QT_EVENTS_DISCONNECT ) hb_retl( bRet ); } -HB_FUNC( QT_EVENTS_NEW ) +HB_FUNC( __HBQT_EVENTS_NEW ) { void * pObj = NULL; diff --git a/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp b/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp index 1887f69cec..9c6a1372b3 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_hbqslots.cpp @@ -1138,14 +1138,14 @@ void HBQSlots::lastWindowClosed() /* * Harbour function to connect signals with slots */ -HB_FUNC( QT_SLOTS_CONNECT ) +HB_FUNC( __HBQT_SLOTS_CONNECT ) { HB_BOOL bRet = HB_FALSE; HBQSlots * t_slots = hbqt_par_HBQSlots( 1 ); if( t_slots ) { -HB_TRACE( HB_TR_DEBUG, ( "QT_SLOTS_CONNECT( %s )", hb_parcx( 3 ) ) ); +HB_TRACE( HB_TR_DEBUG, ( "__HBQT_SLOTS_CONNECT( %s )", hb_parcx( 3 ) ) ); QObject * object = ( QObject * ) hbqt_pPtrFromObj( 2 ); /* get sender */ if( object ) { @@ -1162,7 +1162,7 @@ HB_TRACE( HB_TR_DEBUG, ( "QT_SLOTS_CONNECT( %s )", hb_parcx( 3 ) ) ); bRet = HB_TRUE; } } -HB_TRACE( HB_TR_DEBUG, ( "QT_SLOTS_CONNECT( %s ) %s", hb_parcx( 3 ), bRet ? "Connected" : "not-connected" ) ); +HB_TRACE( HB_TR_DEBUG, ( "__HBQT_SLOTS_CONNECT( %s ) %s", hb_parcx( 3 ), bRet ? "Connected" : "not-connected" ) ); } } hb_retl( bRet ); @@ -1171,7 +1171,7 @@ HB_TRACE( HB_TR_DEBUG, ( "QT_SLOTS_CONNECT( %s ) %s", hb_parcx( 3 ), bRet ? "Con /* * Harbour function to disconnect signals */ -HB_FUNC( QT_SLOTS_DISCONNECT ) +HB_FUNC( __HBQT_SLOTS_DISCONNECT ) { HB_BOOL bRet = HB_FALSE; HBQSlots * t_slots = hbqt_par_HBQSlots( 1 ); @@ -1203,7 +1203,7 @@ HB_TRACE( HB_TR_DEBUG, ( "QT_SLOTS_DISCONNECT( %s ) %s", hb_parcx( 3 ), bRet ? " hb_retl( bRet ); } -HB_FUNC( QT_SLOTS_NEW ) +HB_FUNC( __HBQT_SLOTS_NEW ) { void * pObj = NULL; @@ -1826,7 +1826,7 @@ int HBQSlots::qt_metacall( QMetaObject::Call c, int id, void **arguments ) /* * Harbour function to connect signals with slots */ -HB_FUNC( QT_SLOTS_CONNECT ) +HB_FUNC( __HBQT_SLOTS_CONNECT ) { HB_BOOL bRet = HB_FALSE; HBQSlots * t_slots = hbqt_par_HBQSlots( 1 ); @@ -1864,7 +1864,7 @@ HB_FUNC( QT_SLOTS_CONNECT ) /* * Harbour function to disconnect signals */ -HB_FUNC( QT_SLOTS_DISCONNECT ) +HB_FUNC( __HBQT_SLOTS_DISCONNECT ) { HB_BOOL bRet = HB_FALSE; HBQSlots * t_slots = hbqt_par_HBQSlots( 1 ); @@ -1892,7 +1892,7 @@ HB_FUNC( QT_SLOTS_DISCONNECT ) hb_retl( bRet ); } -HB_FUNC( QT_SLOTS_NEW ) +HB_FUNC( __HBQT_SLOTS_NEW ) { void * pObj = NULL; diff --git a/harbour/contrib/hbqt/qtcore/hbqt_misc.prg b/harbour/contrib/hbqt/qtcore/hbqt_misc.prg index ffe04b71fc..de230df22f 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_misc.prg +++ b/harbour/contrib/hbqt/qtcore/hbqt_misc.prg @@ -55,7 +55,7 @@ /*----------------------------------------------------------------------*/ -CLASS HbQtObjectHandler +CREATE CLASS HbQtObjectHandler VAR pPtr VAR pSlots @@ -89,17 +89,19 @@ METHOD HbQtObjectHandler:from( xObject ) /* TODO: Drop this function when all raw QT pointers are fully eliminated from .prg level. */ METHOD HbQtObjectHandler:fromPointer( pPtr ) + /* NOTE: Non-GC collected pointers are allowed here. */ IF hb_isPointer( pPtr ) ::pPtr := pPtr ELSE - hbqt_Error() + __hbqt_Error() ENDIF RETURN Self /*----------------------------------------------------------------------*/ /* TODO: Drop this function, as it's not desired to have invalid QT pointers wrapped - into valid .prg level QT objects. */ + into valid .prg level QT objects. + Currently it will return .F. for objects created using :fromPointer() */ METHOD HbQtObjectHandler:hasValidPointer() RETURN __hbqt_IsValidPointer( ::pPtr ) @@ -138,17 +140,17 @@ METHOD HbQtObjectHandler:connect( cnEvent, bBlock ) CASE "C" IF Empty( ::pSlots ) - ::pSlots := Qt_Slots_New() + ::pSlots := __hbqt_slots_New() ENDIF - RETURN Qt_Slots_Connect( ::pSlots, ::pPtr, cnEvent, bBlock ) + RETURN __hbqt_slots_Connect( ::pSlots, ::pPtr, cnEvent, bBlock ) CASE "N" IF Empty( ::pEvents ) - ::pEvents := Qt_Events_New() + ::pEvents := __hbqt_events_New() ::installEventFilter( HBQEventsFromPointer( ::pEvents ) ) ENDIF - RETURN Qt_Events_Connect( ::pEvents, ::pPtr, cnEvent, bBlock ) + RETURN __hbqt_events_Connect( ::pEvents, ::pPtr, cnEvent, bBlock ) ENDSWITCH @@ -162,14 +164,14 @@ METHOD HbQtObjectHandler:disconnect( cnEvent ) CASE "C" IF ! Empty( ::pSlots ) - RETURN Qt_Slots_DisConnect( ::pSlots, ::pPtr, cnEvent ) + RETURN __hbqt_slots_Disconnect( ::pSlots, ::pPtr, cnEvent ) ENDIF EXIT CASE "N" IF ! Empty( ::pEvents ) - RETURN Qt_Events_DisConnect( ::pEvents, ::pPtr, cnEvent ) + RETURN __hbqt_events_Disconnect( ::pEvents, ::pPtr, cnEvent ) ENDIF EXIT diff --git a/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp b/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp index 0e9ca4b87f..2c2c0410c7 100644 --- a/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp +++ b/harbour/contrib/hbqt/qtcore/hbqt_pointer.cpp @@ -204,6 +204,26 @@ HB_FUNC( HBQT_ISOBJECT ) hb_retl( HB_FALSE ); } +HB_FUNC( __HBQT_PTR ) +{ + PHB_ITEM pParam = hb_param( 1, HB_IT_ANY ); + + if( hb_itemType( pParam ) & HB_IT_OBJECT ) + { + PHB_ITEM pRetVal; + + hb_vmPushSymbol( hb_dynsymSymbol( hb_dynsymFindName( "PPTR" ) ) ); + hb_vmPush( pParam ); + hb_vmSend( 0 ); + + if( ( pRetVal = hb_param( -1, HB_IT_POINTER ) ) != NULL ) + return; + } + + hb_itemReturn( pParam ); +} + +/* TODO: Delete this, once code has been converted to use __HBQT_PTR() */ HB_FUNC( HBQT_PTR ) { PHB_ITEM pParam = hb_param( 1, HB_IT_ANY ); @@ -271,7 +291,7 @@ HB_FUNC( HBQT_ISEQUALGCQTPOINTER ) hb_retl( hbqt_pPtrFromObj( 1 ) == hbqt_pPtrFromObj( 2 ) ); } -HB_FUNC( HBQT_ERROR ) +HB_FUNC( __HBQT_ERROR ) { PHB_ITEM pError = hb_errRT_New( ES_ERROR, "HBQT", EG_ARG, 1001, NULL, NULL, 0, EF_NONE ); hb_errLaunch( pError ); diff --git a/harbour/contrib/hbqt/qtcore/hbqtcore.hbx b/harbour/contrib/hbqt/qtcore/hbqtcore.hbx index 278bcfef07..0281e91085 100644 --- a/harbour/contrib/hbqt/qtcore/hbqtcore.hbx +++ b/harbour/contrib/hbqt/qtcore/hbqtcore.hbx @@ -38,12 +38,64 @@ DYNAMIC HBQSTRING DYNAMIC HBQSTRINGFROM DYNAMIC HBQSTRINGFROMPOINTER DYNAMIC HBQTOBJECTHANDLER -DYNAMIC HBQT_ERROR DYNAMIC HBQT_FINDCHILD DYNAMIC HBQT_ISEQUALGCQTPOINTER DYNAMIC HBQT_ISOBJECT -DYNAMIC HBQT_PTR +DYNAMIC HB_HBQEVENTS +DYNAMIC HB_HBQSLOTS +DYNAMIC HB_HBQSTRING +DYNAMIC HB_QABSTRACTITEMMODEL +DYNAMIC HB_QABSTRACTLISTMODEL +DYNAMIC HB_QABSTRACTTABLEMODEL +DYNAMIC HB_QBITARRAY +DYNAMIC HB_QBUFFER +DYNAMIC HB_QBYTEARRAY +DYNAMIC HB_QCHAR +DYNAMIC HB_QCOREAPPLICATION +DYNAMIC HB_QDATASTREAM +DYNAMIC HB_QDATE +DYNAMIC HB_QDATETIME +DYNAMIC HB_QDIR +DYNAMIC HB_QEVENT +DYNAMIC HB_QEVENTLOOP +DYNAMIC HB_QFILE +DYNAMIC HB_QFILEINFO +DYNAMIC HB_QIODEVICE +DYNAMIC HB_QLATIN1CHAR +DYNAMIC HB_QLATIN1STRING +DYNAMIC HB_QLINE +DYNAMIC HB_QLINEF +DYNAMIC HB_QLIST +DYNAMIC HB_QLOCALE +DYNAMIC HB_QMIMEDATA +DYNAMIC HB_QMODELINDEX +DYNAMIC HB_QOBJECT +DYNAMIC HB_QPOINT +DYNAMIC HB_QPOINTF +DYNAMIC HB_QPROCESS +DYNAMIC HB_QRECT +DYNAMIC HB_QRECTF +DYNAMIC HB_QREGEXP +DYNAMIC HB_QRESOURCE +DYNAMIC HB_QSETTINGS +DYNAMIC HB_QSIGNALMAPPER +DYNAMIC HB_QSIZE +DYNAMIC HB_QSIZEF +DYNAMIC HB_QSTRINGLIST +DYNAMIC HB_QSTRINGREF DYNAMIC HB_QTCORE +DYNAMIC HB_QTEXTBOUNDARYFINDER +DYNAMIC HB_QTEXTCODEC +DYNAMIC HB_QTEXTDECODER +DYNAMIC HB_QTEXTENCODER +DYNAMIC HB_QTEXTSTREAM +DYNAMIC HB_QTHREAD +DYNAMIC HB_QTIME +DYNAMIC HB_QTIMELINE +DYNAMIC HB_QTIMER +DYNAMIC HB_QTRANSLATOR +DYNAMIC HB_QURL +DYNAMIC HB_QVARIANT DYNAMIC QABSTRACTITEMMODEL DYNAMIC QABSTRACTITEMMODELFROM DYNAMIC QABSTRACTITEMMODELFROMPOINTER @@ -199,7 +251,15 @@ DYNAMIC QVARIANT DYNAMIC QVARIANTFROM DYNAMIC QVARIANTFROMPOINTER DYNAMIC QVERSION +DYNAMIC __HBQT_ERROR +DYNAMIC __HBQT_EVENTS_CONNECT +DYNAMIC __HBQT_EVENTS_DISCONNECT +DYNAMIC __HBQT_EVENTS_NEW DYNAMIC __HBQT_ISVALIDPOINTER +DYNAMIC __HBQT_PTR +DYNAMIC __HBQT_SLOTS_CONNECT +DYNAMIC __HBQT_SLOTS_DISCONNECT +DYNAMIC __HBQT_SLOTS_NEW #ifdef __HBEXTERN__HBQTCORE__REQUEST #uncommand DYNAMIC => EXTERNAL diff --git a/harbour/contrib/hbqt/qtnetwork/hbqtnetwork.hbx b/harbour/contrib/hbqt/qtnetwork/hbqtnetwork.hbx index 1605df8ee5..f8fc41a14c 100644 --- a/harbour/contrib/hbqt/qtnetwork/hbqtnetwork.hbx +++ b/harbour/contrib/hbqt/qtnetwork/hbqtnetwork.hbx @@ -28,6 +28,12 @@ #command DYNAMIC => EXTERNAL #endif +DYNAMIC HB_QFTP +DYNAMIC HB_QHTTP +DYNAMIC HB_QHTTPHEADER +DYNAMIC HB_QHTTPREQUESTHEADER +DYNAMIC HB_QHTTPRESPONSEHEADER +DYNAMIC HB_QNETWORKREQUEST DYNAMIC QFTP DYNAMIC QFTPFROM DYNAMIC QFTPFROMPOINTER diff --git a/harbour/contrib/hbqt/tests/dialogqt.prg b/harbour/contrib/hbqt/tests/dialogqt.prg index 3bd55e7501..ebbd413e59 100644 --- a/harbour/contrib/hbqt/tests/dialogqt.prg +++ b/harbour/contrib/hbqt/tests/dialogqt.prg @@ -115,11 +115,11 @@ PROCEDURE ExecOneMore() LOCAL aMenu, aTool, aGrid, aTabs, aList, oEventLoop LOCAL lExit := .f. - s_events := QT_EVENTS_NEW() - s_slots := QT_SLOTS_NEW() + s_events := __HBQT_EVENTS_NEW() + s_slots := __HBQT_SLOTS_NEW() oWnd := QMainWindow():new() - QT_EVENTS_CONNECT( s_events, oWnd, QEvent_Close, {|| lExit := .t. } ) + __HBQT_EVENTS_CONNECT( s_events, oWnd, QEvent_Close, {|| lExit := .t. } ) oWnd:setMouseTracking( .t. ) oWnd:setWindowTitle( "Harbour-Qt Implementation Test Dialog" ) @@ -152,7 +152,7 @@ PROCEDURE ExecOneMore() EXIT ENDIF ENDDO - QT_EVENTS_DISCONNECT( s_events, oWnd, QEvent_Close ) + __HBQT_EVENTS_DISCONNECT( s_events, oWnd, QEvent_Close ) oEventLoop:exit( 0 ) oEventLoop := 0 @@ -170,26 +170,26 @@ STATIC FUNCTION Build_MenuBar( oWnd ) oMenu1 := QMenu():new() oMenu1:setTitle( "&File" ) - QT_SLOTS_CONNECT( s_slots, oMenu1:addAction_1( "new.png" , "&New" ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "New" , w, l ) } ) - QT_SLOTS_CONNECT( s_slots, oMenu1:addAction_1( "open.png", "&Open" ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Open", w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oMenu1:addAction_1( "new.png" , "&New" ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "New" , w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oMenu1:addAction_1( "open.png", "&Open" ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Open", w, l ) } ) oMenu1:addSeparator() - QT_SLOTS_CONNECT( s_slots, oMenu1:addAction_1( "save.png", "&Save" ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Save", w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oMenu1:addAction_1( "save.png", "&Save" ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Save", w, l ) } ) oMenu1:addSeparator() - QT_SLOTS_CONNECT( s_slots, oMenu1:addAction( "E&xit" ), QT_EVE_TRIGGERED_B, {|w,l| w := w, l := l, MsgInfo( "Exit ?" ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oMenu1:addAction( "E&xit" ), QT_EVE_TRIGGERED_B, {|w,l| w := w, l := l, MsgInfo( "Exit ?" ) } ) oMenuBar:addMenu( oMenu1 ) oMenu2 := QMenu():new() oMenu2:setTitle( "&Dialogs" ) - QT_SLOTS_CONNECT( s_slots, oMenu2:addAction( "&Colors" ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Colors" , w, l ) } ) - QT_SLOTS_CONNECT( s_slots, oMenu2:addAction( "&Fonts" ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Fonts" , w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oMenu2:addAction( "&Colors" ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Colors" , w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oMenu2:addAction( "&Fonts" ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Fonts" , w, l ) } ) oMenu2:addSeparator() - QT_SLOTS_CONNECT( s_slots, oMenu2:addAction( "&PageSetup" ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "PageSetup", w, l ) } ) - QT_SLOTS_CONNECT( s_slots, oMenu2:addAction( "P&review" ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Preview" , w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oMenu2:addAction( "&PageSetup" ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "PageSetup", w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oMenu2:addAction( "P&review" ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Preview" , w, l ) } ) oMenu2:addSeparator() - QT_SLOTS_CONNECT( s_slots, oMenu2:addAction( "&Wizard" ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Wizard" , w, l ) } ) - QT_SLOTS_CONNECT( s_slots, oMenu2:addAction( "W&ebPage" ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "WebPage" , w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oMenu2:addAction( "&Wizard" ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Wizard" , w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oMenu2:addAction( "W&ebPage" ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "WebPage" , w, l ) } ) oMenu2:addSeparator() - QT_SLOTS_CONNECT( s_slots, oMenu2:addAction( "&Another Dialog" ), QT_EVE_TRIGGERED_B, {|w,l| w := w, l := l, hb_threadStart( {|| ExecOneMore() } ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oMenu2:addAction( "&Another Dialog" ), QT_EVE_TRIGGERED_B, {|w,l| w := w, l := l, hb_threadStart( {|| ExecOneMore() } ) } ) oMenuBar:addMenu( oMenu2 ) oWnd:setMenuBar( oMenuBar ) @@ -210,7 +210,7 @@ STATIC FUNCTION Build_ToolBar( oWnd ) oActNew:setIcon( "new.png" ) oActNew:setToolTip( "A New File" ) /* Attach codeblock to be triggered */ - QT_SLOTS_CONNECT( s_slots, oActNew, QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "New" , w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oActNew, QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "New" , w, l ) } ) /* Attach Action with Toolbar */ oTB:addAction( oActNew ) @@ -220,7 +220,7 @@ STATIC FUNCTION Build_ToolBar( oWnd ) oActOpen:setIcon( "open.png" ) oActOpen:setToolTip( "Select a file to be opened!" ) /* Attach codeblock to be triggered */ - QT_SLOTS_CONNECT( s_slots, oActOpen, QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Open" , w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oActOpen, QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Open" , w, l ) } ) /* Attach Action with Toolbar */ oTB:addAction( oActOpen ) @@ -232,7 +232,7 @@ STATIC FUNCTION Build_ToolBar( oWnd ) oActSave:setIcon( "save.png" ) oActSave:setToolTip( "Save this file!" ) /* Attach codeblock to be triggered */ - QT_SLOTS_CONNECT( s_slots, oActSave, QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Save" , w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oActSave, QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Save" , w, l ) } ) /* Attach Action with Toolbar */ oTB:addAction( oActSave ) @@ -247,13 +247,13 @@ STATIC FUNCTION Build_ToolBar( oWnd ) oAct := QAction():new( oWnd ) oAct:setText( "&Colors" ) oAct:setToolTip( "Colors Dialog" ) - QT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Colors", w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Colors", w, l ) } ) oTB:addAction( oAct ) oAct := QAction():new( oWnd ) oAct:setText( "&Fonts" ) oAct:setToolTip( "Fonts Dialog" ) - QT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Fonts", w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Fonts", w, l ) } ) oTB:addAction( oAct ) oTB:addSeparator() @@ -261,13 +261,13 @@ STATIC FUNCTION Build_ToolBar( oWnd ) oAct := QAction():new( oWnd ) oAct:setText( "&PgSetup" ) oAct:setToolTip( "Page Setup Dialog" ) - QT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "PageSetup", w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "PageSetup", w, l ) } ) oTB:addAction( oAct ) oAct := QAction():new( oWnd ) oAct:setText( "&Preview" ) oAct:setToolTip( "Page Preview Dialog" ) - QT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Preview", w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Preview", w, l ) } ) oTB:addAction( oAct ) oTB:addSeparator() @@ -275,19 +275,19 @@ STATIC FUNCTION Build_ToolBar( oWnd ) oAct := QAction():new( oWnd ) oAct:setText( "&Webpage" ) oAct:setToolTip( "Web Browser Dialog" ) - QT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "WebPage", w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "WebPage", w, l ) } ) oTB:addAction( oAct ) oAct := QAction():new( oWnd ) oAct:setText( "&Wizard" ) oAct:setToolTip( "Generic Wizard Dialog" ) - QT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Wizard", w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Wizard", w, l ) } ) oTB:addAction( oAct ) oAct := QAction():new( oWnd ) oAct:setText( "&SystemTray" ) oAct:setToolTip( "Show in System Tray!" ) - QT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| ShowInSystemTray( oWnd, w, l ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oAct, QT_EVE_TRIGGERED_B, {|w,l| ShowInSystemTray( oWnd, w, l ) } ) oTB:addAction( oAct ) /* Add this toolbar with main window */ @@ -309,9 +309,9 @@ STATIC FUNCTION Build_PushButton( oWnd, aPos, aSize, cLabel, cMsg, lExit ) oBtn:resize( aSize[ 1 ],aSize[ 2 ] ) oBtn:show() IF hb_isLogical( lExit ) - QT_SLOTS_CONNECT( s_slots, oBtn, QT_EVE_CLICKED, {|| lExit := .t. } ) + __HBQT_SLOTS_CONNECT( s_slots, oBtn, QT_EVE_CLICKED, {|| lExit := .t. } ) ELSE - QT_SLOTS_CONNECT( s_slots, oBtn, QT_EVE_CLICKED, {|| MsgInfo( cMsg ), lExit := .t. } ) + __HBQT_SLOTS_CONNECT( s_slots, oBtn, QT_EVE_CLICKED, {|| MsgInfo( cMsg ), lExit := .t. } ) ENDIF RETURN oBtn @@ -381,7 +381,7 @@ STATIC FUNCTION Build_TreeView( oWnd ) oTV := QTreeView():new( oWnd ) oTV:setMouseTracking( .t. ) -* QT_SLOTS_CONNECT( s_slots, oTV, QT_EVE_HOVERED, {|i| HB_TRACE( HB_TR_ALWAYS, ( "oTV:hovered" ) } ) +* __HBQT_SLOTS_CONNECT( s_slots, oTV, QT_EVE_HOVERED, {|i| HB_TRACE( HB_TR_ALWAYS, ( "oTV:hovered" ) } ) oDirModel := QDirModel():new() oTV:setModel( oDirModel ) oTV:move( 5, 7 ) @@ -397,7 +397,7 @@ STATIC FUNCTION Build_ListBox( oWnd, aPos, aSize ) oListBox := QListView():New( oWnd ) oListBox:setMouseTracking( .t. ) -* QT_SLOTS_CONNECT( s_slots, oListBox, QT_EVE_HOVERED, {|i| HB_TRACE( HB_TR_ALWAYS, ( "oListBox:hovered" ) } ) +* __HBQT_SLOTS_CONNECT( s_slots, oListBox, QT_EVE_HOVERED, {|i| HB_TRACE( HB_TR_ALWAYS, ( "oListBox:hovered" ) } ) oStrList := QStringList():new() @@ -440,7 +440,7 @@ STATIC FUNCTION Build_Controls( oWnd ) LOCAL oEdit, oCheckBox, oComboBox, oSpinBox, oRadioButton oEdit := QLineEdit():new( oWnd ) - QT_SLOTS_CONNECT( s_slots, oEdit, QT_EVE_RETURNPRESSED, {|i| i := i, MsgInfo( oEdit:text() ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oEdit, QT_EVE_RETURNPRESSED, {|i| i := i, MsgInfo( oEdit:text() ) } ) oEdit:move( 5, 10 ) oEdit:resize( 345, 30 ) oEdit:setMaxLength( 40 ) @@ -452,13 +452,13 @@ STATIC FUNCTION Build_Controls( oWnd ) oComboBox:addItem( "First" ) oComboBox:addItem( "Second" ) oComboBox:addItem( "Third" ) - QT_SLOTS_CONNECT( s_slots, oComboBox, QT_EVE_CURRENTINDEXCHANGED_I, {|i| i := i, MsgInfo( oComboBox:itemText( i ) ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oComboBox, QT_EVE_CURRENTINDEXCHANGED_I, {|i| i := i, MsgInfo( oComboBox:itemText( i ) ) } ) oComboBox:move( 5, 60 ) oComboBox:resize( 345, 30 ) oComboBox:show() oCheckBox := QCheckBox():New( oWnd ) - QT_SLOTS_CONNECT( s_slots, oCheckBox, QT_EVE_STATECHANGED_I, {|i| i := i, MsgInfo( IF( i == 0,"Uncheckd","Checked" ) ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oCheckBox, QT_EVE_STATECHANGED_I, {|i| i := i, MsgInfo( IF( i == 0,"Uncheckd","Checked" ) ) } ) oCheckBox:setText( "Testing CheckBox HbQt" ) oCheckBox:move( 5, 110 ) oCheckBox:resize( 345, 30 ) @@ -470,7 +470,7 @@ STATIC FUNCTION Build_Controls( oWnd ) oSpinBox:Show() oRadioButton := QRadioButton():New( oWnd ) - QT_SLOTS_CONNECT( s_slots, oRadioButton, QT_EVE_CLICKED, {|i| i := i, MsgInfo( "Checked" ) } ) + __HBQT_SLOTS_CONNECT( s_slots, oRadioButton, QT_EVE_CLICKED, {|i| i := i, MsgInfo( "Checked" ) } ) oRadioButton:Move( 5, 210 ) oRadioButton:ReSize( 345, 30 ) oRadioButton:Show() @@ -833,9 +833,9 @@ FUNCTION ShowInSystemTray( oWnd ) oMenu := QMenu():new( oWnd ) oMenu:setTitle( "&File" ) - QT_SLOTS_CONNECT( s_slots, oMenu:addAction_1( "new.png" , "&Show" ), QT_EVE_TRIGGERED_B, {|| oWnd:show() } ) + __HBQT_SLOTS_CONNECT( s_slots, oMenu:addAction_1( "new.png" , "&Show" ), QT_EVE_TRIGGERED_B, {|| oWnd:show() } ) oMenu:addSeparator() - QT_SLOTS_CONNECT( s_slots, oMenu:addAction_1( "save.png", "&Hide" ), QT_EVE_TRIGGERED_B, {|| oWnd:hide() } ) + __HBQT_SLOTS_CONNECT( s_slots, oMenu:addAction_1( "save.png", "&Hide" ), QT_EVE_TRIGGERED_B, {|| oWnd:hide() } ) oSys := QSystemTrayIcon():new( oWnd ) oSys:setIcon( 'new.png' ) diff --git a/harbour/contrib/hbqt/utils/hbqtgen.prg b/harbour/contrib/hbqt/utils/hbqtgen.prg index 57460ef721..5b4d97e077 100644 --- a/harbour/contrib/hbqt/utils/hbqtgen.prg +++ b/harbour/contrib/hbqt/utils/hbqtgen.prg @@ -1036,7 +1036,7 @@ METHOD HbQtSource:buildClass() FOR EACH oArg IN oMtd:hArgs cP := strtran( strtran( oArg:cDoc, "@", "" ), "::", "_" ) cM += cP + ", " - cC += iif( left( cP, 1 ) == "p", "hbqt_ptr( " + cP + " )", cP ) + ", " + cC += iif( left( cP, 1 ) == "p", "__hbqt_ptr( " + cP + " )", cP ) + ", " NEXT ENDIF cM := alltrim( cM ) ; cM := iif( right( cM,1 ) == ",", substr( cM, 1, len( cM ) - 1 ), cM ) @@ -1102,7 +1102,7 @@ METHOD HbQtSource:buildClass() aadd( txt_, "METHOD " + ::cWidget + ":new( ... )" ) aadd( txt_, " LOCAL p" ) aadd( txt_, " FOR EACH p IN { ... }" ) - aadd( txt_, " hb_pvalue( p:__enumIndex(), hbqt_ptr( p ) )" ) + aadd( txt_, " hb_pvalue( p:__enumIndex(), __hbqt_ptr( p ) )" ) aadd( txt_, " NEXT" ) aadd( txt_, " ::pPtr := Qt_" + ::cWidget + "( ... )" ) aadd( txt_, " RETURN Self" ) @@ -1120,7 +1120,7 @@ METHOD HbQtSource:buildClass() aadd( txt_, "METHOD " + ::cWidget + ":" + oMtd:cHBFunc + "( ... )" ) a_:= hbide_pullSameMethods( oMtd:cFun, ::aMethods, ::cWidget ) aeval( a_, {|e| aadd( txt_, e ) } ) - aadd( txt_, " RETURN hbqt_error()" ) + aadd( txt_, " RETURN __hbqt_error()" ) aadd( txt_, "" ) ELSEIF oMtd:areFuncClubbed .AND. oMtd:isSibling /* is another call with same name handedlled previously - do nothing */ @@ -1132,7 +1132,7 @@ METHOD HbQtSource:buildClass() aadd( txt_, "METHOD " + ::cWidget + ":" + oMtd:cHBFunc + "( ... )" ) a_:= hbide_pullSameMethods( oMtd:cFun, ::aMethods, ::cWidget ) aeval( a_, {|e| aadd( txt_, e ) } ) - aadd( txt_, " RETURN hbqt_error()" ) + aadd( txt_, " RETURN __hbqt_error()" ) aadd( txt_, "" ) ELSE aadd( txt_, "" ) @@ -2194,12 +2194,12 @@ STATIC FUNCTION ParsePtr( cParam ) IF ( n := at( ",", cParam ) ) > 0 s := substr( cParam, 1, n-1 ) cParam := substr( cParam, n ) - cPar += "hbqt_ptr( " + s + " )" + cPar += "__hbqt_ptr( " + s + " )" ELSEIF ( n := at( " ", cParam ) ) > 0 s := substr( cParam, 1, n-1 ) cParam := substr( cParam, n ) - cPar += "hbqt_ptr( " + s + " )" + cPar += "__hbqt_ptr( " + s + " )" cPar += cParam EXIT