2011-12-23 13:09 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbqt/qtcore/hbqt_misc.prg
+ Embedded: oQt:hbSetEventBlock( QEvent_Paint, bBlock )
=>
oQt:connect( QEvent_Paint, bBlock )
NOTE: the difference is that in all other events only one
parameter is passed to bBlock, i.e., an object of
type relevant QEvent, whereas, for paintEvent two
parameters are passed, first as usual qPaintEvent,
the other qPainter.
* contrib/hbqt/tests/demoqt.prg
! Replaced: oBtn:hbSetEventBlock( QEvent_Paint, bBlock )
=>
oBtn:connect( QEvent_Paint, bBlock )
This commit is contained in:
@@ -16,7 +16,23 @@
|
||||
The license applies to all entries newer than 2009-04-28.
|
||||
*/
|
||||
|
||||
2011-12-23 23:43 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
2011-12-23 13:09 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbqt/qtcore/hbqt_misc.prg
|
||||
+ Embedded: oQt:hbSetEventBlock( QEvent_Paint, bBlock )
|
||||
=>
|
||||
oQt:connect( QEvent_Paint, bBlock )
|
||||
NOTE: the difference is that in all other events only one
|
||||
parameter is passed to bBlock, i.e., an object of
|
||||
type relevant QEvent, whereas, for paintEvent two
|
||||
parameters are passed, first as usual qPaintEvent,
|
||||
the other qPainter.
|
||||
|
||||
* contrib/hbqt/tests/demoqt.prg
|
||||
! Replaced: oBtn:hbSetEventBlock( QEvent_Paint, bBlock )
|
||||
=>
|
||||
oBtn:connect( QEvent_Paint, bBlock )
|
||||
|
||||
2011-12-23 11:43 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
|
||||
* contrib/hbqt/hbmk2_qt.hbs
|
||||
! Fixed: a strategic omission where return value of a block
|
||||
was not being retrieved properly. Now newly introduced
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/*
|
||||
* Harbour Project source code:
|
||||
*
|
||||
* Copyright 2009 Pritpal Bedi <pritpal@vouchcac.com>
|
||||
* Copyright 2009-2011 Pritpal Bedi <pritpal@vouchcac.com>
|
||||
* www - http://harbour-project.org
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -54,6 +54,8 @@
|
||||
#include "error.ch"
|
||||
#include "hbtrace.ch"
|
||||
|
||||
#define QEvent_Paint 12
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
CREATE CLASS HbQtObjectHandler
|
||||
@@ -63,7 +65,6 @@ CREATE CLASS HbQtObjectHandler
|
||||
VAR __pSlots PROTECTED
|
||||
VAR __pEvents PROTECTED
|
||||
|
||||
//METHOD fromPointer( pPtr )
|
||||
METHOD hasValidPointer()
|
||||
|
||||
METHOD connect( cnEvent, bBlock )
|
||||
@@ -76,9 +77,6 @@ ENDCLASS
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
/* TODO: Drop this function, as it's not desired to have invalid QT pointers wrapped
|
||||
into valid .prg level QT objects.
|
||||
Currently it will return .F. for objects created using :fromPointer() */
|
||||
METHOD HbQtObjectHandler:hasValidPointer()
|
||||
RETURN __hbqt_isPointer( ::pPtr )
|
||||
|
||||
@@ -135,17 +133,26 @@ METHOD HbQtObjectHandler:connect( cnEvent, bBlock )
|
||||
EXIT
|
||||
|
||||
CASE "N"
|
||||
IF Empty( ::__pEvents )
|
||||
::__pEvents := HBQEvents( Self )
|
||||
ENDIF
|
||||
nResult := ::__pEvents:hbConnect( Self, cnEvent, bBlock )
|
||||
IF cnEvent == QEvent_Paint
|
||||
IF __objHasMethod( Self, "HBSETEVENTBLOCK" )
|
||||
::hbSetEventBlock( QEvent_Paint, bBlock )
|
||||
RETURN .T.
|
||||
ELSE
|
||||
RETURN .F.
|
||||
ENDIF
|
||||
ELSE
|
||||
IF Empty( ::__pEvents )
|
||||
::__pEvents := HBQEvents( Self )
|
||||
ENDIF
|
||||
nResult := ::__pEvents:hbConnect( Self, cnEvent, bBlock )
|
||||
|
||||
SWITCH nResult
|
||||
CASE 0
|
||||
RETURN .T.
|
||||
CASE -3 /* bBlock not supplied */
|
||||
RETURN .F.
|
||||
ENDSWITCH
|
||||
SWITCH nResult
|
||||
CASE 0
|
||||
RETURN .T.
|
||||
CASE -3 /* bBlock not supplied */
|
||||
RETURN .F.
|
||||
ENDSWITCH
|
||||
ENDIF
|
||||
EXIT
|
||||
|
||||
OTHERWISE
|
||||
@@ -205,8 +212,8 @@ METHOD HbQtObjectHandler:disconnect( cnEvent )
|
||||
|
||||
METHOD HbQtObjectHandler:_destroy()
|
||||
|
||||
// ::__pSlots := NIL
|
||||
// ::__pEvents := NIL
|
||||
::__pSlots := NIL
|
||||
::__pEvents := NIL
|
||||
|
||||
RETURN NIL
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#include "hbqtgui.ch"
|
||||
|
||||
#include "common.ch"
|
||||
#include "hbtrace.ch"
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
@@ -71,8 +71,6 @@
|
||||
*/
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#include "common.ch"
|
||||
|
||||
STATIC oSys, oMenuSys, oActShow, oActHide
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
@@ -115,10 +113,10 @@ PROCEDURE Main()
|
||||
oProg := Build_ProgressBar( oDA, { 30,300 }, { 200,30 } )
|
||||
aList := Build_ListBox( oDA, { 310,240 }, { 150, 100 } )
|
||||
|
||||
oBtn:hbSetEventBlock( QEvent_Paint, {|oEvent,oPainter| RePaint( oEvent, oPainter, oBtn ) } )
|
||||
oBtn:connect( QEvent_Paint, {|oEvent,oPainter| RePaint( oEvent, oPainter, oBtn ) } )
|
||||
|
||||
oWnd:connect( 6, {|e| My_Events( e ) } )
|
||||
oWnd:connect( 19, {|| QApplication():quit() } )
|
||||
oWnd:connect( QEvent_KeyPress, {|e| My_Events( e ) } )
|
||||
oWnd:connect( QEvent_Close, {|| QApplication():quit() } )
|
||||
oWnd:Show()
|
||||
|
||||
QApplication():exec()
|
||||
@@ -620,11 +618,10 @@ FUNCTION ShowInSystemTray( oWnd )
|
||||
FUNCTION RePaint( oPaintEvent, oPainter, oBtn )
|
||||
LOCAL qRect := oPaintEvent:rect()
|
||||
|
||||
|
||||
IF oBtn:isDown()
|
||||
oPainter:fillRect( qRect, QColor( 120,12,200 ) )
|
||||
oPainter:drawRect( qRect )
|
||||
oPainter:drawText( 32, 32, "Harbour" )
|
||||
oPainter:drawText( 31, 31, "Harbour" )
|
||||
ELSE
|
||||
oPainter:fillRect( qRect, QColor( 220,100,12 ) )
|
||||
oPainter:drawText( 30, 30, "Harbour" )
|
||||
|
||||
Reference in New Issue
Block a user