diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 41f4bb1ae9..671c779179 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,26 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-12-18 01:37 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbqt/hbqt.h + * contrib/hbqt/hbqt_base.cpp + * contrib/hbqt/hbqt_destruct.cpp + * contrib/hbqt/hbqt_events.cpp + * contrib/hbqt/hbqt_slots.cpp + + * contrib/hbxbp/xbpbrowse.prg + * contrib/hbxbp/xbphtmlviewer.prg + * contrib/hbxbp/xbpmenubar.prg + * contrib/hbxbp/xbpprinter.prg + * contrib/hbxbp/xbppushbutton.prg + * contrib/hbxbp/xbptoolbar.prg + * contrib/hbxbp/xbpwindow.prg + + * contrib/hbqt/tests/demoqt.prg + * contrib/hbide/hbide.prg + ! Cleaned up QT_PTROF() macro altogether. + A few instances are left in the HBXBP scheduled to be reviewed later. + 2009-12-18 10:19 UTC+0200 Viktor Szakats (harbour.01 syenar.hu) * INSTALL + Added more generic link for QT OSS downloads. diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 110d7088c5..d5f2102363 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -650,10 +650,10 @@ METHOD HbIde:editSource( cSourceFile, nPos, nHPos, nVPos ) ::manageFocusInEditor() ::dispEditInfo() - Qt_Connect_Signal( QT_PTROF( qEdit ), "textChanged()", ; + Qt_Connect_Signal( qEdit, "textChanged()", ; {|| ::setTabImage( oTab, qEdit, nPos, @lFirst, qDocument ) } ) - Qt_Connect_Signal( QT_PTROF( qEdit ), "cursorPositionChanged()", {|| ::dispEditInfo() } ) + Qt_Connect_Signal( qEdit, "cursorPositionChanged()", {|| ::dispEditInfo() } ) RETURN Self @@ -728,8 +728,8 @@ METHOD HbIde:closeSource( nTab ) /* Destroy all objects */ // { oTab, qEdit, qHiliter, qLayout, cSourceFile, qDocument } // - Qt_DisConnect_Signal( QT_PTROF( ::aTabs[ nTab, 2 ] ), "textChanged()" ) - Qt_DisConnect_Signal( QT_PTROF( ::aTabs[ nTab, 2 ] ), "cursorPositionChanged()" ) + Qt_DisConnect_Signal( ::aTabs[ nTab, 2 ], "textChanged()" ) + Qt_DisConnect_Signal( ::aTabs[ nTab, 2 ], "cursorPositionChanged()" ) ::aTabs[ nTab, 6 ]:pPtr := 0 ::aTabs[ nTab, 4 ]:pPtr := 0 @@ -1405,7 +1405,7 @@ METHOD HbIde:printPreview() qDlg := QPrintPreviewDialog():new( QT_PTROFXBP( ::oDlg ) ) qDlg:setWindowTitle( "Harbour-QT Preview Dialog" ) - Qt_Connect_Signal( qDlg:pPtr, "paintRequested(QPrinter)", {|o,p| ::paintRequested( p,o ) } ) + Qt_Connect_Signal( qDlg, "paintRequested(QPrinter)", {|o,p| ::paintRequested( p,o ) } ) qDlg:exec() Qt_DisConnect_Signal( qDlg:pPtr, "paintRequested(QPrinter)" ) @@ -1557,16 +1557,16 @@ METHOD HbIde:findReplace( cUi ) // ::qFindDlg:setWindowFlags( Qt_Sheet ) // - ::oFind := XbpComboBox():new():hbCreateFromQtPtr( , , , , , , Qt_findChild( QT_PTROF( ::qFindDlg ), "comboFindWhat" ) ) - ::oRepl := XbpComboBox():new():hbCreateFromQtPtr( , , , , , , Qt_findChild( QT_PTROF( ::qFindDlg ), "comboReplaceWith" ) ) + ::oFind := XbpComboBox():new():hbCreateFromQtPtr( , , , , , , Qt_findChild( ::qFindDlg, "comboFindWhat" ) ) + ::oRepl := XbpComboBox():new():hbCreateFromQtPtr( , , , , , , Qt_findChild( ::qFindDlg, "comboReplaceWith" ) ) - ::oPBFind := XbpPushButton():new():hbCreateFromQtPtr( , , , , , , Qt_findChild( QT_PTROF( ::qFindDlg ), "buttonFind" ) ) + ::oPBFind := XbpPushButton():new():hbCreateFromQtPtr( , , , , , , Qt_findChild( ::qFindDlg, "buttonFind" ) ) ::oPBFind:activate := {|| ::qCurEdit:find( QLineEdit():configure( ::oFind:oWidget:lineEdit() ):text() ) } - ::oPBRepl := XbpPushButton():new():hbCreateFromQtPtr( , , , , , , Qt_findChild( QT_PTROF( ::qFindDlg ), "buttonReplace" ) ) + ::oPBRepl := XbpPushButton():new():hbCreateFromQtPtr( , , , , , , Qt_findChild( ::qFindDlg, "buttonReplace" ) ) ::oPBRepl:activate := {|t| t := QLineEdit():configure( ::oRepl:oWidget:lineEdit() ):text() } - ::oPBClose := XbpPushButton():new():hbCreateFromQtPtr( , , , , , , Qt_findChild( QT_PTROF( ::qFindDlg ), "buttonClose" ) ) + ::oPBClose := XbpPushButton():new():hbCreateFromQtPtr( , , , , , , Qt_findChild( ::qFindDlg, "buttonClose" ) ) ::oPBClose:activate := {|| ::qFindDlg:hide() } ENDIF ENDIF @@ -1638,45 +1638,44 @@ METHOD HbIde:loadProjectProperties( cProject, lNew, lFetch ) /*----------------------------------------------------------------------*/ METHOD HbIde:fetchProjectProperties() - LOCAL qPrpDlg, qPrjType, oPrjTtl, oPBOk, oPBCn, pPrpDlg, oTabWidget, oPBSv, oPBSelect + LOCAL qPrpDlg, qPrjType, oPrjTtl, oPBOk, oPBCn, oTabWidget, oPBSv, oPBSelect LOCAL oPrjLoc, oPrjWrk, oPrjDst, oPrjOut, oPrjInc, oPrjLau, oPrjLEx, oPrjSrc, oPrjMta, oPrjHbp, oPrjCmp LOCAL cPrjLoc := hb_dirBase() + "projects" LOCAL aPrjProps := ::aPrjProps IF !empty( qPrpDlg := ::loadUI( "projectproperties" ) ) - pPrpDlg := QT_PTROF( qPrpDlg ) - qPrjType := QComboBox():configure( Qt_findChild( pPrpDlg, "comboPrjType" ) ) + qPrjType := QComboBox():configure( Qt_findChild( qPrpDlg, "comboPrjType" ) ) qPrjType:addItem( "Executable" ) qPrjType:addItem( "Library" ) qPrjType:addItem( "Dll" ) - oPrjTtl := QLineEdit():configure( Qt_FindChild( pPrpDlg, "editPrjTitle" ) ) - oPrjLoc := QLineEdit():configure( Qt_FindChild( pPrpDlg, "editPrjLoctn" ) ) - oPrjWrk := QLineEdit():configure( Qt_FindChild( pPrpDlg, "editWrkFolder" ) ) - oPrjDst := QLineEdit():configure( Qt_FindChild( pPrpDlg, "editDstFolder" ) ) - oPrjOut := QLineEdit():configure( Qt_FindChild( pPrpDlg, "editOutName" ) ) - oPrjInc := QTextEdit():configure( Qt_FindChild( pPrpDlg, "editFlags" ) ) - oPrjLau := QLineEdit():configure( Qt_FindChild( pPrpDlg, "editLaunchParams" ) ) - oPrjLEx := QLineEdit():configure( Qt_FindChild( pPrpDlg, "editLaunchExe" ) ) - oPrjSrc := QTextEdit():configure( Qt_FindChild( pPrpDlg, "editSources" ) ) - oPrjMta := QTextEdit():configure( Qt_FindChild( pPrpDlg, "editMetaData" ) ) - oPrjHbp := QTextEdit():configure( Qt_FindChild( pPrpDlg, "editHbp" ) ) - oPrjCmp := QTextEdit():configure( Qt_FindChild( pPrpDlg, "editCompilers" ) ) + oPrjTtl := QLineEdit():configure( Qt_FindChild( qPrpDlg, "editPrjTitle" ) ) + oPrjLoc := QLineEdit():configure( Qt_FindChild( qPrpDlg, "editPrjLoctn" ) ) + oPrjWrk := QLineEdit():configure( Qt_FindChild( qPrpDlg, "editWrkFolder" ) ) + oPrjDst := QLineEdit():configure( Qt_FindChild( qPrpDlg, "editDstFolder" ) ) + oPrjOut := QLineEdit():configure( Qt_FindChild( qPrpDlg, "editOutName" ) ) + oPrjInc := QTextEdit():configure( Qt_FindChild( qPrpDlg, "editFlags" ) ) + oPrjLau := QLineEdit():configure( Qt_FindChild( qPrpDlg, "editLaunchParams" ) ) + oPrjLEx := QLineEdit():configure( Qt_FindChild( qPrpDlg, "editLaunchExe" ) ) + oPrjSrc := QTextEdit():configure( Qt_FindChild( qPrpDlg, "editSources" ) ) + oPrjMta := QTextEdit():configure( Qt_FindChild( qPrpDlg, "editMetaData" ) ) + oPrjHbp := QTextEdit():configure( Qt_FindChild( qPrpDlg, "editHbp" ) ) + oPrjCmp := QTextEdit():configure( Qt_FindChild( qPrpDlg, "editCompilers" ) ) ::aPrpObjs := { qPrjType, oPrjTtl, oPrjLoc, oPrjWrk, oPrjDst, oPrjOut, oPrjLau, oPrjLEx, oPrjInc, oPrjSrc, oPrjMta, oPrjHbp, oPrjCmp } - oPBCn := XbpPushButton():new():hbCreateFromQtPtr( , , , , , , Qt_findChild( pPrpDlg, "buttonCn" ) ) + oPBCn := XbpPushButton():new():hbCreateFromQtPtr( , , , , , , Qt_findChild( qPrpDlg, "buttonCn" ) ) oPBCn:activate := {|| qPrpDlg:close() } - oPBSv := XbpPushButton():new():hbCreateFromQtPtr( , , , , , , Qt_findChild( pPrpDlg, "buttonSave" ) ) + oPBSv := XbpPushButton():new():hbCreateFromQtPtr( , , , , , , Qt_findChild( qPrpDlg, "buttonSave" ) ) oPBSv:activate := {|| ::saveProject() } - oPBOk := XbpPushButton():new():hbCreateFromQtPtr( , , , , , , Qt_findChild( pPrpDlg, "buttonSaveExit" ) ) + oPBOk := XbpPushButton():new():hbCreateFromQtPtr( , , , , , , Qt_findChild( qPrpDlg, "buttonSaveExit" ) ) oPBOk:activate := {|| ::saveProject(), qPrpDlg:close() } - oPBSelect := XbpPushButton():new():hbCreateFromQtPtr( , , , , , , Qt_findChild( pPrpDlg, "buttonSelect" ) ) + oPBSelect := XbpPushButton():new():hbCreateFromQtPtr( , , , , , , Qt_findChild( qPrpDlg, "buttonSelect" ) ) oPBSelect:activate := {|| ::addSourcesToProject() } - oTabWidget := QTabWidget():configure( Qt_FindChild( pPrpDlg, "tabWidget" ) ) - Qt_Connect_Signal( QT_PTROF( oTabWidget ), "currentChanged(int)", {|o,p| ::updateHbp( p, o ) } ) + oTabWidget := QTabWidget():configure( Qt_FindChild( qPrpDlg, "tabWidget" ) ) + Qt_Connect_Signal( oTabWidget, "currentChanged(int)", {|o,p| ::updateHbp( p, o ) } ) IF empty( aPrjProps ) oPrjTtl:setText( "untitled" ) @@ -1701,7 +1700,7 @@ METHOD HbIde:fetchProjectProperties() qPrpDlg:exec() - Qt_DisConnect_Signal( QT_PTROF( oTabWidget ), "currentChanged(int)" ) + Qt_DisConnect_Signal( oTabWidget, "currentChanged(int)" ) oPBOk:destroy() oPBSv:destroy() @@ -1895,9 +1894,9 @@ METHOD HbIde:buildProjectViaQt( cProject ) ::qProcess:setReadChannelMode( 0 ) ::qProcess:setReadChannel( 0 ) - Qt_Connect_Signal( QT_PTROF( ::qProcess ), "readyReadStandardOutput()", {|o,i| ::readProcessInfo( 2, i, o ) } ) - Qt_Connect_Signal( QT_PTROF( ::qProcess ), "readyReadStandardError()" , {|o,i| ::readProcessInfo( 3, i, o ) } ) - Qt_Connect_Signal( QT_PTROF( ::qProcess ), "finished(int,int)" , {|o,i| ::readProcessInfo( 4, i, o ) } ) + Qt_Connect_Signal( ::qProcess, "readyReadStandardOutput()", {|o,i| ::readProcessInfo( 2, i, o ) } ) + Qt_Connect_Signal( ::qProcess, "readyReadStandardError()" , {|o,i| ::readProcessInfo( 3, i, o ) } ) + Qt_Connect_Signal( ::qProcess, "finished(int,int)" , {|o,i| ::readProcessInfo( 4, i, o ) } ) ::qProcess:start( "hbmk2.exe", qStringList ) @@ -1932,9 +1931,9 @@ METHOD HbIde:readProcessInfo( nMode, iBytes ) ENDIF CASE nMode == 4 - Qt_DisConnect_Signal( QT_PTROF( ::qProcess ), "finished(int,int)" ) - Qt_DisConnect_Signal( QT_PTROF( ::qProcess ), "readyReadStandardOutput()" ) - Qt_DisConnect_Signal( QT_PTROF( ::qProcess ), "readyReadStandardError()" ) + Qt_DisConnect_Signal( ::qProcess, "finished(int,int)" ) + Qt_DisConnect_Signal( ::qProcess, "readyReadStandardOutput()" ) + Qt_DisConnect_Signal( ::qProcess, "readyReadStandardError()" ) ::qProcess:kill() ::qProcess:pPtr := 0 diff --git a/harbour/contrib/hbqt/hbqt.h b/harbour/contrib/hbqt/hbqt.h index 8d9f009098..ea1b488b5d 100644 --- a/harbour/contrib/hbqt/hbqt.h +++ b/harbour/contrib/hbqt/hbqt.h @@ -83,6 +83,8 @@ extern const HB_GC_FUNCS * hbqt_gcFuncs( void ); extern int hbqt_getmemused( void ); +void * hbqt_pPtrFromObj( int iParam ); + #include "hbqt_garbage.h" #define hbqt_par_ExtensionOption( n ) ( ( ExtensionOption * ) hbqt_gcpointer( n ) ) diff --git a/harbour/contrib/hbqt/hbqt_base.cpp b/harbour/contrib/hbqt/hbqt_base.cpp index 43805efec3..f816dccd2c 100644 --- a/harbour/contrib/hbqt/hbqt_base.cpp +++ b/harbour/contrib/hbqt/hbqt_base.cpp @@ -74,7 +74,8 @@ HB_FUNC( QT_VERSION_STR ) HB_FUNC( QT_FINDCHILD ) { - hb_retptr( ( QObject * ) hbqt_par_QObject( 1 )->findChild< QObject * >( hbqt_par_QString( 2 ) ) ); + QObject * object = ( QObject * ) hbqt_pPtrFromObj( 1 ); + hb_retptr( object->findChild< QObject * >( hbqt_par_QString( 2 ) ) ); } HB_FUNC( HBQT_ISEQUALGCQTPOINTER ) diff --git a/harbour/contrib/hbqt/hbqt_destruct.cpp b/harbour/contrib/hbqt/hbqt_destruct.cpp index 82c114a5ad..f65bd47c11 100644 --- a/harbour/contrib/hbqt/hbqt_destruct.cpp +++ b/harbour/contrib/hbqt/hbqt_destruct.cpp @@ -52,6 +52,9 @@ /*----------------------------------------------------------------------*/ #include "hbapi.h" +#include "hbapiitm.h" +#include "hbstack.h" +#include "hbvm.h" #include "hbqt.h" @@ -90,6 +93,28 @@ void * hbqt_gcpointer( int iParam ) return hb_parptr( iParam ); /* TOFIX: This is dangerous. */ } +void * hbqt_pPtrFromObj( int iParam ) +{ + PHB_ITEM pObj = hb_param( iParam, HB_IT_ANY ); + + if( hb_itemType( pObj ) == HB_IT_OBJECT ) + { + hb_vmPushSymbol( hb_dynsymSymbol( hb_dynsymFindName( "PPTR" ) ) ); + hb_vmPush( pObj ); + hb_vmSend( 0 ); + + return( hbqt_gcpointer( -1 ) ); + } + else if( hb_itemType( pObj ) == HB_IT_POINTER ) + { + return( hbqt_gcpointer( iParam ) ); + } + else + { + return( NULL ); + } +} + int hbqt_get_object_release_method() { return s_iObjectReleaseMethod; diff --git a/harbour/contrib/hbqt/hbqt_events.cpp b/harbour/contrib/hbqt/hbqt_events.cpp index ec689f78d6..a6c1fd48c5 100644 --- a/harbour/contrib/hbqt/hbqt_events.cpp +++ b/harbour/contrib/hbqt/hbqt_events.cpp @@ -155,7 +155,7 @@ bool Events::eventFilter( QObject * object, QEvent * event ) HB_FUNC( QT_CONNECT_EVENT ) { - QObject * object = ( QObject* ) hbqt_gcpointer( 1 ); /* get sender */ + QObject * object = ( QObject* ) hbqt_pPtrFromObj( 1 ); /* get sender */ if( object ) { @@ -181,7 +181,7 @@ HB_FUNC( QT_CONNECT_EVENT ) HB_FUNC( QT_DISCONNECT_EVENT ) { HB_BOOL bRet = HB_FALSE; - QObject * object = ( QObject* ) hbqt_gcpointer( 1 ); + QObject * object = ( QObject* ) hbqt_pPtrFromObj( 1 ); if( object ) { diff --git a/harbour/contrib/hbqt/hbqt_slots.cpp b/harbour/contrib/hbqt/hbqt_slots.cpp index 16890f7a17..9071760891 100644 --- a/harbour/contrib/hbqt/hbqt_slots.cpp +++ b/harbour/contrib/hbqt/hbqt_slots.cpp @@ -498,7 +498,7 @@ void Slots::stateChanged( QProcess::ProcessState newState ) */ HB_FUNC( QT_CONNECT_SIGNAL ) { - QObject * object = ( QObject * ) hbqt_gcpointer( 1 ); /* get sender */ + QObject * object = ( QObject * ) hbqt_pPtrFromObj( 1 ); /* get sender */ if( object == NULL ) { @@ -744,7 +744,7 @@ static bool disconnect_signal( QObject * object, const char * signal ) */ HB_FUNC( QT_DISCONNECT_SIGNAL ) { - QObject * object = ( QObject* ) hbqt_gcpointer( 1 ); + QObject * object = ( QObject* ) hbqt_pPtrFromObj( 1 ); bool bFreed = false; if( object ) diff --git a/harbour/contrib/hbqt/tests/demoqt.prg b/harbour/contrib/hbqt/tests/demoqt.prg index 701af9d53e..539d591cc6 100644 --- a/harbour/contrib/hbqt/tests/demoqt.prg +++ b/harbour/contrib/hbqt/tests/demoqt.prg @@ -162,7 +162,7 @@ HBQT_DEBUG( "-----------------b-----------------" ) oProg := Build_ProgressBar( oDA, { 30,300 }, { 200,30 } ) aList := Build_ListBox( oDA, { 310,240 }, { 150, 100 } ) - QT_CONNECT_EVENT( QT_PTROF( oWnd ), 6, {|o,e| My_Events( o, e ) } ) + QT_CONNECT_EVENT( oWnd, 6, {|o,e| My_Events( o, e ) } ) oWnd:Show() @@ -298,7 +298,7 @@ STATIC FUNCTION Build_ToolBar( oWnd ) oActNew:setIcon( "new.png" ) oActNew:setToolTip( "A New File" ) /* Attach codeblock to be triggered */ - Qt_Connect_Signal( QT_PTROF( oActNew ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "New" , w, l ) } ) + Qt_Connect_Signal( oActNew, QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "New" , w, l ) } ) /* Attach Action with Toolbar */ oTB:addAction( oActNew ) @@ -308,7 +308,7 @@ STATIC FUNCTION Build_ToolBar( oWnd ) oActOpen:setIcon( "open.png" ) oActOpen:setToolTip( "Select a file to be opened!" ) /* Attach codeblock to be triggered */ - Qt_Connect_Signal( QT_PTROF( oActOpen ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Open" , w, l ) } ) + Qt_Connect_Signal( oActOpen, QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Open" , w, l ) } ) /* Attach Action with Toolbar */ oTB:addAction( oActOpen ) @@ -320,7 +320,7 @@ STATIC FUNCTION Build_ToolBar( oWnd ) oActSave:setIcon( "save.png" ) oActSave:setToolTip( "Save this file!" ) /* Attach codeblock to be triggered */ - Qt_Connect_Signal( QT_PTROF( oActSave ), QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Save" , w, l ) } ) + Qt_Connect_Signal( oActSave, QT_EVE_TRIGGERED_B, {|w,l| FileDialog( "Save" , w, l ) } ) /* Attach Action with Toolbar */ oTB:addAction( oActSave ) @@ -335,13 +335,13 @@ STATIC FUNCTION Build_ToolBar( oWnd ) oAct := QAction():new( oWnd ) oAct:setText( "&Colors" ) oAct:setToolTip( "Colors Dialog" ) - Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Colors", w, l ) } ) + Qt_Connect_Signal( 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_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Fonts", w, l ) } ) + Qt_Connect_Signal( oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Fonts", w, l ) } ) oTB:addAction( oAct ) oTB:addSeparator() @@ -349,13 +349,13 @@ STATIC FUNCTION Build_ToolBar( oWnd ) oAct := QAction():new( oWnd ) oAct:setText( "&PgSetup" ) oAct:setToolTip( "Page Setup Dialog" ) - Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "PageSetup", w, l ) } ) + Qt_Connect_Signal( 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_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Preview", w, l ) } ) + Qt_Connect_Signal( oAct, QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Preview", w, l ) } ) oTB:addAction( oAct ) oTB:addSeparator() @@ -363,19 +363,19 @@ STATIC FUNCTION Build_ToolBar( oWnd ) oAct := QAction():new( oWnd ) oAct:setText( "&Webpage" ) oAct:setToolTip( "Web Browser Dialog" ) - Qt_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "WebPage", w, l ) } ) + Qt_Connect_Signal( 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_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| Dialogs( "Wizard", w, l ) } ) + Qt_Connect_Signal( 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_Connect_Signal( QT_PTROF( oAct ), QT_EVE_TRIGGERED_B, {|w,l| ShowInSystemTray( oWnd, w, l ) } ) + Qt_Connect_Signal( oAct, QT_EVE_TRIGGERED_B, {|w,l| ShowInSystemTray( oWnd, w, l ) } ) oTB:addAction( oAct ) /* Add this toolbar with main window */ @@ -397,9 +397,9 @@ STATIC FUNCTION Build_PushButton( oWnd, aPos, aSize, cLabel, cMsg, lExit ) oBtn:resize( aSize[ 1 ],aSize[ 2 ] ) oBtn:show() IF hb_isLogical( lExit ) - Qt_Connect_Signal( QT_PTROF( oBtn ), QT_EVE_CLICKED, {|| lExit := .t. } ) + Qt_Connect_Signal( oBtn, QT_EVE_CLICKED, {|| lExit := .t. } ) ELSE - Qt_Connect_Signal( QT_PTROF( oBtn ), QT_EVE_CLICKED, {|| MsgInfo( cMsg ), lExit := .t. } ) + Qt_Connect_Signal( oBtn, QT_EVE_CLICKED, {|| MsgInfo( cMsg ), lExit := .t. } ) ENDIF RETURN oBtn @@ -528,7 +528,7 @@ STATIC FUNCTION Build_Controls( oWnd ) LOCAL oEdit, oCheckBox, oComboBox, oSpinBox, oRadioButton oEdit := QLineEdit():new( oWnd ) - Qt_Connect_Signal( QT_PTROF( oEdit ), QT_EVE_RETURNPRESSED, {|o,i| o := o, i := i, MsgInfo( oEdit:text() ) } ) + Qt_Connect_Signal( oEdit, QT_EVE_RETURNPRESSED, {|o,i| o := o, i := i, MsgInfo( oEdit:text() ) } ) oEdit:move( 5, 10 ) oEdit:resize( 345, 30 ) oEdit:setMaxLength( 40 ) @@ -541,13 +541,13 @@ STATIC FUNCTION Build_Controls( oWnd ) oComboBox:addItem( "Second" ) oComboBox:addItem( "Third" ) //Qt_Connect_Signal( QT_PTROF( oComboBox ), QT_EVE_HIGHLIGHTED_I , {|o,i| HBQT_DEBUG( oComboBox:itemText( i ) ) } ) - Qt_Connect_Signal( QT_PTROF( oComboBox ), QT_EVE_CURRENTINDEXCHANGED_I, {|o,i| o := o, i := i, MsgInfo( oComboBox:itemText( i ) ) } ) + Qt_Connect_Signal( oComboBox, QT_EVE_CURRENTINDEXCHANGED_I, {|o,i| o := o, i := i, MsgInfo( oComboBox:itemText( i ) ) } ) oComboBox:move( 5, 60 ) oComboBox:resize( 345, 30 ) oComboBox:show() oCheckBox := QCheckBox():New( oWnd ) - Qt_Connect_Signal( QT_PTROF( oCheckBox ), QT_EVE_STATECHANGED_I, {|o,i| o := o, i := i, MsgInfo( IF( i == 0,"Uncheckd","Checked" ) ) } ) + Qt_Connect_Signal( oCheckBox, QT_EVE_STATECHANGED_I, {|o,i| o := o, i := i, MsgInfo( IF( i == 0,"Uncheckd","Checked" ) ) } ) oCheckBox:setText( "Testing CheckBox HbQt" ) oCheckBox:move( 5, 110 ) oCheckBox:resize( 345, 30 ) @@ -559,7 +559,7 @@ STATIC FUNCTION Build_Controls( oWnd ) oSpinBox:Show() oRadioButton := QRadioButton():New( oWnd ) - Qt_Connect_Signal( QT_PTROF( oRadioButton ), QT_EVE_CLICKED, {|o,i| o := o, i := i, MsgInfo( "Checked" ) } ) + Qt_Connect_Signal( oRadioButton, QT_EVE_CLICKED, {|o,i| o := o, i := i, MsgInfo( "Checked" ) } ) oRadioButton:Move( 5, 210 ) oRadioButton:ReSize( 345, 30 ) oRadioButton:Show() diff --git a/harbour/contrib/hbxbp/xbpbrowse.prg b/harbour/contrib/hbxbp/xbpbrowse.prg index 0634e6c70f..6185428729 100644 --- a/harbour/contrib/hbxbp/xbpbrowse.prg +++ b/harbour/contrib/hbxbp/xbpbrowse.prg @@ -514,9 +514,9 @@ METHOD XbpBrowse:buildLeftFreeze() // //::oLeftFooterView:hide() - ::connect( ::oLeftView , "mousePressEvent()" , {|o,p| ::exeBlock( 31, p, o ) } ) - ::connect( ::oLeftHeaderView, "sectionPressed(int)", {|o,i| ::exeBlock( 31, i, o ) } ) - ::connect( ::oLeftFooterView, "sectionPressed(int)", {|o,i| ::exeBlock( 31, i, o ) } ) + ::connect( QT_PTROF( ::oLeftView ) , "mousePressEvent()" , {|o,p| ::exeBlock( 31, p, o ) } ) + ::connect( QT_PTROF( ::oLeftHeaderView ), "sectionPressed(int)", {|o,i| ::exeBlock( 31, i, o ) } ) + ::connect( QT_PTROF( ::oLeftFooterView ), "sectionPressed(int)", {|o,i| ::exeBlock( 31, i, o ) } ) RETURN Self @@ -560,9 +560,9 @@ METHOD XbpBrowse:buildRightFreeze() ::oRightFooterModel := HBDbfModel():new( {|p1,p2,p3,p4| ::supplyInfo( 162, p1, p2, p3, p4 ) } ) ::oRightFooterView:setModel( ::oRightFooterModel ) - ::connect( ::oRightView , "mousePressEvent()" , {|o,p| ::exeBlock( 31, p, o ) } ) - ::connect( ::oRightHeaderView, "sectionPressed(int)", {|o,i| ::exeBlock( 31, i, o ) } ) - ::connect( ::oRightFooterView, "sectionPressed(int)", {|o,i| ::exeBlock( 31, i, o ) } ) + ::connect( QT_PTROF( ::oRightView ) , "mousePressEvent()" , {|o,p| ::exeBlock( 31, p, o ) } ) + ::connect( QT_PTROF( ::oRightHeaderView ), "sectionPressed(int)", {|o,i| ::exeBlock( 31, i, o ) } ) + ::connect( QT_PTROF( ::oRightFooterView ), "sectionPressed(int)", {|o,i| ::exeBlock( 31, i, o ) } ) RETURN Self @@ -589,27 +589,27 @@ METHOD XbpBrowse:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::oTableView:setSelectionBehavior( IF( ::cursorMode == XBPBRW_CURSOR_ROW, QAbstractItemView_SelectRows, QAbstractItemView_SelectItems ) ) /* Connect Keyboard Events */ - ::connect( ::oTableView, "keyPressEvent()" , {|o,p | ::exeBlock( 1, p, o ) } ) - ::connect( ::oTableView, "mousePressEvent()" , {|o,p | ::exeBlock( 2, p, o ) } ) - ::connect( ::oTableView, "mouseDoubleClickEvent()" , {|o,p | ::exeBlock( 3, p, o ) } ) - ::connect( ::oTableView, "wheelEvent()" , {|o,p | ::exeBlock( 4, p, o ) } ) - ::connect( ::oTableView, "scrollContentsBy(int,int)" , {|o,p,p1| ::exeBlock(11, p, p1, o ) } ) + ::connect( QT_PTROF( ::oTableView ), "keyPressEvent()" , {|o,p | ::exeBlock( 1, p, o ) } ) + ::connect( QT_PTROF( ::oTableView ), "mousePressEvent()" , {|o,p | ::exeBlock( 2, p, o ) } ) + ::connect( QT_PTROF( ::oTableView ), "mouseDoubleClickEvent()" , {|o,p | ::exeBlock( 3, p, o ) } ) + ::connect( QT_PTROF( ::oTableView ), "wheelEvent()" , {|o,p | ::exeBlock( 4, p, o ) } ) + ::connect( QT_PTROF( ::oTableView ), "scrollContentsBy(int,int)" , {|o,p,p1| ::exeBlock(11, p, p1, o ) } ) /* Finetune Horizontal Scrollbar */ ::oTableView:setHorizontalScrollBarPolicy( Qt_ScrollBarAlwaysOff ) // ::oHScrollBar := QScrollBar():new() ::oHScrollBar:setOrientation( Qt_Horizontal ) - ::connect( ::oHScrollBar, "actionTriggered(int)" , {|o,i| ::exeBlock( 103, i, o ) } ) - ::connect( ::oHScrollBar, "sliderReleased()" , {|o,i| ::exeBlock( 104, i, o ) } ) + ::connect( QT_PTROF( ::oHScrollBar ), "actionTriggered(int)" , {|o,i| ::exeBlock( 103, i, o ) } ) + ::connect( QT_PTROF( ::oHScrollBar ), "sliderReleased()" , {|o,i| ::exeBlock( 104, i, o ) } ) /* Replace Vertical Scrollbar with our own */ ::oTableView:setVerticalScrollBarPolicy( Qt_ScrollBarAlwaysOff ) // ::oVScrollBar := QScrollBar():new() ::oVScrollBar:setOrientation( Qt_Vertical ) - ::connect( ::oVScrollBar, "actionTriggered(int)" , {|o,i| ::exeBlock( 101, i, o ) } ) - ::connect( ::oVScrollBar, "sliderReleased()" , {|o,i| ::exeBlock( 102, i, o ) } ) + ::connect( QT_PTROF( ::oVScrollBar ), "actionTriggered(int)" , {|o,i| ::exeBlock( 101, i, o ) } ) + ::connect( QT_PTROF( ::oVScrollBar ), "sliderReleased()" , {|o,i| ::exeBlock( 102, i, o ) } ) /* Veritical Header because of Performance boost */ ::oVHeaderView := QHeaderView() @@ -621,8 +621,8 @@ METHOD XbpBrowse:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::oHeaderView:configure( ::oTableView:horizontalHeader() ) ::oHeaderView:setHighlightSections( .F. ) // - ::connect( ::oHeaderView, "sectionPressed(int)" , {|o,i | ::exeBlock( 111, i, o ) } ) - ::connect( ::oHeaderView, "sectionResized(int,int,int)", {|o,i,i1,i2| ::exeBlock( 121, i, i1, i2, o ) } ) + ::connect( QT_PTROF( ::oHeaderView ), "sectionPressed(int)" , {|o,i | ::exeBlock( 111, i, o ) } ) + ::connect( QT_PTROF( ::oHeaderView ), "sectionResized(int,int,int)", {|o,i,i1,i2| ::exeBlock( 121, i, i1, i2, o ) } ) /* .DBF Manipulation Model */ ::oDbfModel := HBDbfModel():new( {|p1,p2,p3,p4| ::supplyInfo( 141, p1, p2, p3, p4 ) } ) diff --git a/harbour/contrib/hbxbp/xbphtmlviewer.prg b/harbour/contrib/hbxbp/xbphtmlviewer.prg index 2aba12d0b3..19abc504bb 100644 --- a/harbour/contrib/hbxbp/xbphtmlviewer.prg +++ b/harbour/contrib/hbxbp/xbphtmlviewer.prg @@ -246,7 +246,7 @@ METHOD XbpHTMLViewer:navigate( cURL ) ::oURL:setURL( cURL ) - ::oWidget:setURL( QT_PTROF( ::oURL ) ) + ::oWidget:setURL( ::oURL ) RETURN .t. diff --git a/harbour/contrib/hbxbp/xbpmenubar.prg b/harbour/contrib/hbxbp/xbpmenubar.prg index bbc9f87399..26e0a2e1a4 100644 --- a/harbour/contrib/hbxbp/xbpmenubar.prg +++ b/harbour/contrib/hbxbp/xbpmenubar.prg @@ -280,8 +280,8 @@ METHOD xbpMenuBar:delItem( nItemIndex ) //::aMenuItems[ nItemIndex, 4 ]:destroy() ELSE oAction := ::aMenuItems[ nItemIndex, 5 ] - QT_DISCONNECT_SIGNAL( QT_PTROF( oAction ), "triggered(bool)" ) - QT_DISCONNECT_SIGNAL( QT_PTROF( oAction ), "hovered()" ) + QT_DISCONNECT_SIGNAL( oAction:pPtr, "triggered(bool)" ) + QT_DISCONNECT_SIGNAL( oAction:pPtr, "hovered()" ) oAction:pPtr := 0 ENDIF ADEL( ::aMenuItems, nItemIndex ) @@ -336,8 +336,8 @@ METHOD xbpMenuBar:placeItem( xCaption, bAction, nStyle, nAttrb, nMode, nPos ) oAction:setShortcut( oKey ) ENDIF - ::Connect( oAction, "triggered(bool)", {|| ::exeBlock( nMenuItemID ) } ) - ::Connect( oAction, "hovered()" , {|| ::exeHovered( nMenuItemID ) } ) + ::Connect( oAction:pPtr, "triggered(bool)", {|| ::exeBlock( nMenuItemID ) } ) + ::Connect( oAction:pPtr, "hovered()" , {|| ::exeHovered( nMenuItemID ) } ) DO CASE CASE nAttrb == XBPMENUBAR_MIA_CHECKED diff --git a/harbour/contrib/hbxbp/xbpprinter.prg b/harbour/contrib/hbxbp/xbpprinter.prg index 14674f2c94..2a5c95cc5b 100644 --- a/harbour/contrib/hbxbp/xbpprinter.prg +++ b/harbour/contrib/hbxbp/xbpprinter.prg @@ -77,7 +77,7 @@ CLASS XbpPrinter DATA oWidget - ACCESS pWidget INLINE IF( empty( ::oWidget ), NIL, QT_PTROF( ::oWidget ) ) + ACCESS pWidget INLINE IF( empty( ::oWidget ), NIL, ::oWidget:pPtr ) DATA comment READONLY DATA devName READONLY diff --git a/harbour/contrib/hbxbp/xbppushbutton.prg b/harbour/contrib/hbxbp/xbppushbutton.prg index d1eaae5428..03220542fa 100644 --- a/harbour/contrib/hbxbp/xbppushbutton.prg +++ b/harbour/contrib/hbxbp/xbppushbutton.prg @@ -129,7 +129,7 @@ METHOD XbpPushButton:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ::oWidget:setDefault( .t. ) ENDIF - ::Connect( ::oWidget, "clicked()", {|| ::exeBlock() } ) + ::Connect( ::pWidget, "clicked()", {|| ::exeBlock() } ) ::oParent:AddChild( SELF ) RETURN Self @@ -159,7 +159,7 @@ METHOD XbpPushButton:hbCreateFromQtPtr( oParent, oOwner, aPos, aSize, aPresParam ENDIF - ::Connect( ::oWidget, "clicked()", {|| ::exeBlock() } ) + ::Connect( ::pWidget, "clicked()", {|| ::exeBlock() } ) ::addAsChild() RETURN Self diff --git a/harbour/contrib/hbxbp/xbptoolbar.prg b/harbour/contrib/hbxbp/xbptoolbar.prg index 1b6fa94813..59ce1d7801 100644 --- a/harbour/contrib/hbxbp/xbptoolbar.prg +++ b/harbour/contrib/hbxbp/xbptoolbar.prg @@ -269,7 +269,7 @@ METHOD XbpToolbar:addItem( cCaption, xImage, xDisabledImage, xHotImage, cDLL, nS ENDIF /* Attach codeblock to be triggered */ - ::Connect( oBtn:oAction, "triggered(bool)", {|| ::exeBlock( oBtn ) } ) + ::Connect( oBtn:oAction:pPtr, "triggered(bool)", {|| ::exeBlock( oBtn ) } ) /* Attach Action with Toolbar */ ::oWidget:addAction( oBtn:oAction ) diff --git a/harbour/contrib/hbxbp/xbpwindow.prg b/harbour/contrib/hbxbp/xbpwindow.prg index 4ac4ac26b2..d63a68e103 100644 --- a/harbour/contrib/hbxbp/xbpwindow.prg +++ b/harbour/contrib/hbxbp/xbpwindow.prg @@ -393,8 +393,8 @@ METHOD XbpWindow:setQtProperty( cProperty ) METHOD XbpWindow:connect( pWidget, cSignal, bBlock ) LOCAL lSuccess - IF ( lSuccess := Qt_Connect_Signal( hbqt_ptr( pWidget ), cSignal, bBlock ) ) - aadd( ::aConnections, { hbqt_ptr( pWidget ), cSignal } ) + IF ( lSuccess := Qt_Connect_Signal( pWidget, cSignal, bBlock ) ) + aadd( ::aConnections, { pWidget, cSignal } ) ENDIF RETURN lSuccess @@ -405,6 +405,7 @@ METHOD XbpWindow:connectEvent( pWidget, nEvent, bBlock ) LOCAL lSuccess IF ( lSuccess := Qt_Connect_Event( hbqt_ptr( pWidget ), nEvent, bBlock ) ) +//hbxbp_debug( "Event Connected", nEvent ) aadd( ::aEConnections, { hbqt_ptr( pWidget ), nEvent } ) ENDIF @@ -733,10 +734,11 @@ METHOD XbpWindow:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible /*----------------------------------------------------------------------*/ METHOD XbpWindow:destroy() + LOCAL e_, lSuccess LOCAL cXbp := __ObjGetClsName( self ) -HBXBP_DEBUG( ". " ) -HBXBP_DEBUG( hb_threadId(),"Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty(::cargo),'',str(::cargo) ), memory( 1001 ), hbqt_getMemUsed() ) +//HBXBP_DEBUG( ". " ) +//HBXBP_DEBUG( hb_threadId(),"Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty(::cargo),'',str(::cargo) ), memory( 1001 ), hbqt_getMemUsed() ) IF cXbp == "XBPDIALOG" hbxbp_SetEventLoop( NIL ) @@ -749,8 +751,10 @@ HBXBP_DEBUG( hb_threadId(),"Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty ::disconnect() IF len( ::aEConnections ) > 0 - aeval( ::aEConnections, {|e_,i| Qt_DisConnect_Event( e_[ 1 ], e_[ 2 ] ), ; - ::aEConnections[ i,1 ] := NIL, ::aEConnections[ i,2 ] := NIL, ::aEConnections[ i ] := NIL } ) + FOR EACH e_ IN ::aEConnections + lSuccess := Qt_DisConnect_Event( e_[ 1 ], e_[ 2 ] ) + hbxbp_debug( "Event Disconnect:", iif( lSuccess, "SUCCEEDED", "FAILED " ), e_[ 1 ], e_[ 2 ] ) + NEXT ::aEConnections := {} ::oWidget:removeEventFilter( QT_GetEventFilter() ) ENDIF @@ -772,12 +776,27 @@ HBXBP_DEBUG( hb_threadId(),"Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty ::oWidget:pPtr := 0 ::oWidget := NIL -HBXBP_DEBUG( hb_threadId()," Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty(::cargo),'',str(::cargo) ), memory( 1001 ), hbqt_getMemUsed() ) +//HBXBP_DEBUG( hb_threadId()," Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty(::cargo),'',str(::cargo) ), memory( 1001 ), hbqt_getMemUsed() ) RETURN NIL /*----------------------------------------------------------------------*/ +METHOD XbpWindow:disconnect() + LOCAL lSuccess, e_ + + IF len( ::aConnections ) > 0 + FOR EACH e_ IN ::aConnections + lSuccess := Qt_DisConnect_Signal( e_[ 1 ], e_[ 2 ] ) + hbxbp_debug( " Signal Disconnect:", iif( lSuccess, "SUCCEEDED", "FAILED " ), e_[ 1 ], e_[ 2 ] ) + NEXT + ::aConnections := {} + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD XbpWindow:clearSlots() LOCAL i @@ -828,17 +847,6 @@ METHOD XbpWindow:clearSlots() /*----------------------------------------------------------------------*/ -METHOD XbpWindow:disconnect() - - IF len( ::aConnections ) > 0 - aeval( ::aConnections, {|e_| Qt_DisConnect_Signal( e_[ 1 ], e_[ 2 ] ), e_[ 1 ] := NIL, e_[ 2 ] := NIL } ) - ::aConnections := {} - ENDIF - - RETURN Self - -/*----------------------------------------------------------------------*/ - METHOD XbpWindow:captureMouse( lCapture ) LOCAL lSuccess := .f. @@ -1318,7 +1326,7 @@ METHOD XbpWindow:currentSize() METHOD XbpWindow:getHWND() - RETURN QT_PTROF( ::oWidget ) + RETURN ::oWidget:pPtr /*----------------------------------------------------------------------*/