From 3b61c3941d3be8b1a60ffb2a70c50735c6fef32c Mon Sep 17 00:00:00 2001 From: Pritpal Bedi Date: Wed, 25 Aug 2010 16:48:40 +0000 Subject: [PATCH] 2010-08-25 09:40 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) * contrib/hbide/hbide.qrc + contrib/hbide/resources/r-landscape.png + contrib/hbide/resources/r-portrait.png * contrib/hbqt/qtgui/qth/HBQGraphicsItem.qth * contrib/hbqt/qtgui/doc/en/class_hbqgraphicsitem.txt * contrib/hbqt/qtgui/g/HBQGraphicsItem.cpp * contrib/hbqt/qtgui/g/THBQGraphicsItem.prg * contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp * contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.h * contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp * contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.h * contrib/hbide/idereportsmanager.prg + Implemented: ideReports Manager: + Landscape and Portrait page orientation at design time. + Context-menu basics for objects on the page - scheduled to be expanded per type of object. --- harbour/ChangeLog | 21 ++ harbour/contrib/hbide/hbide.qrc | 2 + harbour/contrib/hbide/idereportsmanager.prg | 236 +++++++++++------- .../contrib/hbide/resources/r-landscape.png | Bin 0 -> 242 bytes .../contrib/hbide/resources/r-portrait.png | Bin 0 -> 244 bytes .../qtgui/doc/en/class_hbqgraphicsitem.txt | 1 + .../contrib/hbqt/qtgui/g/HBQGraphicsItem.cpp | 14 ++ .../contrib/hbqt/qtgui/g/THBQGraphicsItem.prg | 5 + .../hbqt/qtgui/hbqt_hbqgraphicsitem.cpp | 39 ++- .../contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.h | 3 + .../hbqt/qtgui/hbqt_hbqgraphicsscene.cpp | 14 ++ .../hbqt/qtgui/hbqt_hbqgraphicsscene.h | 1 + .../hbqt/qtgui/qth/HBQGraphicsItem.qth | 1 + 13 files changed, 252 insertions(+), 85 deletions(-) create mode 100644 harbour/contrib/hbide/resources/r-landscape.png create mode 100644 harbour/contrib/hbide/resources/r-portrait.png diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b373dbbc98..a588525963 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,27 @@ The license applies to all entries newer than 2009-04-28. */ +2010-08-25 09:40 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com) + * contrib/hbide/hbide.qrc + + contrib/hbide/resources/r-landscape.png + + contrib/hbide/resources/r-portrait.png + + * contrib/hbqt/qtgui/qth/HBQGraphicsItem.qth + * contrib/hbqt/qtgui/doc/en/class_hbqgraphicsitem.txt + * contrib/hbqt/qtgui/g/HBQGraphicsItem.cpp + * contrib/hbqt/qtgui/g/THBQGraphicsItem.prg + + * contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp + * contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.h + * contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp + * contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.h + + * contrib/hbide/idereportsmanager.prg + + Implemented: ideReports Manager: + + Landscape and Portrait page orientation at design time. + + Context-menu basics for objects on the page - scheduled + to be expanded per type of object. + 2010-08-25 16:24 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/package/harbour.spec ! fixed to work with current build system diff --git a/harbour/contrib/hbide/hbide.qrc b/harbour/contrib/hbide/hbide.qrc index 2d73224a96..0f9e865cd6 100644 --- a/harbour/contrib/hbide/hbide.qrc +++ b/harbour/contrib/hbide/hbide.qrc @@ -267,6 +267,8 @@ resources/tofront.png resources/r-page.png resources/r-report.png +resources/r-landscape.png +resources/r-portrait.png diff --git a/harbour/contrib/hbide/idereportsmanager.prg b/harbour/contrib/hbide/idereportsmanager.prg index 13602e4837..57f1dc00b2 100644 --- a/harbour/contrib/hbide/idereportsmanager.prg +++ b/harbour/contrib/hbide/idereportsmanager.prg @@ -157,6 +157,8 @@ CLASS IdeReportsManager INHERIT IdeObject METHOD getNextID( cType ) METHOD getImageOfType( cType ) METHOD updateObjectsTree( cType, cParent, cName, cSubType ) + METHOD contextMenuItem( p1, p2 ) + METHOD contextMenuScene( p1 ) ENDCLASS @@ -227,7 +229,9 @@ METHOD IdeReportsManager:destroy() /*----------------------------------------------------------------------*/ METHOD IdeReportsManager:show() + ::oReportsManagerDock:raise() + RETURN Self /*----------------------------------------------------------------------*/ @@ -350,6 +354,8 @@ METHOD IdeReportsManager:buildDesignReport() ::qScene:setRightMagnet( .t. ) ::qScene:setBottomMagnet( .t. ) + ::qLayoutD:setStretch( 1,1 ) + ::qWidget1:show() ::qWidget2:show() ::qWidget3:show() @@ -411,6 +417,9 @@ METHOD IdeReportsManager:execEvent( cEvent, p, p1, p2 ) qEvent := QGraphicsSceneDragDropEvent():from( p1 ) DO CASE + CASE p == 21105 // Context Menu Event + ::contextMenuScene( p1 ) + CASE p == QEvent_GraphicsSceneDragEnter qEvent:acceptProposedAction() @@ -461,6 +470,8 @@ METHOD IdeReportsManager:execEvent( cEvent, p, p1, p2 ) ELSE ::qCurGraphicsItem := NIL ENDIF + CASE p == 21105 // Context Menu Event + ::contextMenuItem( p1, p2 ) ENDCASE EXIT @@ -479,6 +490,12 @@ METHOD IdeReportsManager:execEvent( cEvent, p, p1, p2 ) ENDIF EXIT + CASE "buttonLandscape_clicked" + ::qScene:setOrientation( QPrinter_Landscape ) + EXIT + CASE "buttonPortrait_clicked" + ::qScene:setOrientation( QPrinter_Portrait ) + EXIT CASE "buttonRotateL_clicked" IF !empty( ::qCurGraphicsItem ) ::qCurGraphicsItem:rotate( -10 ) @@ -524,6 +541,54 @@ METHOD IdeReportsManager:execEvent( cEvent, p, p1, p2 ) /*----------------------------------------------------------------------*/ +METHOD IdeReportsManager:contextMenuScene( p1 ) + LOCAL qMenu, qEvent, pAct + + qEvent := QGraphicsSceneContextMenuEvent():from( p1 ) + + qMenu := QMenu():new( ::qView ) + qMenu:addAction( "Refresh" ) + qMenu:addAction( "Zoom+" ) + + pAct := qMenu:exec_1( qEvent:screenPos() ) + IF ! hbqt_isEmptyQtPointer( pAct ) + SWITCH ( QAction():configure( pAct ) ):text() + CASE "Refresh" + EXIT + CASE "Zoom+" + EXIT + ENDSWITCH + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeReportsManager:contextMenuItem( p1, p2 ) + LOCAL qMenu, qEvent, pAct + + HB_SYMBOL_UNUSED( p2 ) + + qEvent := QGraphicsSceneContextMenuEvent():from( p1 ) + + qMenu := QMenu():new() + qMenu:addAction( "Cut" ) + qMenu:addAction( "Copy" ) + + pAct := qMenu:exec_1( qEvent:screenPos() ) + IF ! hbqt_isEmptyQtPointer( pAct ) + SWITCH ( QAction():configure( pAct ) ):text() + CASE "Cut" + EXIT + CASE "Copy" + EXIT + ENDSWITCH + ENDIF + + RETURN Self + +/*----------------------------------------------------------------------*/ + METHOD IdeReportsManager:addObject( qPos, cType ) LOCAL oWidget, cName, nW, nH, qGrad, cCode, qStrList, i @@ -693,90 +758,6 @@ METHOD IdeReportsManager:buildStacks() /*----------------------------------------------------------------------*/ -METHOD IdeReportsManager:buildToolbar() - - ::qToolbar := IdeToolbar():new() - ::qToolbar:orientation := Qt_Horizontal - ::qToolbar:create( "ReportManager_Top_Toolbar" ) - - ::qToolbar:addToolButton( "New" , "New Report" , app_image( "new" ), {|| ::execEvent( "buttonNew_clicked" ) } ) - ::qToolbar:addToolButton( "Open" , "Open Report" , app_image( "open3" ), {|| ::execEvent( "buttonOpen_clicked" ) } ) - ::qToolbar:addToolButton( "Save" , "Save Report" , app_image( "save3" ), {|| ::execEvent( "buttonSave_clicked" ) } ) - ::qToolbar:addToolButton( "Close" , "Close Report" , app_image( "close3" ), {|| ::execEvent( "buttonClose_clicked" ) } ) - ::qToolbar:addToolButton( "Print" , "Print Report" , app_image( "print" ), {|| ::execEvent( "buttonPrint_clicked" ) } ) - ::qToolbar:addSeparator() - ::qToolbar:addToolButton( "ToBack" , "Push to back" , app_image( "toback" ), {|| ::execEvent( "buttonToBack_clicked" ) }, .f., .f. ) - ::qToolbar:addToolButton( "ToFront", "Bring to front", app_image( "tofront" ), {|| ::execEvent( "buttonToFront_clicked" ) }, .f., .f. ) - ::qToolbar:addSeparator() - ::qToolbar:addToolButton( "RotateL", "Rotate anti-clock wise", app_image( "unload_1" ), {|| ::execEvent( "buttonRotateL_clicked" ) }, .f., .f. ) - ::qToolbar:addToolButton( "RotateR", "Rotate clock wise" , app_image( "load_1" ), {|| ::execEvent( "buttonRotateR_clicked" ) }, .f., .f. ) - ::qToolbar:addSeparator() - - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD IdeReportsManager:buildToolbarAlign() - - ::qToolbarAlign := IdeToolbar():new() - ::qToolbarAlign:orientation := Qt_Horizontal - ::qToolbarAlign:create( "ReportManager_Top_Toolbar_Align" ) - - ::qToolbarAlign:addToolButton( "FontG" , "Font" , app_image( "f-generic" ), {|| ::execEvent( "button_clicked" ) }, .f., .f. ) - ::qToolbarAlign:addSeparator() - ::qToolbarAlign:addToolButton( "FontB" , "Text Bold" , app_image( "f-bold-1" ), {|| ::execEvent( "button_clicked" ) } ) - ::qToolbarAlign:addToolButton( "FontI" , "Text Italic" , app_image( "f-italic-1" ), {|| ::execEvent( "button_clicked" ) } ) - ::qToolbarAlign:addToolButton( "FontU" , "Text Underlined" , app_image( "f-underline-1" ), {|| ::execEvent( "button_clicked" ) } ) - ::qToolbarAlign:addToolButton( "FontS" , "Text Strikethrough", app_image( "f-strike-1" ), {|| ::execEvent( "button_clicked" ) } ) - ::qToolbarAlign:addSeparator() - ::qToolbarAlign:addToolButton( "JustL" , "Align left" , app_image( "f_align_left" ), {|| ::execEvent( "button_clicked" ) } ) - ::qToolbarAlign:addToolButton( "JustC" , "Align center" , app_image( "f_align_center" ), {|| ::execEvent( "button_clicked" ) } ) - ::qToolbarAlign:addToolButton( "JustR" , "Align right" , app_image( "f_align_right" ), {|| ::execEvent( "button_clicked" ) } ) - ::qToolbarAlign:addToolButton( "JustJ" , "Align justify" , app_image( "f_align_justify" ), {|| ::execEvent( "button_clicked" ) } ) - ::qToolbarAlign:addSeparator() - ::qToolbarAlign:addToolButton( "JustT" , "Align top" , app_image( "f_align_top" ), {|| ::execEvent( "button_clicked" ) } ) - ::qToolbarAlign:addToolButton( "JustM" , "Align middle" , app_image( "f_align_middle" ), {|| ::execEvent( "button_clicked" ) } ) - ::qToolbarAlign:addToolButton( "JustB" , "Align bottom" , app_image( "f_align_bottom" ), {|| ::execEvent( "button_clicked" ) } ) - ::qToolbarAlign:addSeparator() - ::qToolbarAlign:addToolButton( "BoxT" , "Box-frame top" , app_image( "f_box_top" ), {|| ::execEvent( "button_clicked" ) }, .t., .f. ) - ::qToolbarAlign:addToolButton( "BoxL" , "Box-frame left" , app_image( "f_box_left" ), {|| ::execEvent( "button_clicked" ) }, .t., .f. ) - ::qToolbarAlign:addToolButton( "BoxB" , "Box-frame bottom" , app_image( "f_box_bottom" ), {|| ::execEvent( "button_clicked" ) }, .t., .f. ) - ::qToolbarAlign:addToolButton( "BoxR" , "Box-frame right" , app_image( "f_box_right" ), {|| ::execEvent( "button_clicked" ) }, .t., .f. ) - ::qToolbarAlign:addSeparator() - ::qToolbarAlign:addToolButton( "BoxA" , "Box-frame all" , app_image( "f_box_all" ), {|| ::execEvent( "button_clicked" ) } ) - ::qToolbarAlign:addToolButton( "BoxP" , "No box-frame" , app_image( "f_box_plain" ), {|| ::execEvent( "button_clicked" ) } ) - ::qToolbarAlign:addToolButton( "BoxS" , "Box shadowed" , app_image( "f_box_shadow" ), {|| ::execEvent( "button_clicked" ) } ) - ::qToolbarAlign:addSeparator() - ::qToolbarAlign:addToolButton( "ZoomIn" , "Zoom In" , app_image( "zoomin3" ), {|| ::execEvent( "buttonZoom_clicked", 1 ) } ) - ::qToolbarAlign:addToolButton( "ZoomOut", "Zoom Out" , app_image( "zoomout3" ), {|| ::execEvent( "buttonZoom_clicked", 2 ) } ) - ::qToolbarAlign:addToolButton( "ZoomWYS", "Zoom WYSIWYG" , app_image( "zoomin" ), {|| ::execEvent( "buttonZoom_clicked", 3 ) } ) - ::qToolbarAlign:addToolButton( "ZoomOrg", "Zoom Original" , app_image( "zoomout" ), {|| ::execEvent( "buttonZoom_clicked", 4 ) } ) - ::qToolbarAlign:addSeparator() - ::qToolbarAlign:addToolButton( "Grid" , "Show Grid" , app_image( "grid" ), {|| ::execEvent( "buttonGrid_clicked", 4 ) }, .t., .f. ) - ::qToolbarAlign:addSeparator() - - ::qToolbarAlign:setItemChecked( "Grid", .t. ) - - RETURN Self - -/*----------------------------------------------------------------------*/ - -METHOD IdeReportsManager:buildToolbarLeft() - - ::qToolbarL := IdeToolbar():new() - ::qToolbarL:orientation := Qt_Vertical - ::qToolbarL:create( "ReportManager_Left_Toolbar" ) - - ::qToolbarL:addToolButton( "Image" , "Image" , app_image( "f-image" ), {|| ::execEvent( "buttonNew_clicked" ) }, .t., .t. ) - ::qToolbarL:addToolButton( "Chart" , "Chart" , app_image( "f_chart" ), {|| ::execEvent( "buttonNew_clicked" ) }, .t., .t. ) - ::qToolbarL:addToolButton( "Gradient", "Gradient", app_image( "f_gradient" ), {|| ::execEvent( "buttonNew_clicked" ) }, .t., .t. ) - ::qToolbarL:addToolButton( "Barcode" , "Barcode" , app_image( "f_barcode" ), {|| ::execEvent( "buttonNew_clicked" ) }, .t., .t. ) - ::qToolbarL:addToolButton( "Text" , "Text" , app_image( "text" ), {|| ::execEvent( "buttonNew_clicked" ) }, .t., .t. ) - - RETURN Self - -/*----------------------------------------------------------------------*/ - METHOD IdeReportsManager:buildStatusBar() LOCAL qLabel @@ -918,3 +899,90 @@ METHOD IdeReportsManager:fetchBarString( cCode, lCheck ) /*----------------------------------------------------------------------*/ +METHOD IdeReportsManager:buildToolbar() + + ::qToolbar := IdeToolbar():new() + ::qToolbar:orientation := Qt_Horizontal + ::qToolbar:create( "ReportManager_Top_Toolbar" ) + + ::qToolbar:addToolButton( "New" , "New Report" , app_image( "new" ), {|| ::execEvent( "buttonNew_clicked" ) } ) + ::qToolbar:addToolButton( "Open" , "Open Report" , app_image( "open3" ), {|| ::execEvent( "buttonOpen_clicked" ) } ) + ::qToolbar:addToolButton( "Save" , "Save Report" , app_image( "save3" ), {|| ::execEvent( "buttonSave_clicked" ) } ) + ::qToolbar:addToolButton( "Close" , "Close Report" , app_image( "close3" ), {|| ::execEvent( "buttonClose_clicked" ) } ) + ::qToolbar:addToolButton( "Print" , "Print Report" , app_image( "print" ), {|| ::execEvent( "buttonPrint_clicked" ) } ) + ::qToolbar:addSeparator() + ::qToolbar:addToolButton( "ToBack" , "Push to back" , app_image( "toback" ), {|| ::execEvent( "buttonToBack_clicked" ) }, .f., .f. ) + ::qToolbar:addToolButton( "ToFront", "Bring to front", app_image( "tofront" ), {|| ::execEvent( "buttonToFront_clicked" ) }, .f., .f. ) + ::qToolbar:addSeparator() + ::qToolbar:addToolButton( "RotateL", "Rotate anti-clock wise", app_image( "unload_1" ), {|| ::execEvent( "buttonRotateL_clicked" ) }, .f., .f. ) + ::qToolbar:addToolButton( "RotateR", "Rotate clock wise" , app_image( "load_1" ), {|| ::execEvent( "buttonRotateR_clicked" ) }, .f., .f. ) + ::qToolbar:addSeparator() + ::qToolbar:addToolButton( "Portrait" , "Portrait orientation" , app_image( "r-portrait" ), {|| ::execEvent( "buttonPortrait_clicked" ) }, .f., .f. ) + ::qToolbar:addToolButton( "Landscape", "Landscape orientation", app_image( "r-landscape" ), {|| ::execEvent( "buttonLandscape_clicked" ) }, .f., .f. ) + ::qToolbar:addSeparator() + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeReportsManager:buildToolbarAlign() + + ::qToolbarAlign := IdeToolbar():new() + ::qToolbarAlign:orientation := Qt_Horizontal + ::qToolbarAlign:create( "ReportManager_Top_Toolbar_Align" ) + + ::qToolbarAlign:addToolButton( "FontG" , "Font" , app_image( "f-generic" ), {|| ::execEvent( "button_clicked" ) }, .f., .f. ) + ::qToolbarAlign:addSeparator() + ::qToolbarAlign:addToolButton( "FontB" , "Text Bold" , app_image( "f-bold-1" ), {|| ::execEvent( "button_clicked" ) } ) + ::qToolbarAlign:addToolButton( "FontI" , "Text Italic" , app_image( "f-italic-1" ), {|| ::execEvent( "button_clicked" ) } ) + ::qToolbarAlign:addToolButton( "FontU" , "Text Underlined" , app_image( "f-underline-1" ), {|| ::execEvent( "button_clicked" ) } ) + ::qToolbarAlign:addToolButton( "FontS" , "Text Strikethrough", app_image( "f-strike-1" ), {|| ::execEvent( "button_clicked" ) } ) + ::qToolbarAlign:addSeparator() + ::qToolbarAlign:addToolButton( "JustL" , "Align left" , app_image( "f_align_left" ), {|| ::execEvent( "button_clicked" ) } ) + ::qToolbarAlign:addToolButton( "JustC" , "Align center" , app_image( "f_align_center" ), {|| ::execEvent( "button_clicked" ) } ) + ::qToolbarAlign:addToolButton( "JustR" , "Align right" , app_image( "f_align_right" ), {|| ::execEvent( "button_clicked" ) } ) + ::qToolbarAlign:addToolButton( "JustJ" , "Align justify" , app_image( "f_align_justify" ), {|| ::execEvent( "button_clicked" ) } ) + ::qToolbarAlign:addSeparator() + ::qToolbarAlign:addToolButton( "JustT" , "Align top" , app_image( "f_align_top" ), {|| ::execEvent( "button_clicked" ) } ) + ::qToolbarAlign:addToolButton( "JustM" , "Align middle" , app_image( "f_align_middle" ), {|| ::execEvent( "button_clicked" ) } ) + ::qToolbarAlign:addToolButton( "JustB" , "Align bottom" , app_image( "f_align_bottom" ), {|| ::execEvent( "button_clicked" ) } ) + ::qToolbarAlign:addSeparator() + ::qToolbarAlign:addToolButton( "BoxT" , "Box-frame top" , app_image( "f_box_top" ), {|| ::execEvent( "button_clicked" ) }, .t., .f. ) + ::qToolbarAlign:addToolButton( "BoxL" , "Box-frame left" , app_image( "f_box_left" ), {|| ::execEvent( "button_clicked" ) }, .t., .f. ) + ::qToolbarAlign:addToolButton( "BoxB" , "Box-frame bottom" , app_image( "f_box_bottom" ), {|| ::execEvent( "button_clicked" ) }, .t., .f. ) + ::qToolbarAlign:addToolButton( "BoxR" , "Box-frame right" , app_image( "f_box_right" ), {|| ::execEvent( "button_clicked" ) }, .t., .f. ) + ::qToolbarAlign:addSeparator() + ::qToolbarAlign:addToolButton( "BoxA" , "Box-frame all" , app_image( "f_box_all" ), {|| ::execEvent( "button_clicked" ) } ) + ::qToolbarAlign:addToolButton( "BoxP" , "No box-frame" , app_image( "f_box_plain" ), {|| ::execEvent( "button_clicked" ) } ) + ::qToolbarAlign:addToolButton( "BoxS" , "Box shadowed" , app_image( "f_box_shadow" ), {|| ::execEvent( "button_clicked" ) } ) + ::qToolbarAlign:addSeparator() + ::qToolbarAlign:addToolButton( "ZoomIn" , "Zoom In" , app_image( "zoomin3" ), {|| ::execEvent( "buttonZoom_clicked", 1 ) } ) + ::qToolbarAlign:addToolButton( "ZoomOut", "Zoom Out" , app_image( "zoomout3" ), {|| ::execEvent( "buttonZoom_clicked", 2 ) } ) + ::qToolbarAlign:addToolButton( "ZoomWYS", "Zoom WYSIWYG" , app_image( "zoomin" ), {|| ::execEvent( "buttonZoom_clicked", 3 ) } ) + ::qToolbarAlign:addToolButton( "ZoomOrg", "Zoom Original" , app_image( "zoomout" ), {|| ::execEvent( "buttonZoom_clicked", 4 ) } ) + ::qToolbarAlign:addSeparator() + ::qToolbarAlign:addToolButton( "Grid" , "Show Grid" , app_image( "grid" ), {|| ::execEvent( "buttonGrid_clicked", 4 ) }, .t., .f. ) + ::qToolbarAlign:addSeparator() + + ::qToolbarAlign:setItemChecked( "Grid", .t. ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + +METHOD IdeReportsManager:buildToolbarLeft() + + ::qToolbarL := IdeToolbar():new() + ::qToolbarL:orientation := Qt_Vertical + ::qToolbarL:create( "ReportManager_Left_Toolbar" ) + + ::qToolbarL:addToolButton( "Image" , "Image" , app_image( "f-image" ), {|| ::execEvent( "buttonNew_clicked" ) }, .t., .t. ) + ::qToolbarL:addToolButton( "Chart" , "Chart" , app_image( "f_chart" ), {|| ::execEvent( "buttonNew_clicked" ) }, .t., .t. ) + ::qToolbarL:addToolButton( "Gradient", "Gradient", app_image( "f_gradient" ), {|| ::execEvent( "buttonNew_clicked" ) }, .t., .t. ) + ::qToolbarL:addToolButton( "Barcode" , "Barcode" , app_image( "f_barcode" ), {|| ::execEvent( "buttonNew_clicked" ) }, .t., .t. ) + ::qToolbarL:addToolButton( "Text" , "Text" , app_image( "text" ), {|| ::execEvent( "buttonNew_clicked" ) }, .t., .t. ) + + RETURN Self + +/*----------------------------------------------------------------------*/ + diff --git a/harbour/contrib/hbide/resources/r-landscape.png b/harbour/contrib/hbide/resources/r-landscape.png new file mode 100644 index 0000000000000000000000000000000000000000..a99706782d7fadd881551beb3c7181d7165c3d29 GIT binary patch literal 242 zcmVu-1iVy*~{XL{W zumK^n(b@or)+7i~Kn=kHME5#G23X2m&C;sQ~1Yi&Oyupkq1>K+T?0g)X4gbd)Keu48|S sXT<>|0P)j(1b}-`Lu~P5asaCF0D!v9kQ8l8r~m)}07*qoM6N<$f}@pR^#A|> literal 0 HcmV?d00001 diff --git a/harbour/contrib/hbide/resources/r-portrait.png b/harbour/contrib/hbide/resources/r-portrait.png new file mode 100644 index 0000000000000000000000000000000000000000..088774d1fb80e341a423fb42a41b7c3cdd3979ed GIT binary patch literal 244 zcmV9C6+8I-Qj?;Pr~B*F~<>tx6f;RwVqge;&3vcFE zm;sO`;}5`&9XAUmfYIWv0HVD<;%yx@fLoyE0B*~rYC#2%bVw6` nQreal * :setToColorFactor( nToColorFactor ) -> NIL * :setBarValues( pList ) -> NIL + * :setLegendColorRectWidth( nLegendColorRectWidth ) -> NIL * * $DESCRIPTION$ * diff --git a/harbour/contrib/hbqt/qtgui/g/HBQGraphicsItem.cpp b/harbour/contrib/hbqt/qtgui/g/HBQGraphicsItem.cpp index eb4b1fd863..0571b0edcd 100644 --- a/harbour/contrib/hbqt/qtgui/g/HBQGraphicsItem.cpp +++ b/harbour/contrib/hbqt/qtgui/g/HBQGraphicsItem.cpp @@ -1018,6 +1018,20 @@ HB_FUNC( QT_HBQGRAPHICSITEM_SETBARVALUES ) } } +/* + * void setLegendColorRectWidth( int legendColorRectWidth ) + */ +HB_FUNC( QT_HBQGRAPHICSITEM_SETLEGENDCOLORRECTWIDTH ) +{ + HBQGraphicsItem * p = hbqt_par_HBQGraphicsItem( 1 ); + if( p ) + ( p )->setLegendColorRectWidth( hb_parni( 2 ) ); + else + { + HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_HBQGRAPHICSITEM_SETLEGENDCOLORRECTWIDTH FP=( p )->setLegendColorRectWidth( hb_parni( 2 ) ); p is NULL" ) ); + } +} + /*----------------------------------------------------------------------*/ #endif /* #if QT_VERSION >= 0x040500 */ diff --git a/harbour/contrib/hbqt/qtgui/g/THBQGraphicsItem.prg b/harbour/contrib/hbqt/qtgui/g/THBQGraphicsItem.prg index c3d69e7112..c731425762 100644 --- a/harbour/contrib/hbqt/qtgui/g/THBQGraphicsItem.prg +++ b/harbour/contrib/hbqt/qtgui/g/THBQGraphicsItem.prg @@ -129,6 +129,7 @@ CREATE CLASS HBQGraphicsItem INHERIT HbQtObjectHandler, QGraphicsItem METHOD toColorFactor() METHOD setToColorFactor( nToColorFactor ) METHOD setBarValues( pList ) + METHOD setLegendColorRectWidth( nLegendColorRectWidth ) ENDCLASS @@ -389,3 +390,7 @@ METHOD HBQGraphicsItem:setToColorFactor( nToColorFactor ) METHOD HBQGraphicsItem:setBarValues( pList ) RETURN Qt_HBQGraphicsItem_setBarValues( ::pPtr, hbqt_ptr( pList ) ) + +METHOD HBQGraphicsItem:setLegendColorRectWidth( nLegendColorRectWidth ) + RETURN Qt_HBQGraphicsItem_setLegendColorRectWidth( ::pPtr, nLegendColorRectWidth ) + diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp index 16b221febb..9788da1440 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp @@ -113,8 +113,8 @@ HBQGraphicsItem::HBQGraphicsItem( int type, QGraphicsItem * parent ) : QGraphics m_toColorFactor = 1.5; m_drawBorder = true; m_showGrid = true; + m_legendColorRectWidth = 5 / UNIT; -// m_barValues = NULL; } HBQGraphicsItem::~HBQGraphicsItem() @@ -477,10 +477,32 @@ void HBQGraphicsItem::setBarValues( const QStringList & barValues ) m_barValues = barValues; } +void HBQGraphicsItem::setLegendColorRectWidth( int legendColorRectWidth ) +{ + if( legendColorRectWidth < 1 ) + legendColorRectWidth = 1; + m_legendColorRectWidth = legendColorRectWidth; + update(); +} + /*----------------------------------------------------------------------*/ // Mouse Events /*----------------------------------------------------------------------*/ +void HBQGraphicsItem::contextMenuEvent( QGraphicsSceneContextMenuEvent * event ) +{ + if( block ){ + PHB_ITEM p1 = hb_itemPutNI( NULL, 21105 ); + PHB_ITEM p2 = hb_itemPutPtr( NULL, event ); + PHB_ITEM p3 = hb_itemPutC( NULL, objectName().toLatin1().data() ); + hb_vmEvalBlockV( block, 3, p1, p2, p3 ); + hb_itemRelease( p1 ); + hb_itemRelease( p2 ); + hb_itemRelease( p3 ); + } + QGraphicsItem::contextMenuEvent( event ); +} + void HBQGraphicsItem::mousePressEvent( QGraphicsSceneMouseEvent * event ) { QRectF_geometry = geometry(); @@ -1233,6 +1255,21 @@ void HBQGraphicsItem::drawBarChart( QPainter * painter, const QStyleOptionGraphi } x += barWidth + m_barsIdentation; } + #if 0 /* Legend */ + painter->fillRect( rect, brush() ); + painter->drawRect( rect ); + painter->translate( rect.topLeft() ); + qreal y = 1 / UNIT; + qreal vstep = ( rect.height() - y - 1 / UNIT * val.size() ) / val.size(); + foreach( _chartValue cv, val ) + { + painter->fillRect( QRectF( 1 / UNIT / 2, y, m_legendColorRectWidth, vstep ), QBrush( cv.color ) ); + painter->drawText( QRectF( 1 / UNIT + m_legendColorRectWidth, y, rect.width() - ( 1 / UNIT + m_legendColorRectWidth ), vstep ), + Qt::AlignVCenter | Qt::AlignLeft, cv.key ); + y += vstep + 1 / UNIT; + } + #endif + } /*----------------------------------------------------------------------*/ diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.h b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.h index 4c7efcabb5..48998122a2 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.h +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.h @@ -177,6 +177,7 @@ private: bool m_drawBorder; bool m_showGrid; QStringList m_barValues; + int m_legendColorRectWidth; QColor generateNextColor(); QRectF adjustOption( QPainter * painter, const QStyleOptionGraphicsItem * option ); @@ -203,6 +204,7 @@ protected: void mousePressEvent( QGraphicsSceneMouseEvent * event ); void mouseReleaseEvent( QGraphicsSceneMouseEvent * event ); void mouseMoveEvent( QGraphicsSceneMouseEvent * event ); + void contextMenuEvent( QGraphicsSceneContextMenuEvent * event ); public slots: @@ -271,6 +273,7 @@ public slots: qreal toColorFactor(); void setToColorFactor( qreal toColorFactor ); void setBarValues( const QStringList & list ); + void setLegendColorRectWidth( int legendColorRectWidth ); struct _chartValue { diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp index 1c1d2872a5..bb0d7f17a0 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp @@ -375,6 +375,20 @@ void HBQGraphicsScene::keyPressEvent( QKeyEvent * keyEvent ) // Drag & Drop /*----------------------------------------------------------------------*/ +void HBQGraphicsScene::contextMenuEvent( QGraphicsSceneContextMenuEvent * event ) +{ + #if 0 + if( block ){ + PHB_ITEM p1 = hb_itemPutNI( NULL, 21105 ); + PHB_ITEM p2 = hb_itemPutPtr( NULL, event ); + hb_vmEvalBlockV( block, 2, p1, p2 ); + hb_itemRelease( p1 ); + hb_itemRelease( p2 ); + } + #endif + QGraphicsScene::contextMenuEvent( event ); +} + void HBQGraphicsScene::dragEnterEvent( QGraphicsSceneDragDropEvent * event ) { if( block ) diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.h b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.h index 2acd630a90..6219e7f95b 100644 --- a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.h +++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.h @@ -123,6 +123,7 @@ public slots: virtual void setVerticalMagnet( bool magneted ); protected: + virtual void contextMenuEvent( QGraphicsSceneContextMenuEvent * event ); virtual void mouseMoveEvent( QGraphicsSceneMouseEvent * mouseEvent ); virtual void mousePressEvent( QGraphicsSceneMouseEvent *event ); virtual void mouseReleaseEvent( QGraphicsSceneMouseEvent * mouseEvent ); diff --git a/harbour/contrib/hbqt/qtgui/qth/HBQGraphicsItem.qth b/harbour/contrib/hbqt/qtgui/qth/HBQGraphicsItem.qth index e805d1e220..5f33eb5663 100644 --- a/harbour/contrib/hbqt/qtgui/qth/HBQGraphicsItem.qth +++ b/harbour/contrib/hbqt/qtgui/qth/HBQGraphicsItem.qth @@ -155,6 +155,7 @@ HB_FUNC( QT_HBQGRAPHICSITEM ) qreal toColorFactor() void setToColorFactor( qreal toColorFactor ) void setBarValues( const QStringList & list ) + void setLegendColorRectWidth( int legendColorRectWidth )