From 47ca2eac6c170c64fb23cf4f7f656ee96d4d6c06 Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Sun, 3 Jan 2010 17:32:43 +0000 Subject: [PATCH] 2010-01-03 09:22 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) * contrib/hbide/hbide.prg * contrib/hbide/idedocks.prg * contrib/hbide/ideeditor.prg % Qt_Connect_Signal( ... ) => Qt_Slots_Connect( ::pSlots, ... ) % Qt_Connect_Events( ... ) => Qt_Events_Connect( ::pEvents, ... ) And reverse of it. * contrib/hbxbp/xbpbrowse.prg * contrib/hbxbp/xbpdialog.prg * contrib/hbxbp/xbpgeneric.prg * contrib/hbxbp/xbplistbox.prg * contrib/hbxbp/xbpqtuiloader.prg * contrib/hbxbp/xbpsle.prg * contrib/hbxbp/xbpspinbutton.prg * contrib/hbxbp/xbptreeview.prg * contrib/hbxbp/xbpwindow.prg % Qt_Connect_Signal( ... ) => Qt_Slots_Connect( ::pSlots, ... ) % Qt_Connect_Events( ... ) => Qt_Events_Connect( ::pEvents, ... ) And reverse of it. Viktor, you may delete the previous implementation. --- harbour/ChangeLog | 23 ++ harbour/contrib/hbide/hbide.prg | 19 +- harbour/contrib/hbide/idedocks.prg | 7 +- harbour/contrib/hbide/ideeditor.prg | 29 +-- harbour/contrib/hbxbp/xbpbrowse.prg | 2 +- harbour/contrib/hbxbp/xbpdialog.prg | 2 +- harbour/contrib/hbxbp/xbpgeneric.prg | 21 ++ harbour/contrib/hbxbp/xbplistbox.prg | 2 +- harbour/contrib/hbxbp/xbpqtuiloader.prg | 8 +- harbour/contrib/hbxbp/xbpsle.prg | 2 +- harbour/contrib/hbxbp/xbpspinbutton.prg | 3 +- harbour/contrib/hbxbp/xbptreeview.prg | 2 +- harbour/contrib/hbxbp/xbpwindow.prg | 268 ++++++++++++------------ 13 files changed, 222 insertions(+), 166 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 4c24fa0461..11fef584f9 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,29 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-01-03 09:22 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + * contrib/hbide/hbide.prg + * contrib/hbide/idedocks.prg + * contrib/hbide/ideeditor.prg + % Qt_Connect_Signal( ... ) => Qt_Slots_Connect( ::pSlots, ... ) + % Qt_Connect_Events( ... ) => Qt_Events_Connect( ::pEvents, ... ) + And reverse of it. + + * contrib/hbxbp/xbpbrowse.prg + * contrib/hbxbp/xbpdialog.prg + * contrib/hbxbp/xbpgeneric.prg + * contrib/hbxbp/xbplistbox.prg + * contrib/hbxbp/xbpqtuiloader.prg + * contrib/hbxbp/xbpsle.prg + * contrib/hbxbp/xbpspinbutton.prg + * contrib/hbxbp/xbptreeview.prg + * contrib/hbxbp/xbpwindow.prg + % Qt_Connect_Signal( ... ) => Qt_Slots_Connect( ::pSlots, ... ) + % Qt_Connect_Events( ... ) => Qt_Events_Connect( ::pEvents, ... ) + And reverse of it. + + Viktor, you may delete the previous implementation. + 2010-01-03 14:07 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbqt/qth/QApplication.qth * Minor optimizations. diff --git a/harbour/contrib/hbide/hbide.prg b/harbour/contrib/hbide/hbide.prg index 9ded56b10c..86a3c2b86c 100644 --- a/harbour/contrib/hbide/hbide.prg +++ b/harbour/contrib/hbide/hbide.prg @@ -107,6 +107,9 @@ PROCEDURE Main( cProjIni ) CLASS HbIde + ACCESS pSlots INLINE hbxbp_getSlotsPtr() + ACCESS pEvents INLINE hbxbp_GetEventsPtr() + DATA mp1, mp2, oXbp, nEvent DATA aTabs INIT {} DATA cProjIni @@ -1396,9 +1399,9 @@ METHOD HbIde:printPreview() qDlg := QPrintPreviewDialog():new( ::oDlg:oWidget ) qDlg:setWindowTitle( "Harbour-QT Preview Dialog" ) - Qt_Connect_Signal( qDlg, "paintRequested(QPrinter)", {|o,p| ::paintRequested( p,o ) } ) + Qt_Slots_Connect( ::pSlots, qDlg, "paintRequested(QPrinter)", {|o,p| ::paintRequested( p,o ) } ) qDlg:exec() - Qt_DisConnect_Signal( qDlg, "paintRequested(QPrinter)" ) + Qt_Slots_disConnect( ::pSlots, qDlg, "paintRequested(QPrinter)" ) RETURN self @@ -1945,9 +1948,9 @@ METHOD HbIde:buildProject( cProject, lLaunch, lRebuild, lPPO, lViaQt ) //::qProcess:setStandardOutputFile( "c:\temp\out.out" ) //::qProcess:setStandardErrorFile( "c:\temp\err.out" ) - 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 ) } ) + Qt_Slots_Connect( ::pSlots, ::qProcess, "readyReadStandardOutput()", {|o,i| ::readProcessInfo( 2, i, o ) } ) + Qt_Slots_Connect( ::pSlots, ::qProcess, "readyReadStandardError()" , {|o,i| ::readProcessInfo( 3, i, o ) } ) + Qt_Slots_Connect( ::pSlots, ::qProcess, "finished(int,int)" , {|o,i| ::readProcessInfo( 4, i, o ) } ) ::oOutputResult:oWidget:clear() ::qProcess:start( "hbmk2", qStringList ) @@ -2052,9 +2055,9 @@ METHOD HbIde:readProcessInfo( nMode ) ::oOutputResult:oWidget:append( '-----------------------------------------------------------------' ) ::oOutputResult:oWidget:append( 'Finished at ' + time() ) - Qt_DisConnect_Signal( ::qProcess, "finished(int,int)" ) - Qt_DisConnect_Signal( ::qProcess, "readyReadStandardOutput()" ) - Qt_DisConnect_Signal( ::qProcess, "readyReadStandardError()" ) + Qt_Slots_disConnect( ::pSlots, ::qProcess, "finished(int,int)" ) + Qt_Slots_disConnect( ::pSlots, ::qProcess, "readyReadStandardOutput()" ) + Qt_Slots_disConnect( ::pSlots, ::qProcess, "readyReadStandardError()" ) ::qProcess:kill() ::qProcess:pPtr := 0 diff --git a/harbour/contrib/hbide/idedocks.prg b/harbour/contrib/hbide/idedocks.prg index 31de1b4b71..f7b9da2e63 100644 --- a/harbour/contrib/hbide/idedocks.prg +++ b/harbour/contrib/hbide/idedocks.prg @@ -73,6 +73,9 @@ CLASS IdeDocks + ACCESS pSlots INLINE hbxbp_getSlotsPtr() + ACCESS pEvents INLINE hbxbp_GetEventsPtr() + DATA nPass INIT 0 DATA oIde @@ -343,7 +346,7 @@ METHOD IdeDocks:buildOutputResults() ::oDlg:oWidget:addDockWidget_1( Qt_BottomDockWidgetArea, ::oDockB2:oWidget, Qt_Horizontal ) ::oDockB2:hide() - Qt_Connect_Signal( ::oOutputResult:oWidget, "copyAvailable(bool)", {|o,l| ::outputDoubleClicked( l, o ) } ) + Qt_Slots_Connect( ::pSlots, ::oOutputResult:oWidget, "copyAvailable(bool)", {|o,l| ::outputDoubleClicked( l, o ) } ) RETURN Self @@ -363,7 +366,7 @@ METHOD IdeDocks:outputDoubleClicked( lSelected ) ::oIde:editSource( cSource ) qCursor := QTextCursor():configure( ::oIde:qCurEdit:textCursor() ) nLine := iif( nLine < 1, 0, nLine - 1 ) - + qCursor:setPosition( 0 ) qCursor:movePosition( QTextCursor_Down, QTextCursor_MoveAnchor, nLine ) ::oIde:qCurEdit:setTextCursor( qCursor ) diff --git a/harbour/contrib/hbide/ideeditor.prg b/harbour/contrib/hbide/ideeditor.prg index 7d75af7599..ba8f78607e 100644 --- a/harbour/contrib/hbide/ideeditor.prg +++ b/harbour/contrib/hbide/ideeditor.prg @@ -75,6 +75,9 @@ CLASS IdeEditor + ACCESS pSlots INLINE hbxbp_getSlotsPtr() + ACCESS pEvents INLINE hbxbp_GetEventsPtr() + DATA oIde DATA oTab @@ -177,10 +180,10 @@ METHOD IdeEditor:create( oIde, cSourceFile, nPos, nHPos, nVPos, cTheme ) ::qHiliter := ::oIde:oThemes:SetSyntaxHilighting( ::qEdit, @::cTheme ) ENDIF - Qt_Connect_Signal( ::qEdit , "textChanged()" , {|| ::setTabImage() } ) - Qt_Connect_Signal( ::qEdit , "cursorPositionChanged()", {|| ::dispEditInfo() } ) + Qt_Slots_Connect( ::pSlots, ::qEdit , "textChanged()" , {|| ::setTabImage() } ) + Qt_Slots_Connect( ::pSlots, ::qEdit , "cursorPositionChanged()", {|| ::dispEditInfo() } ) - Qt_Connect_Signal( ::qDocument, "blockCountChanged(int)" , {|o,i| ::onBlockCountChanged( i, o ) } ) + Qt_Slots_Connect( ::pSlots, ::qDocument, "blockCountChanged(int)" , {|o,i| ::onBlockCountChanged( i, o ) } ) ::qEdit:show() @@ -231,7 +234,7 @@ METHOD IdeEditor:destroy() METHOD IdeEditor:removeTabPage() LOCAL cSource := ::sourceFile LOCAL n - + n := aScan( ::oIde:aTabs, {|e_| e_[ TAB_OEDITOR ]:nID == ::nID } ) IF n > 0 @@ -245,13 +248,13 @@ METHOD IdeEditor:removeTabPage() // { oTab, qEdit, qHiliter, qLayout, cSourceFile, qDocument } // IF !Empty( ::qEdit ) - Qt_DisConnect_Signal( ::qEdit, "textChanged()" ) - Qt_DisConnect_Signal( ::qEdit, "cursorPositionChanged()" ) + Qt_Slots_disConnect( ::pSlots, ::qEdit, "textChanged()" ) + Qt_Slots_disConnect( ::pSlots, ::qEdit, "cursorPositionChanged()" ) /* To avoid recursive calls on invalid pointers */ ENDIF - + IF !Empty( ::qDocument ) - Qt_DisConnect_Signal( ::qDocument, "blockCountChanged(int)" ) + Qt_Slots_disConnect( ::pSlots, ::qDocument, "blockCountChanged(int)" ) ::qDocument:pPtr := 0 ::qDocument := nil ENDIF @@ -269,7 +272,7 @@ METHOD IdeEditor:removeTabPage() IF !Empty( ::qEdit ) ::qEdit:pPtr := 0 ::qEdit := nil - + ::oIde:oFuncList:clear() ENDIF @@ -280,13 +283,13 @@ METHOD IdeEditor:removeTabPage() ENDIF n := aScan( ::oIde:aProjData, {|e_| e_[ 4 ] == cSource } ) - + IF ( n > 0 ) ::oIde:aProjData[ n,3 ]:delItem( ::oIde:aProjData[ n,1 ] ) hb_aDel( ::oIde:aProjData, n, .T. ) ENDIF - + n := aScan( ::oIde:aEdits, {|e_| e_:nID == ::nID } ) IF ( n > 0 ) @@ -315,13 +318,13 @@ METHOD IdeEditor:removeTabPage() METHOD IdeEditor:buildTabPage( cSource ) ::oTab := XbpTabPage():new( ::oIde:oDA, , { 5,5 }, { 700,400 }, , .t. ) - + IF Empty( cSource ) ::oTab:caption := "Untitled " + hb_ntos( GetNextUntitled() ) ELSE ::oTab:caption := ::cFile + ::cExt ENDIF - + ::oTab:minimized := .F. ::oTab:create() diff --git a/harbour/contrib/hbxbp/xbpbrowse.prg b/harbour/contrib/hbxbp/xbpbrowse.prg index 85e54e03a4..1fbc57f9a8 100644 --- a/harbour/contrib/hbxbp/xbpbrowse.prg +++ b/harbour/contrib/hbxbp/xbpbrowse.prg @@ -593,7 +593,7 @@ METHOD XbpBrowse:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::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( ::oTableView:pPtr, "scrollContentsBy(int,int)" , {|o,p,p1| ::exeBlock(11, p, p1, o ) } ) /* Finetune Horizontal Scrollbar */ ::oTableView:setHorizontalScrollBarPolicy( Qt_ScrollBarAlwaysOff ) diff --git a/harbour/contrib/hbxbp/xbpdialog.prg b/harbour/contrib/hbxbp/xbpdialog.prg index f6d599e80b..36cb7ddd3d 100644 --- a/harbour/contrib/hbxbp/xbpdialog.prg +++ b/harbour/contrib/hbxbp/xbpdialog.prg @@ -171,7 +171,7 @@ METHOD XbpDialog:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) hbxbp_SetEventLoop( ::oEventLoop ) /* Instal Event Filter */ - ::oWidget:installEventFilter( QT_GetEventFilter() ) + ::oWidget:installEventFilter( ::pEvents ) ::connectWindowEvents() // diff --git a/harbour/contrib/hbxbp/xbpgeneric.prg b/harbour/contrib/hbxbp/xbpgeneric.prg index a5c197e381..b2947a8ea6 100644 --- a/harbour/contrib/hbxbp/xbpgeneric.prg +++ b/harbour/contrib/hbxbp/xbpgeneric.prg @@ -89,6 +89,9 @@ THREAD STATIC t_oAppWindow THREAD STATIC t_oEventLoop +THREAD STATIC t_qtSlots +THREAD STATIC t_qtEvents + THREAD STATIC t_oXbpInFocus /*----------------------------------------------------------------------*/ @@ -113,12 +116,30 @@ EXIT PROCEDURE hbxbp_End() RETURN +/*----------------------------------------------------------------------*/ + +FUNCTION hbxbp_getSlotsPtr() + RETURN t_qtSlots + +/*----------------------------------------------------------------------*/ + +FUNCTION hbxbp_getEventsPtr() + RETURN t_qtEvents + /*----------------------------------------------------------------------*/ /* * Will be called from XbpDialog() | XbpCRT() */ FUNCTION hbxbp_InitializeEventBuffer() + IF empty( t_qtSlots ) + t_qtSlots := Qt_Slots_New() + ENDIF + + IF empty( t_qtEvents ) + t_qtEvents := Qt_Events_New() + ENDIF + IF empty( t_events ) t_events := array( EVENT_BUFFER ) aeval( t_events, {|e,i| HB_SYMBOL_UNUSED( e ), t_events[ i ] := { 0, NIL, NIL, NIL } } ) diff --git a/harbour/contrib/hbxbp/xbplistbox.prg b/harbour/contrib/hbxbp/xbplistbox.prg index 73ccd9f989..b9ae03e32d 100644 --- a/harbour/contrib/hbxbp/xbplistbox.prg +++ b/harbour/contrib/hbxbp/xbplistbox.prg @@ -179,7 +179,7 @@ METHOD XbpListBox:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::oWidget:setMouseTracking( .t. ) /* Window Events */ - ::oWidget:installEventFilter( QT_GetEventFilter() ) + ::oWidget:installEventFilter( ::pEvents ) ::connectEvent( ::pWidget, QEvent_ContextMenu, {|o,e| ::grabEvent( QEvent_ContextMenu, e, o ) } ) /* Signal-slots */ diff --git a/harbour/contrib/hbxbp/xbpqtuiloader.prg b/harbour/contrib/hbxbp/xbpqtuiloader.prg index 2897b1370f..c8bbcc4e03 100644 --- a/harbour/contrib/hbxbp/xbpqtuiloader.prg +++ b/harbour/contrib/hbxbp/xbpqtuiloader.prg @@ -132,11 +132,11 @@ METHOD XbpQtUiLoader:destroy() LOCAL a_ FOR EACH a_ IN ::aSignals - Qt_DisConnect_Signal( a_[ 1 ], a_[ 2 ] ) + Qt_Slots_disConnect( ::pSlots, a_[ 1 ], a_[ 2 ] ) NEXT FOR EACH a_ IN ::aEvents - Qt_DisConnect_Event( a_[ 1 ], a_[ 2 ] ) + Qt_Events_disConnect( ::pEvents, a_[ 1 ], a_[ 2 ] ) NEXT ::oWidget:hide() @@ -149,7 +149,7 @@ METHOD XbpQtUiLoader:destroy() METHOD XbpQtUiLoader:event( cWidget, nEvent, bBlock ) IF hb_hHasKey( ::qObj, cWidget ) - IF Qt_Connect_Signal( ::qObj[ cWidget ], nEvent, bBlock ) + IF Qt_Events_Connect( ::pEvents, ::qObj[ cWidget ], nEvent, bBlock ) aadd( ::aEvents, { ::qObj[ cWidget ], nEvent } ) ENDIF ENDIF @@ -161,7 +161,7 @@ METHOD XbpQtUiLoader:event( cWidget, nEvent, bBlock ) METHOD XbpQtUiLoader:signal( cWidget, cSignal, bBlock ) IF hb_hHasKey( ::qObj, cWidget ) - IF Qt_Connect_Signal( ::qObj[ cWidget ], cSignal, bBlock ) + IF Qt_Slots_Connect( ::pSlots, ::qObj[ cWidget ], cSignal, bBlock ) aadd( ::aSignals, { ::qObj[ cWidget ], cSignal } ) ENDIF ENDIF diff --git a/harbour/contrib/hbxbp/xbpsle.prg b/harbour/contrib/hbxbp/xbpsle.prg index f22878597d..a5f622cc84 100644 --- a/harbour/contrib/hbxbp/xbpsle.prg +++ b/harbour/contrib/hbxbp/xbpsle.prg @@ -147,7 +147,7 @@ METHOD XbpSLE:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::oWidget:setMaxLength( ::bufferLength ) #if 0 - QT_QObject_InstallEventFilter( ::pWidget, QT_GetEventFilter() ) + ::oWidget:installEventFilter( ::pEvents ) ::connectEvent( ::pWidget, QEvent_FocusIn , {|o,e| ::exeBlock( 7, e, o ) } ) ::connectEvent( ::pWidget, QEvent_FocusOut, {|o,e| ::exeBlock( 8, e, o ) } ) diff --git a/harbour/contrib/hbxbp/xbpspinbutton.prg b/harbour/contrib/hbxbp/xbpspinbutton.prg index 49c393ef4b..549c422f5f 100644 --- a/harbour/contrib/hbxbp/xbpspinbutton.prg +++ b/harbour/contrib/hbxbp/xbpspinbutton.prg @@ -155,7 +155,8 @@ METHOD XbpSpinButton:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ::oWidget:setAlignment( es_[ ::align ] ) #if 0 //////////////////////////////////// - QT_QObject_InstallEventFilter( ::pWidget, QT_GetEventFilter() ) + ::oWidget:installEventFilter( ::pEvents ) + HBXBP_DEBUG( "XbpSpinButton:create 2" ) ::connectEvent( ::pWidget, QEvent_FocusIn , {|o,e| ::exeBlock( 7, e, o ) } ) ::connectEvent( ::pWidget, QEvent_FocusOut, {|o,e| ::exeBlock( 8, e, o ) } ) diff --git a/harbour/contrib/hbxbp/xbptreeview.prg b/harbour/contrib/hbxbp/xbptreeview.prg index ebcec2ea42..4f6ae67bc7 100644 --- a/harbour/contrib/hbxbp/xbptreeview.prg +++ b/harbour/contrib/hbxbp/xbptreeview.prg @@ -169,7 +169,7 @@ METHOD XbpTreeView:create( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) ::oRootItem:oWidget := oW /* Window Events */ - ::oWidget:installEventFilter( QT_GetEventFilter() ) + ::oWidget:installEventFilter( ::pEvents ) ::connectEvent( ::pWidget, QEvent_ContextMenu, {|o,e| ::grabEvent( QEvent_ContextMenu, e, o ) } ) //::connect( ::pWidget, "currentItemChanged(QTWItem)" , {|o,p1,p2| ::exeBlock( 1, p1, p2, o ) } ) diff --git a/harbour/contrib/hbxbp/xbpwindow.prg b/harbour/contrib/hbxbp/xbpwindow.prg index 30b708234d..d4cba24f81 100644 --- a/harbour/contrib/hbxbp/xbpwindow.prg +++ b/harbour/contrib/hbxbp/xbpwindow.prg @@ -255,7 +255,7 @@ EXPORTED: DATA nWndProc DATA oMenu - METHOD HandleEvent() + METHOD handleEvent() METHOD grabEvent() METHOD isDerivedFrom() @@ -284,6 +284,9 @@ EXPORTED: METHOD hbContextMenu SETGET + ACCESS pSlots INLINE hbxbp_getSlotsPtr() + ACCESS pEvents INLINE hbxbp_GetEventsPtr() + ENDCLASS /*----------------------------------------------------------------------*/ @@ -395,18 +398,36 @@ METHOD XbpWindow:setQtProperty( cProperty ) METHOD XbpWindow:connect( pWidget, cSignal, bBlock ) LOCAL lSuccess - IF ( lSuccess := Qt_Connect_Signal( pWidget, cSignal, bBlock ) ) + IF ( lSuccess := Qt_Slots_Connect( ::pSlots, pWidget, cSignal, bBlock ) ) aadd( ::aConnections, { pWidget, cSignal } ) + ELSE + // HB_TRACE( HB_TR_ALWAYS, ( " Connection failed %s", cSignal ) ) + HB_TRACE( HB_TR_ALWAYS, ( " " + cSignal ) ) ENDIF RETURN lSuccess /*----------------------------------------------------------------------*/ +METHOD XbpWindow:disconnect() + LOCAL e_ + + IF len( ::aConnections ) > 0 + FOR EACH e_ IN ::aConnections + ::xDummy := Qt_Slots_DisConnect( ::pSlots, e_[ 1 ], e_[ 2 ] ) + // HBXBP_DEBUG( " Signal Disconnect:", iif( ::xDummy, "SUCCEEDED", "FAILED " ), e_[ 1 ], e_[ 2 ] ) + NEXT + ::aConnections := {} + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD XbpWindow:connectEvent( pWidget, nEvent, bBlock ) LOCAL lSuccess - IF ( lSuccess := Qt_Connect_Event( pWidget, nEvent, bBlock ) ) + IF ( lSuccess := Qt_Events_Connect( ::pEvents, hbqt_ptr( pWidget ), nEvent, bBlock ) ) aadd( ::aEConnections, { pWidget, nEvent } ) ENDIF @@ -442,9 +463,117 @@ METHOD XbpWindow:connectWindowEvents() RETURN Self /*----------------------------------------------------------------------*/ -/* -:quit() -*/ + +METHOD XbpWindow:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) + + DEFAULT oParent TO ::oParent + DEFAULT oOwner TO ::oOwner + DEFAULT aPos TO ::aPos + DEFAULT aSize TO ::sSize + DEFAULT aPresParams TO ::aPresParams + DEFAULT lVisible TO ::visible + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD XbpWindow:destroy() + LOCAL e_ + LOCAL cXbp := __ObjGetClsName( self ) + +//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 ) + ::oEventLoop:exit( 0 ) + ::oEventLoop:pPtr := 0 + SetAppWindow( XbpObject():new() ) + ::oMenu := NIL + ENDIF + + ::disconnect() + + IF len( ::aEConnections ) > 0 + FOR EACH e_ IN ::aEConnections + ::xDummy := Qt_Events_DisConnect( ::pEvents, e_[ 1 ], e_[ 2 ] ) +// HBXBP_DEBUG( "Event Disconnect:", iif( ::xDummy, "SUCCEEDED", "FAILED " ), e_[ 1 ], e_[ 2 ] ) + NEXT + ::aEConnections := {} + ::oWidget:removeEventFilter( QT_GetEventFilter() ) + ENDIF + + IF Len( ::aChildren ) > 0 + aeval( ::aChildren, {|o| o:destroy() } ) + ::aChildren := {} + ENDIF + + ::XbpPartHandler:destroy() + ::clearSlots() + + IF cXbp == "XBPDIALOG" + hbxbp_ClearEventBuffer() + ENDIF + + ::oWidget:pPtr := 0 + ::oWidget := NIL + +//HBXBP_DEBUG( hb_threadId()," Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty(::cargo),'',str(::cargo) ), memory( 1001 ), hbqt_getMemUsed() ) + + RETURN NIL + +/*----------------------------------------------------------------------*/ + +METHOD XbpWindow:clearSlots() + LOCAL i + + ::sl_enter := NIL + ::sl_leave := NIL + ::sl_lbClick := NIL + ::sl_lbDblClick := NIL + ::sl_lbDown := NIL + ::sl_lbUp := NIL + ::sl_mbClick := NIL + ::sl_mbDblClick := NIL + ::sl_mbDown := NIL + ::sl_mbUp := NIL + ::sl_motion := NIL + ::sl_rbClick := NIL + ::sl_rbDblClick := NIL + ::sl_rbDown := NIL + ::sl_rbUp := NIL + ::sl_wheel := NIL + + ::sl_helpRequest := NIL + ::sl_keyboard := NIL + ::sl_killInputFocus := NIL + ::sl_move := NIL + ::sl_paint := NIL + ::sl_quit := NIL + ::sl_resize := NIL + ::sl_setInputFocus := NIL + ::sl_dragEnter := NIL + ::sl_dragMotion := NIL + ::sl_dragLeave := NIL + ::sl_dragDrop := NIL + + ::sl_close := NIL + ::sl_setDisplayFocus := NIL + ::sl_killDisplayFocus := NIL + + IF !empty( ::aPresParams ) + FOR i := 1 TO len( ::aPresParams ) + ::aPresParams[ i,1 ] := NIL + ::aPresParams[ i,2 ] := NIL + ::aPresParams[ i ] := NIL + NEXT + ENDIF + ::aPresParams := NIL + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD XbpWindow:grabEvent( nEvent, pEvent, oXbp ) LOCAL oEvent, nXbpKey, oP0, oP1, oObj_O, oObj_N LOCAL lRet := .t. @@ -726,133 +855,6 @@ METHOD XbpWindow:handleEvent( nEvent, mp1, mp2 ) /*----------------------------------------------------------------------*/ -METHOD XbpWindow:configure( oParent, oOwner, aPos, aSize, aPresParams, lVisible ) - - DEFAULT oParent TO ::oParent - DEFAULT oOwner TO ::oOwner - DEFAULT aPos TO ::aPos - DEFAULT aSize TO ::sSize - DEFAULT aPresParams TO ::aPresParams - DEFAULT lVisible TO ::visible - - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD XbpWindow:destroy() - LOCAL e_ - LOCAL cXbp := __ObjGetClsName( self ) - -//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 ) - ::oEventLoop:exit( 0 ) - ::oEventLoop:pPtr := 0 - SetAppWindow( XbpObject():new() ) - ::oMenu := NIL - ENDIF - - ::disconnect() - - IF len( ::aEConnections ) > 0 - FOR EACH e_ IN ::aEConnections - ::xDummy := Qt_DisConnect_Event( e_[ 1 ], e_[ 2 ] ) -// HBXBP_DEBUG( "Event Disconnect:", iif( ::xDummy, "SUCCEEDED", "FAILED " ), e_[ 1 ], e_[ 2 ] ) - NEXT - ::aEConnections := {} - ::oWidget:removeEventFilter( QT_GetEventFilter() ) - ENDIF - - IF Len( ::aChildren ) > 0 - aeval( ::aChildren, {|o| o:destroy() } ) - ::aChildren := {} - ENDIF - - ::XbpPartHandler:destroy() - ::clearSlots() - - IF cXbp == "XBPDIALOG" - hbxbp_ClearEventBuffer() - Qt_Slots_Destroy() - Qt_Events_Destroy() - ENDIF - - ::oWidget:pPtr := 0 - ::oWidget := NIL - -//HBXBP_DEBUG( hb_threadId()," Destroy: "+pad(__ObjGetClsName( self ),12)+ IF(empty(::cargo),'',str(::cargo) ), memory( 1001 ), hbqt_getMemUsed() ) - - RETURN NIL - -/*----------------------------------------------------------------------*/ - -METHOD XbpWindow:disconnect() - LOCAL e_ - - IF len( ::aConnections ) > 0 - FOR EACH e_ IN ::aConnections - ::xDummy := Qt_DisConnect_Signal( e_[ 1 ], e_[ 2 ] ) -// HBXBP_DEBUG( " Signal Disconnect:", iif( ::xDummy, "SUCCEEDED", "FAILED " ), e_[ 1 ], e_[ 2 ] ) - NEXT - ::aConnections := {} - ENDIF - - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD XbpWindow:clearSlots() - LOCAL i - - ::sl_enter := NIL - ::sl_leave := NIL - ::sl_lbClick := NIL - ::sl_lbDblClick := NIL - ::sl_lbDown := NIL - ::sl_lbUp := NIL - ::sl_mbClick := NIL - ::sl_mbDblClick := NIL - ::sl_mbDown := NIL - ::sl_mbUp := NIL - ::sl_motion := NIL - ::sl_rbClick := NIL - ::sl_rbDblClick := NIL - ::sl_rbDown := NIL - ::sl_rbUp := NIL - ::sl_wheel := NIL - - ::sl_helpRequest := NIL - ::sl_keyboard := NIL - ::sl_killInputFocus := NIL - ::sl_move := NIL - ::sl_paint := NIL - ::sl_quit := NIL - ::sl_resize := NIL - ::sl_setInputFocus := NIL - ::sl_dragEnter := NIL - ::sl_dragMotion := NIL - ::sl_dragLeave := NIL - ::sl_dragDrop := NIL - - ::sl_close := NIL - ::sl_setDisplayFocus := NIL - ::sl_killDisplayFocus := NIL - - IF !empty( ::aPresParams ) - FOR i := 1 TO len( ::aPresParams ) - ::aPresParams[ i,1 ] := NIL - ::aPresParams[ i,2 ] := NIL - ::aPresParams[ i ] := NIL - NEXT - ENDIF - ::aPresParams := NIL - - RETURN Self - -/*----------------------------------------------------------------------*/ - METHOD XbpWindow:captureMouse( lCapture ) LOCAL lSuccess := .f.