2009-06-06 13:15 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
* harbour/contrib/hbqt/generator/hbqtgen.prg
* harbour/contrib/hbqt/tests/demoqt.prg
+ Added demo code QTableWidget() and QTableWidgetItem() classes
to show a grid control submitted by CarozoDeQuilmes.
This commit is contained in:
@@ -17,6 +17,12 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2009-06-06 13:15 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
|
||||
* harbour/contrib/hbqt/generator/hbqtgen.prg
|
||||
* harbour/contrib/hbqt/tests/demoqt.prg
|
||||
+ Added demo code QTableWidget() and QTableWidgetItem() classes
|
||||
to show a grid control submitted by CarozoDeQuilmes.
|
||||
|
||||
2009-06-06 11:59 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com)
|
||||
* harbour/contrib/hbqt/Makefile_gen
|
||||
|
||||
|
||||
@@ -2508,15 +2508,17 @@ STATIC FUNCTION Build_Demo()
|
||||
aadd( txt_, ' ' )
|
||||
aadd( txt_, ' oLabel := QLabel():New( QT_PTROF( oWnd ) ) ' )
|
||||
aadd( txt_, ' oLabel:setText( "Testing Harbour + Qt" ) ' )
|
||||
aadd( txt_, ' oLabel:move( 200,100 ) ' )
|
||||
aadd( txt_, ' oLabel:move( 30,260 ) ' )
|
||||
aadd( txt_, ' oLabel:show() ' )
|
||||
aadd( txt_, ' ' )
|
||||
aadd( txt_, ' oBtn := QPushButton():new( QT_PTROF( oWnd ) ) ' )
|
||||
aadd( txt_, ' oBtn:setText( "Push Button" ) ' )
|
||||
aadd( txt_, ' oBtn:resize( 100,50 ) ' )
|
||||
aadd( txt_, ' oBtn:move( 200,150 ) ' )
|
||||
aadd( txt_, ' oBtn:move( 30,300 ) ' )
|
||||
aadd( txt_, ' oBtn:show() ' )
|
||||
aadd( txt_, ' ' )
|
||||
aadd( txt_, ' Build_Grid( oWnd ) ' )
|
||||
aadd( txt_, ' ' )
|
||||
aadd( txt_, ' oWnd:Show() ' )
|
||||
aadd( txt_, ' ' )
|
||||
aadd( txt_, ' RETURN ' )
|
||||
@@ -2814,6 +2816,36 @@ STATIC FUNCTION Build_Demo()
|
||||
aadd( txt_, ' ' )
|
||||
aadd( txt_, '/*----------------------------------------------------------------------*/ ' )
|
||||
aadd( txt_, ' ' )
|
||||
aadd( txt_, 'STATIC FUNCTION Build_Grid( oWnd ) ' )
|
||||
aadd( txt_, ' LOCAL oGrid, oBrushBackItem0x0, oBrushForeItem0x0, oGridItem0x0 ' )
|
||||
aadd( txt_, ' ' )
|
||||
aadd( txt_, ' oGrid := QTableWidget():new( QT_PTROF( oWnd ) ) ' )
|
||||
aadd( txt_, ' oGrid:setRowCount( 2 ) ' )
|
||||
aadd( txt_, ' oGrid:setColumnCount( 4 ) ' )
|
||||
aadd( txt_, ' // ' )
|
||||
aadd( txt_, ' oBrushBackItem0x0 := QBrush():new() ' )
|
||||
aadd( txt_, ' oBrushBackItem0x0:setStyle( 1 ) // Solid Color ' )
|
||||
aadd( txt_, ' oBrushBackItem0x0:setColor_1( 10 ) // http://doc.qtsoftware.com/4.5/qt.html#GlobalColor-enum ' )
|
||||
aadd( txt_, ' // ' )
|
||||
aadd( txt_, ' oBrushForeItem0x0 := QBrush():new() ' )
|
||||
aadd( txt_, ' oBrushForeItem0x0:setColor_1( 7 ) ' )
|
||||
aadd( txt_, ' // ' )
|
||||
aadd( txt_, ' oGridItem0x0 := QTableWidgetItem():new() ' )
|
||||
aadd( txt_, ' oGridItem0x0:setBackground( oBrushBackItem0x0:pPtr ) ' )
|
||||
aadd( txt_, ' oGridItem0x0:setForeground( oBrushForeItem0x0:pPtr ) ' )
|
||||
aadd( txt_, ' oGridItem0x0:setText( "Item 0x0" ) ' )
|
||||
aadd( txt_, ' // ' )
|
||||
aadd( txt_, ' oGrid:setItem( 0, 0, oGridItem0x0:pPtr ) ' )
|
||||
aadd( txt_, ' // ' )
|
||||
aadd( txt_, ' oGrid:Move( 30 , 50 ) ' )
|
||||
aadd( txt_, ' oGrid:ReSize( 550 , 200 ) ' )
|
||||
aadd( txt_, ' // ' )
|
||||
aadd( txt_, ' oGrid:Show() ' )
|
||||
aadd( txt_, ' ' )
|
||||
aadd( txt_, ' RETURN nil ' )
|
||||
aadd( txt_, ' ' )
|
||||
aadd( txt_, '/*----------------------------------------------------------------------*/ ' )
|
||||
aadd( txt_, ' ' )
|
||||
|
||||
RETURN CreateTarget( cFile, txt_ )
|
||||
|
||||
|
||||
@@ -119,15 +119,17 @@ PROCEDURE Main()
|
||||
|
||||
oLabel := QLabel():New( QT_PTROF( oWnd ) )
|
||||
oLabel:setText( "Testing Harbour + Qt" )
|
||||
oLabel:move( 200,100 )
|
||||
oLabel:move( 30,260 )
|
||||
oLabel:show()
|
||||
|
||||
oBtn := QPushButton():new( QT_PTROF( oWnd ) )
|
||||
oBtn:setText( "Push Button" )
|
||||
oBtn:resize( 100,50 )
|
||||
oBtn:move( 200,150 )
|
||||
oBtn:move( 30,300 )
|
||||
oBtn:show()
|
||||
|
||||
Build_Grid( oWnd )
|
||||
|
||||
oWnd:Show()
|
||||
|
||||
RETURN
|
||||
@@ -425,3 +427,33 @@ STATIC FUNCTION Dummies()
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
STATIC FUNCTION Build_Grid( oWnd )
|
||||
LOCAL oGrid, oBrushBackItem0x0, oBrushForeItem0x0, oGridItem0x0
|
||||
|
||||
oGrid := QTableWidget():new( QT_PTROF( oWnd ) )
|
||||
oGrid:setRowCount( 2 )
|
||||
oGrid:setColumnCount( 4 )
|
||||
//
|
||||
oBrushBackItem0x0 := QBrush():new()
|
||||
oBrushBackItem0x0:setStyle( 1 ) // Solid Color
|
||||
oBrushBackItem0x0:setColor_1( 10 ) // http://doc.qtsoftware.com/4.5/qt.html#GlobalColor-enum
|
||||
//
|
||||
oBrushForeItem0x0 := QBrush():new()
|
||||
oBrushForeItem0x0:setColor_1( 7 )
|
||||
//
|
||||
oGridItem0x0 := QTableWidgetItem():new()
|
||||
oGridItem0x0:setBackground( oBrushBackItem0x0:pPtr )
|
||||
oGridItem0x0:setForeground( oBrushForeItem0x0:pPtr )
|
||||
oGridItem0x0:setText( "Item 0x0" )
|
||||
//
|
||||
oGrid:setItem( 0, 0, oGridItem0x0:pPtr )
|
||||
//
|
||||
oGrid:Move( 30 , 50 )
|
||||
oGrid:ReSize( 550 , 200 )
|
||||
//
|
||||
oGrid:Show()
|
||||
|
||||
RETURN nil
|
||||
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user