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.
This commit is contained in:
Pritpal Bedi
2010-08-25 16:48:40 +00:00
parent adba3db882
commit 3b61c3941d
13 changed files with 252 additions and 85 deletions

View File

@@ -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

View File

@@ -267,6 +267,8 @@
<file>resources/tofront.png</file>
<file>resources/r-page.png</file>
<file>resources/r-report.png</file>
<file>resources/r-landscape.png</file>
<file>resources/r-portrait.png</file>
</qresource>
</RCC>

View File

@@ -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
/*----------------------------------------------------------------------*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 242 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

View File

@@ -88,6 +88,7 @@
* :toColorFactor() -> nQreal
* :setToColorFactor( nToColorFactor ) -> NIL
* :setBarValues( pList ) -> NIL
* :setLegendColorRectWidth( nLegendColorRectWidth ) -> NIL
*
* $DESCRIPTION$
*

View File

@@ -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 */

View File

@@ -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 )

View File

@@ -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
}
/*----------------------------------------------------------------------*/

View File

@@ -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
{

View File

@@ -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 )

View File

@@ -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 );

View File

@@ -155,6 +155,7 @@ HB_FUNC( QT_HBQGRAPHICSITEM )
qreal toColorFactor()
void setToColorFactor( qreal toColorFactor )
void setBarValues( const QStringList & list )
void setLegendColorRectWidth( int legendColorRectWidth )
</PROTOS>