2012-06-14 02:01 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbqt/qtcore/hbqt_hbqevents.cpp
! Fix to prev.
* contrib/hbqt/tests/browqt.prg
* contrib/hbqt/tests/dbfbrowser.prg
* contrib/hbqt/tests/demoqt.prg
* contrib/hbqt/tests/draggable.prg
* contrib/hbqt/tests/inherit.prg
* contrib/hbqt/tests/qtrevamp.prg
* contrib/hbqt/tests/testbrow.prg
- Removed: :disconnect() calls. Now all is working like
the way we are accustomed to.
This commit is contained in:
@@ -16,6 +16,20 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2012-06-14 02:01 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbqt/qtcore/hbqt_hbqevents.cpp
|
||||
! Fix to prev.
|
||||
|
||||
* contrib/hbqt/tests/browqt.prg
|
||||
* contrib/hbqt/tests/dbfbrowser.prg
|
||||
* contrib/hbqt/tests/demoqt.prg
|
||||
* contrib/hbqt/tests/draggable.prg
|
||||
* contrib/hbqt/tests/inherit.prg
|
||||
* contrib/hbqt/tests/qtrevamp.prg
|
||||
* contrib/hbqt/tests/testbrow.prg
|
||||
- Removed: :disconnect() calls. Now all is working like
|
||||
the way we are accustomed to.
|
||||
|
||||
2012-06-14 00:31 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbqt/qtcore/hbqt_bind.cpp
|
||||
+ Enabled: by default to clear all items in the global list.
|
||||
|
||||
@@ -183,8 +183,8 @@ bool HBQEvents::eventFilter( QObject * object, QEvent * event )
|
||||
PHB_ITEM pItem = hbqt_bindGetHbObject( NULL, ( void * ) event, ( s_lstCreateObj.at( eventId ) ), NULL, HBQT_BIT_NONE );
|
||||
stopTheEventChain = ( bool ) hb_itemGetL( hb_vmEvalBlockV( hb_arrayGetItemPtr( pArray, 1 ), 1, pItem ) );
|
||||
hb_itemRelease( pItem );
|
||||
hb_itemRelease( pArray );
|
||||
}
|
||||
hb_itemRelease( pArray );
|
||||
}
|
||||
}
|
||||
if( eventtype == QEvent::Close )
|
||||
|
||||
@@ -34,7 +34,8 @@ STATIC PROCEDURE BuildADialog()
|
||||
oDA:resize(640,460 )
|
||||
lay1 := QVBoxLayout( oDA )
|
||||
|
||||
DBUseArea( .T., NIL, "../../../tests/test.dbf", "T1", .F., .F. )
|
||||
USE "../../../tests/test.dbf" SHARED NEW
|
||||
|
||||
aStru1 := DBStruct()
|
||||
nCX1 := 0
|
||||
nCY1 := 0
|
||||
@@ -112,7 +113,7 @@ STATIC FUNCTION my_browse( nArea, aStru, t, role, x, y )
|
||||
THREAD STATIC oColorLN
|
||||
THREAD STATIC oSize
|
||||
|
||||
IF ! lInit
|
||||
IF ! lInit
|
||||
lInit := .t.
|
||||
oColorN := QColor( 100, 0,100 )
|
||||
oColorD := QColor( 150, 100, 0 )
|
||||
@@ -120,7 +121,7 @@ STATIC FUNCTION my_browse( nArea, aStru, t, role, x, y )
|
||||
oColorLN := QColor( 200, 0, 0 )
|
||||
|
||||
oSize := QSize(50,24)
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
DBSelectArea( nArea )
|
||||
|
||||
@@ -215,4 +216,3 @@ STATIC FUNCTION my_browse( nArea, aStru, t, role, x, y )
|
||||
|
||||
RETURN NIL
|
||||
|
||||
|
||||
@@ -54,9 +54,6 @@ PROCEDURE Main()
|
||||
oWid:Show()
|
||||
QApplication():exec()
|
||||
|
||||
oTable1:detach()
|
||||
oButton1:disconnect( "clicked()" )
|
||||
oButton2:disconnect( "clicked()" )
|
||||
RETURN
|
||||
|
||||
PROCEDURE OpenDBF( oWid, oTable, oLabel )
|
||||
|
||||
@@ -81,11 +81,12 @@ FUNCTION My_Events( e )
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
PROCEDURE Main()
|
||||
Local oBtn, oDA, oWnd, oSBar, oAct, aMenu, aTool, aTabs
|
||||
|
||||
Local oBtn, oDA, oWnd, oSBar, aMenu, aTool, aTabs, oELoop, lExit := .f.
|
||||
|
||||
hbqt_errorsys()
|
||||
|
||||
oWnd := QMainWindow()
|
||||
oWnd:setAttribute( Qt_WA_DeleteOnClose, .f. )
|
||||
oWnd:show()
|
||||
|
||||
oWnd:setMouseTracking( .t. )
|
||||
@@ -107,34 +108,24 @@ PROCEDURE Main()
|
||||
Build_ProgressBar( oDA, { 30,300 }, { 200,30 } )
|
||||
Build_ListBox( oDA, { 310,240 }, { 150, 100 } )
|
||||
Build_Label( oDA, { 30,190 }, { 300, 30 } )
|
||||
|
||||
|
||||
aTabs := Build_Tabs( oDA, { 510, 5 }, { 360, 400 } )
|
||||
|
||||
oBtn := Build_PushButton( oDA, { 30,240 }, { 100,50 } )
|
||||
oBtn:setStyleSheet( "background: #a00fff;" )
|
||||
|
||||
oWnd:connect( QEvent_KeyPress, {|e| My_Events( e ) } )
|
||||
oWnd:connect( QEvent_Close , {|| QApplication():quit() } )
|
||||
|
||||
oWnd:connect( QEvent_Close , {|| lExit := .t. } )
|
||||
|
||||
oWnd:Show()
|
||||
QApplication():exec()
|
||||
|
||||
oWnd:disconnect( QEvent_KeyPress )
|
||||
oWnd:disconnect( QEvent_Close )
|
||||
|
||||
oBtn:disconnect( "clicked()" )
|
||||
|
||||
FOR EACH oAct IN aMenu
|
||||
oAct:disconnect( "triggered(bool)" )
|
||||
NEXT
|
||||
FOR EACH oAct IN aTool
|
||||
oAct:disconnect( "triggered(bool)" )
|
||||
NEXT
|
||||
|
||||
aTabs[ 1,1 ]:disconnect( "returnPressed()" )
|
||||
aTabs[ 1,2 ]:disconnect( "currentIndexChanged(int)" )
|
||||
aTabs[ 1,3 ]:disconnect( "stateChanged(int)" )
|
||||
aTabs[ 1,4 ]:disconnect( "clicked()" )
|
||||
oELoop := QEventLoop( oWnd )
|
||||
DO WHILE .t.
|
||||
oELoop:processEvents()
|
||||
IF lExit
|
||||
EXIT
|
||||
ENDIF
|
||||
ENDDO
|
||||
oELoop:exit( 0 )
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ".............. E X I T I N G ..................." )
|
||||
xReleaseMemory( { oBtn, aMenu, aTool, aTabs, oDA, oWnd } )
|
||||
@@ -189,6 +180,7 @@ PROCEDURE ExecOneMore()
|
||||
oWnd:setStatusBar( oSBar )
|
||||
oSBar:showMessage( "Harbour-QT Statusbar Ready!" )
|
||||
|
||||
oWnd:connect( QEvent_Close , {|| lExit := .t. } )
|
||||
oEventLoop := QEventLoop( oWnd )
|
||||
|
||||
DO WHILE .t.
|
||||
@@ -198,7 +190,6 @@ PROCEDURE ExecOneMore()
|
||||
ENDIF
|
||||
ENDDO
|
||||
oEventLoop:exit( 0 )
|
||||
oEventLoop := 0
|
||||
|
||||
xReleaseMemory( { oBtn, oLabel, oProg, oSBar, aGrid, aList, aMenu, aTool, aTabs, oDA, oWnd, oEventLoop } )
|
||||
HB_TRACE( HB_TR_DEBUG, " " )
|
||||
@@ -368,7 +359,7 @@ STATIC FUNCTION Build_Grid( oWnd, aPos, aSize )
|
||||
//
|
||||
oGrid:Show()
|
||||
|
||||
RETURN {}
|
||||
RETURN {}
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -429,13 +420,13 @@ STATIC FUNCTION Build_ListBox( oWnd, aPos, aSize )
|
||||
oStrList:sort()
|
||||
|
||||
oStrModel := QStringListModel( oStrList, oListBox )
|
||||
|
||||
|
||||
oListBox:setModel( oStrModel )
|
||||
oListBox:Move( aPos[ 1 ], aPos[ 2 ] )
|
||||
oListBox:ReSize( aSize[ 1 ], aSize[ 2 ] )
|
||||
oListBox:Show()
|
||||
|
||||
RETURN NIL
|
||||
RETURN NIL
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
@@ -449,7 +440,7 @@ STATIC FUNCTION Build_TextBox( oWnd )
|
||||
oTextBox:setPlainText( "This is Harbour QT implementation" )
|
||||
oTextBox:Show()
|
||||
|
||||
RETURN NIL
|
||||
RETURN NIL
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
@@ -22,9 +22,10 @@ PROCEDURE Main()
|
||||
oWid := QWidget()
|
||||
oWid:setWindowTitle( "Draggable window" )
|
||||
oWId:setAttribute( Qt_WA_TranslucentBackground )
|
||||
oWId:setAttribute( Qt_WA_DeleteOnClose, .f. )
|
||||
oWid:setWindowFlags( Qt_FramelessWindowHint )
|
||||
|
||||
oLabel1 := QLabel()
|
||||
oLabel1 := QLabel( oWid )
|
||||
oLabel1:setPixmap( QPixmap( hb_DirBase() + "harbour-logo.png" ) )
|
||||
|
||||
oLabel2 := QLabel( "Drag-me with the mouse. Double-click to close." )
|
||||
@@ -33,21 +34,14 @@ PROCEDURE Main()
|
||||
oLay1:addWidget( oLabel1 )
|
||||
oLay1:addWidget( oLabel2 )
|
||||
|
||||
oWid:connect( QEvent_MouseButtonPress , {| oMouseEvent | WinDrag( oMouseEvent, oWid ) } )
|
||||
oWid:connect( QEvent_MouseButtonRelease, {| oMouseEvent | WinDrag( oMouseEvent, oWid ) } )
|
||||
oWid:connect( QEvent_MouseMove, {| oMouseEvent | WinDrag( oMouseEvent, oWid ) } )
|
||||
|
||||
oWid:connect( QEvent_MouseButtonPress , {| oMouseEvent | WinDrag( oMouseEvent, oWid ) } )
|
||||
oWid:connect( QEvent_MouseButtonRelease , {| oMouseEvent | WinDrag( oMouseEvent, oWid ) } )
|
||||
oWid:connect( QEvent_MouseMove , {| oMouseEvent | WinDrag( oMouseEvent, oWid ) } )
|
||||
oWid:connect( QEvent_MouseButtonDblClick, {|| oWid:close() } )
|
||||
|
||||
oWid:show()
|
||||
QApplication():exec()
|
||||
|
||||
oWid:disconnect( QEvent_MouseButtonPress , {| oMouseEvent | WinDrag( oMouseEvent, oWid ) } )
|
||||
oWid:disconnect( QEvent_MouseButtonRelease, {| oMouseEvent | WinDrag( oMouseEvent, oWid ) } )
|
||||
oWid:disconnect( QEvent_MouseMove, {| oMouseEvent | WinDrag( oMouseEvent, oWid ) } )
|
||||
|
||||
oWid:disconnect( QEvent_MouseButtonDblClick, {|| oWid:close() } )
|
||||
|
||||
RETURN
|
||||
|
||||
PROCEDURE WinDrag( oMouseEvent, oWid )
|
||||
|
||||
@@ -24,7 +24,6 @@ PROCEDURE MAIN
|
||||
LOCAL oWnd
|
||||
LOCAL oTB
|
||||
LOCAL oLbl
|
||||
LOCAL oRet
|
||||
|
||||
oWnd := QMainWindow()
|
||||
|
||||
|
||||
@@ -6,65 +6,58 @@
|
||||
#include "hbtrace.ch"
|
||||
|
||||
// Why do we need these two variables in scope ?
|
||||
// Because :connect needs that Harbour object must
|
||||
// Because :connect needs that Harbour object must
|
||||
// always be accessible.
|
||||
//
|
||||
STATIC oItemIns, oItemMod
|
||||
|
||||
FUNCTION Main()
|
||||
LOCAL oWnd
|
||||
FUNCTION Main()
|
||||
LOCAL oWnd
|
||||
|
||||
hbqt_errorsys()
|
||||
|
||||
oWnd := QMainWindow()
|
||||
oWnd := QMainWindow()
|
||||
oWnd:resize( 400,200 )
|
||||
|
||||
BuildMenuBar( oWnd )
|
||||
BuildMenuBar( oWnd )
|
||||
AddLabel( oWnd )
|
||||
|
||||
oWnd:show()
|
||||
oWnd:show()
|
||||
|
||||
QApplication():exec()
|
||||
QApplication():exec()
|
||||
|
||||
IF ! empty( oItemIns )
|
||||
oItemIns:disconnect( "triggered()", {|| DlgMBox( "Yes" ) } )
|
||||
ENDIF
|
||||
IF ! empty( oItemMod )
|
||||
oItemMod:disconnect( "triggered()", {|| ContextMenu( oWnd ) } )
|
||||
ENDIF
|
||||
|
||||
RETURN NIL
|
||||
|
||||
|
||||
STATIC FUNCTION BuildMenuBar( oWnd )
|
||||
STATIC FUNCTION BuildMenuBar( oWnd )
|
||||
LOCAL oMenu1, oMenuBar
|
||||
|
||||
oMenuBar := QMenuBar( oWnd )
|
||||
oMenuBar := QMenuBar( oWnd )
|
||||
|
||||
// if we do not construct a widget without a parent
|
||||
// it will be deleted once RETURN is his, so always
|
||||
// it will be deleted once RETURN is his, so always
|
||||
// pass it its parent as an argument.
|
||||
//
|
||||
oMenu1 := QMenu( oMenuBar )
|
||||
oMenu1 := QMenu( oMenuBar )
|
||||
//
|
||||
oMenu1:setTitle( "&Options" )
|
||||
oMenu1:setTitle( "&Options" )
|
||||
|
||||
IF empty( oItemIns )
|
||||
oItemIns := QAction( oMenu1 )
|
||||
oItemIns:setText( "&MessageBox()" )
|
||||
oItemIns := QAction( oMenu1 )
|
||||
oItemIns:setText( "&MessageBox()" )
|
||||
oItemIns:connect( "triggered()", {|| DlgMBox( "Yes" ) } )
|
||||
ENDIF
|
||||
|
||||
IF empty( oItemMod )
|
||||
oItemMod := QAction( oMenu1 )
|
||||
oItemMod:setText( "&ContextMenu()" )
|
||||
oItemMod:connect( "triggered()", {|| ContextMenu( oWnd ) } )
|
||||
ENDIF
|
||||
|
||||
oMenu1:addAction( oItemIns )
|
||||
oMenu1:addAction( oItemMod )
|
||||
ENDIF
|
||||
|
||||
oMenuBar:addMenu( oMenu1 )
|
||||
IF empty( oItemMod )
|
||||
oItemMod := QAction( oMenu1 )
|
||||
oItemMod:setText( "&ContextMenu()" )
|
||||
oItemMod:connect( "triggered()", {|| ContextMenu( oWnd ) } )
|
||||
ENDIF
|
||||
|
||||
oMenu1:addAction( oItemIns )
|
||||
oMenu1:addAction( oItemMod )
|
||||
|
||||
oMenuBar:addMenu( oMenu1 )
|
||||
|
||||
oWnd:setMenuBar( oMenuBar )
|
||||
|
||||
@@ -79,22 +72,22 @@ FUNCTION AddLabel( oWnd )
|
||||
oL:setText( "Harbour Qt Revamped" )
|
||||
|
||||
// oL is local, still it is visible to the appln throughout.
|
||||
// Also memory is released automatically once its parent
|
||||
// Also memory is released automatically once its parent
|
||||
// will go out of scope.
|
||||
|
||||
RETURN NIL
|
||||
|
||||
|
||||
FUNCTION DlgMBox( cMsg )
|
||||
LOCAL oMB
|
||||
LOCAL oMB
|
||||
|
||||
oMB := QMessageBox()
|
||||
oMB:setText( cMsg )
|
||||
oMB:exec()
|
||||
|
||||
// oMB is local and QMessageBox() is not constructed with any
|
||||
// parent, so it will be deleted once RETURN is hit, and memory
|
||||
// will be reclaimed properly. Try to click on this option
|
||||
// oMB is local and QMessageBox() is not constructed with any
|
||||
// parent, so it will be deleted once RETURN is hit, and memory
|
||||
// will be reclaimed properly. Try to click on this option
|
||||
// repeatedly and see for yourself that memory remains constant.
|
||||
|
||||
RETURN NIL
|
||||
@@ -106,9 +99,9 @@ FUNCTION DlgFiles( cMask )
|
||||
oFD := QFileDialog()
|
||||
oFD:exec()
|
||||
|
||||
// oFD is local and QMessageBox() is not constructed with any
|
||||
// parent, so it will be deleted once RETURN is hit, and memory
|
||||
// will be reclaimed properly. Try to click on this option
|
||||
// oFD is local and QMessageBox() is not constructed with any
|
||||
// parent, so it will be deleted once RETURN is hit, and memory
|
||||
// will be reclaimed properly. Try to click on this option
|
||||
// repeatedly and see for yourself that memory remains constant.
|
||||
|
||||
RETURN cMask
|
||||
@@ -124,17 +117,17 @@ FUNCTION ContextMenu( oWnd )
|
||||
qMenu:addAction( "Clear" )
|
||||
qMenu:addAction( "Print" )
|
||||
qMenu:addAction( "Save as..." )
|
||||
qMenu:addSeparator()
|
||||
qMenu:addSeparator()
|
||||
qMenu:addAction( "Find" )
|
||||
|
||||
qAct := qMenu:exec( oWnd:mapToGlobal( QPoint( 10,10 ) ) )
|
||||
IF ! empty( qAct )
|
||||
//...
|
||||
ENDIF
|
||||
ENDIF
|
||||
|
||||
// qMenu is a local variable and is carries no parent,
|
||||
// qMenu is a local variable and is carries no parent,
|
||||
// which should be like this for any context menu,
|
||||
// The memory is released, along its actions, when
|
||||
// The memory is released, along its actions, when
|
||||
// RETURN is hit.
|
||||
|
||||
RETURN NIL
|
||||
|
||||
@@ -94,10 +94,6 @@ PROCEDURE Main()
|
||||
oWnd:Show()
|
||||
QApplication():exec()
|
||||
|
||||
#ifdef _method_local_
|
||||
oID:disconnect( "commitData(QWidget*)" )
|
||||
#endif
|
||||
|
||||
HB_TRACE( HB_TR_DEBUG, ( "my_select "+hb_ntos( nCX1 )+ "/"+hb_ntos( nCY1 ) ) )
|
||||
|
||||
RETURN
|
||||
|
||||
Reference in New Issue
Block a user