diff --git a/harbour/ChangeLog b/harbour/ChangeLog
index d6ce076fcd..989138d5a2 100644
--- a/harbour/ChangeLog
+++ b/harbour/ChangeLog
@@ -16,6 +16,33 @@
The license applies to all entries newer than 2009-04-28.
*/
+2010-08-23 20:44 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
+ * contrib/hbqt/hbqt.ch
+ * contrib/hbqt/qtgui/doc/en/class_hbqgraphicsitem.txt
+ * contrib/hbqt/qtgui/g/HBQGraphicsItem.cpp
+ * contrib/hbqt/qtgui/g/THBQGraphicsItem.prg
+ * contrib/hbqt/qtgui/qth/HBQGraphicsItem.qth
+
+ * contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp
+ * contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.h
+ * contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp
+
+ * contrib/hbide/hbide.qrc
+ * contrib/hbide/resources/f-image.png
+ + contrib/hbide/resources/toback.png
+ + contrib/hbide/resources/tofront.png
+
+ * contrib/hbide/idereportsmanager.prg
+ + Advanced: ideReports Designer - many artifacts implemented:
+ * Synchronized "Objects" tree and objects on the "Page(s)".
+ Clicking either way is reflected to the other.
+ * Activated magnets - while dragging an object provides
+ guiding lines from other objects which are helpful in alignment.
+ * Corrected reszing behavior. Now handles are located with ease.
+ * Text display management improved.
+ * Added more methods to control futuristic features.
+ * Many other small improvements difficult to explain.
+
2010-08-23 10:32 UTC-0800 Pritpal Bedi (bedipritpal@hotmail.com)
* contrib/hbide/idereportsmanager.prg
+ Advanced: populated "Objects" tree with spreaded objects.
diff --git a/harbour/contrib/hbide/hbide.qrc b/harbour/contrib/hbide/hbide.qrc
index e1ee643cf0..fff5dd012a 100644
--- a/harbour/contrib/hbide/hbide.qrc
+++ b/harbour/contrib/hbide/hbide.qrc
@@ -263,6 +263,8 @@
resources/f-italic-1.png
resources/f-underline-1.png
resources/f-strike-1.png
+resources/toback.png
+resources/tofront.png
diff --git a/harbour/contrib/hbide/idereportsmanager.prg b/harbour/contrib/hbide/idereportsmanager.prg
index 6cc5d02d46..030bdb38e9 100644
--- a/harbour/contrib/hbide/idereportsmanager.prg
+++ b/harbour/contrib/hbide/idereportsmanager.prg
@@ -134,6 +134,7 @@ CLASS IdeReportsManager INHERIT IdeObject
DATA aItems INIT {}
DATA hItems INIT {=>}
DATA hObjTree INIT {=>}
+ DATA qCurGraphicsItem
METHOD new( oIde )
METHOD create( oIde )
@@ -291,7 +292,7 @@ METHOD IdeReportsManager:buildDesignReport()
::qPageL01Lay:addWidget( ::qTreeObjects )
::qTreeObjects:setHeaderHidden( .t. )
::qTreeObjects:setObjectName( "ObjectsTree" )
-
+ ::connect( ::qTreeObjects, "itemClicked(QTWItem)", {|p,p1| ::execEvent( "treeObjects_clicked", p, p1 ) } )
::qTabL1 := QTabWidget():new()
::qSplL:addWidget( ::qTabL1 )
@@ -338,6 +339,11 @@ METHOD IdeReportsManager:buildDesignReport()
::loadReport()
::qScene:zoomWYSIWYG()
+ //
+ ::qScene:setLeftMagnet( .t. )
+ ::qScene:setTopMagnet( .t. )
+ ::qScene:setRightMagnet( .t. )
+ ::qScene:setBottomMagnet( .t. )
::qWidget1:show()
::qWidget2:show()
@@ -425,7 +431,7 @@ METHOD IdeReportsManager:prepareReport()
/*----------------------------------------------------------------------*/
METHOD IdeReportsManager:execEvent( cEvent, p, p1, p2 )
- LOCAL qEvent, qMime
+ LOCAL qEvent, qMime, qItem
SWITCH cEvent
CASE "graphicsScene_block"
@@ -473,11 +479,35 @@ METHOD IdeReportsManager:execEvent( cEvent, p, p1, p2 )
EXIT
+ CASE "graphicsItem_block"
+ DO CASE
+ CASE p == 21101 // Object selected
+ IF hb_hHasKey( ::hObjTree, p1 )
+ ::qCurGraphicsItem := ::hObjTree[ p1 ]
+ ::qTreeObjects:setCurrentItem( ::qCurGraphicsItem )
+ ENDIF
+
+ ENDCASE
+ EXIT
+
+ CASE "treeObjects_clicked"
+ qItem := QTreeWidgetItem():from( p )
+ IF hb_hHasKey( ::hItems, qItem:text( 0 ) )
+ ::qScene:clearSelection()
+ ::hItems[ qItem:text( 0 ) ]:setSelected( .t. )
+ ENDIF
+ EXIT
+
CASE "tabBar_currentChanged"
IF !empty( ::qStack ) .AND. p < ::qStack:count()
::qStack:setCurrentIndex( p )
ENDIF
EXIT
+
+ CASE "buttonToBack_clicked"
+ EXIT
+ CASE "buttonToFront_clicked"
+ EXIT
CASE "buttonNew_clicked"
EXIT
CASE "buttonOpen_clicked"
@@ -518,8 +548,8 @@ METHOD IdeReportsManager:addObject( qPos, cType )
CASE "Image"
oWidget := HBQGraphicsItem():new( HBQT_GRAPHICSITEM_PICTURE )
nW := 300 ; nH := 300
- oWidget:setBrush( QBrush():new( "QColor", QColor():new( 255,180,112 ) ) )
oWidget:setPixmap( QPixmap():new( hbide_image( "hbide" ) ) )
+ oWidget:setBorderWidth( 2 )
EXIT
CASE "Chart"
oWidget := HBQGraphicsItem():new( HBQT_GRAPHICSITEM_ELLIPSE )
@@ -527,9 +557,11 @@ METHOD IdeReportsManager:addObject( qPos, cType )
oWidget:setBrush( QBrush():new( "QColor", QColor():new( 200,114,127 ) ) )
EXIT
CASE "Gradient"
- qGrad := QLinearGradient():new( 0, 0, 100, 100 )
+ qGrad := QLinearGradient():new()// 0, 0, 1, 1 )
qGrad:setColorAt( 0, QColor():new( 195,225,255 ) )
- qGrad:setColorAt( 1, QColor():new( Qt_black ) )
+ //qGrad:setColorAt( 1, ( QColor():new( 195,225,255 ) ):darker( 150 ) )
+ qGrad:setColorAt( 1, ( QColor():new( Qt_darkBlue ) ):darker( 150 ) )
+ qGrad:setCoordinateMode( QGradient_StretchToDeviceMode )
oWidget := HBQGraphicsItem():new( HBQT_GRAPHICSITEM_RECT )
nW := 300 ; nH := 50
@@ -549,8 +581,10 @@ METHOD IdeReportsManager:addObject( qPos, cType )
EXIT
ENDSWITCH
+ oWidget:setObjectType( cType )
+ oWidget:setObjectName( cName )
oWidget:setTooltip( cName )
- oWidget:hbSetBlock( {|p,p1,p2| ::execEvent( "graphicsPaper_block", p, p1, p2 ) } )
+ oWidget:hbSetBlock( {|p,p1,p2| ::execEvent( "graphicsItem_block", p, p1, p2 ) } )
::qScene:addItem( oWidget )
@@ -573,9 +607,11 @@ METHOD IdeReportsManager:addField( qPos, cAlias, cField )
oWidget := HBQGraphicsItem():new( HBQT_GRAPHICSITEM_SIMPLETEXT )
oWidget:setText( cName )
- oWidget:hbSetBlock( {|p,p1,p2| ::execEvent( "graphicsPaper_block", p, p1, p2 ) } )
+ oWidget:hbSetBlock( {|p,p1,p2| ::execEvent( "graphicsItem_block", p, p1, p2 ) } )
oWidget:setGeometry( QRectF():new( 0, 0, nW, nH ) )
oWidget:setTooltip( cName )
+ oWidget:setObjectType( "Field" )
+ oWidget:setObjectName( cName )
::qScene:addItem( oWidget )
@@ -635,6 +671,9 @@ METHOD IdeReportsManager:buildToolbar()
::qToolbar:addToolButton( "Close", "Close Report", hbide_image( "close3" ), {|| ::execEvent( "buttonClose_clicked" ) } )
::qToolbar:addToolButton( "Print", "Print Report", hbide_image( "print" ), {|| ::execEvent( "buttonPrint_clicked" ) } )
::qToolbar:addSeparator()
+ ::qToolbar:addToolButton( "ToBack" , "Push to back" , hbide_image( "toback" ), {|| ::execEvent( "buttonToBack_clicked" ) }, .f., .f. )
+ ::qToolbar:addToolButton( "ToFront", "Bring to front", hbide_image( "tofront"), {|| ::execEvent( "buttonToFront_clicked" ) }, .f., .f. )
+ ::qToolbar:addSeparator()
RETURN Self
@@ -662,10 +701,10 @@ METHOD IdeReportsManager:buildToolbarAlign()
::qToolbarAlign:addToolButton( "JustM" , "Align middle" , hbide_image( "f_align_middle" ), {|| ::execEvent( "button_clicked" ) } )
::qToolbarAlign:addToolButton( "JustB" , "Align bottom" , hbide_image( "f_align_bottom" ), {|| ::execEvent( "button_clicked" ) } )
::qToolbarAlign:addSeparator()
- ::qToolbarAlign:addToolButton( "BoxT" , "Box-frame top" , hbide_image( "f_box_top" ), {|| ::execEvent( "button_clicked" ) } )
- ::qToolbarAlign:addToolButton( "BoxL" , "Box-frame left" , hbide_image( "f_box_left" ), {|| ::execEvent( "button_clicked" ) } )
- ::qToolbarAlign:addToolButton( "BoxB" , "Box-frame bottom" , hbide_image( "f_box_bottom" ), {|| ::execEvent( "button_clicked" ) } )
- ::qToolbarAlign:addToolButton( "BoxR" , "Box-frame right" , hbide_image( "f_box_right" ), {|| ::execEvent( "button_clicked" ) } )
+ ::qToolbarAlign:addToolButton( "BoxT" , "Box-frame top" , hbide_image( "f_box_top" ), {|| ::execEvent( "button_clicked" ) }, .t., .f. )
+ ::qToolbarAlign:addToolButton( "BoxL" , "Box-frame left" , hbide_image( "f_box_left" ), {|| ::execEvent( "button_clicked" ) }, .t., .f. )
+ ::qToolbarAlign:addToolButton( "BoxB" , "Box-frame bottom" , hbide_image( "f_box_bottom" ), {|| ::execEvent( "button_clicked" ) }, .t., .f. )
+ ::qToolbarAlign:addToolButton( "BoxR" , "Box-frame right" , hbide_image( "f_box_right" ), {|| ::execEvent( "button_clicked" ) }, .t., .f. )
::qToolbarAlign:addSeparator()
::qToolbarAlign:addToolButton( "BoxA" , "Box-frame all" , hbide_image( "f_box_all" ), {|| ::execEvent( "button_clicked" ) } )
::qToolbarAlign:addToolButton( "BoxP" , "No box-frame" , hbide_image( "f_box_plain" ), {|| ::execEvent( "button_clicked" ) } )
@@ -727,5 +766,3 @@ METHOD IdeReportsManager:buildStatusBar()
RETURN Self
/*----------------------------------------------------------------------*/
-
-
diff --git a/harbour/contrib/hbide/resources/f-image.png b/harbour/contrib/hbide/resources/f-image.png
index 68da5027cf..bba8ccc5c0 100644
Binary files a/harbour/contrib/hbide/resources/f-image.png and b/harbour/contrib/hbide/resources/f-image.png differ
diff --git a/harbour/contrib/hbide/resources/toback.png b/harbour/contrib/hbide/resources/toback.png
new file mode 100644
index 0000000000..320abbcac6
Binary files /dev/null and b/harbour/contrib/hbide/resources/toback.png differ
diff --git a/harbour/contrib/hbide/resources/tofront.png b/harbour/contrib/hbide/resources/tofront.png
new file mode 100644
index 0000000000..24c23aa794
Binary files /dev/null and b/harbour/contrib/hbide/resources/tofront.png differ
diff --git a/harbour/contrib/hbqt/hbqt.ch b/harbour/contrib/hbqt/hbqt.ch
index 777913f0b5..4f13c31f08 100644
--- a/harbour/contrib/hbqt/hbqt.ch
+++ b/harbour/contrib/hbqt/hbqt.ch
@@ -2409,6 +2409,20 @@
#define QGraphicsSceneContextMenuEvent_Keyboard 1
#define QGraphicsSceneContextMenuEvent_Other 2
+#define QGradient_LogicalMode 0 // This is the default mode. The gradient coordinates are specified logical space just like the object coordinates.
+#define QGradient_StretchToDeviceMode 1 // In this mode the gradient coordinates are relative to the bounding rectangle of the paint device, with (0,0) in the top left corner, and (1,1) in the bottom right corner of the paint device.
+#define QGradient_ObjectBoundingMode 2 // In this mode the gradient coordinates are relative to the bounding rectangle of the object being drawn, with (0,0) in the top left corner, and (1,1) in the bottom right corner of the object's bounding rectangle.
+
+#define QGradient_PadSpread 0 // The area is filled with the closest stop color. This is the default.
+#define QGradient_RepeatSpread 2 // The gradient is repeated outside the gradient area.
+#define QGradient_ReflectSpread 1 // The gradient is reflected outside the gradient area.
+
+#define QGradient_LinearGradient 0 // Interpolates colors between start and end points (QLinearGradient).
+#define QGradient_RadialGradient 1 // Interpolate colors between a focal point and end points on a circle surrounding it (QRadialGradient).
+#define QGradient_ConicalGradient 2 // Interpolate colors around a center point (QConicalGradient).
+#define QGradient_NoGradient 3 // No gradient is used.
+
+
/*----------------------------------------------------------------------*/
#endif
diff --git a/harbour/contrib/hbqt/qtgui/doc/en/class_hbqgraphicsitem.txt b/harbour/contrib/hbqt/qtgui/doc/en/class_hbqgraphicsitem.txt
index 09664ce207..d128b410b1 100644
--- a/harbour/contrib/hbqt/qtgui/doc/en/class_hbqgraphicsitem.txt
+++ b/harbour/contrib/hbqt/qtgui/doc/en/class_hbqgraphicsitem.txt
@@ -51,6 +51,8 @@
* :setGeometry( pRect ) -> NIL
* :objectType() -> cQString
* :setObjectType( cType ) -> NIL
+ * :objectName() -> cQString
+ * :setObjectName( cName ) -> NIL
* :text() -> cQString
* :setText( cType ) -> NIL
* :paintType() -> nInt
@@ -73,6 +75,8 @@
* :setTextFlags( nTextFlags ) -> NIL
* :resizeFlags() -> nInt
* :setResizeFlags( nResizeFlags ) -> NIL
+ * :resizeHandle() -> nInt
+ * :setResizeHandle( nResizeHandle ) -> NIL
*
* $DESCRIPTION$
*
diff --git a/harbour/contrib/hbqt/qtgui/g/HBQGraphicsItem.cpp b/harbour/contrib/hbqt/qtgui/g/HBQGraphicsItem.cpp
index a578fceae4..0f9a2794c9 100644
--- a/harbour/contrib/hbqt/qtgui/g/HBQGraphicsItem.cpp
+++ b/harbour/contrib/hbqt/qtgui/g/HBQGraphicsItem.cpp
@@ -500,6 +500,34 @@ HB_FUNC( QT_HBQGRAPHICSITEM_SETOBJECTTYPE )
}
}
+/*
+ * QString objectName()
+ */
+HB_FUNC( QT_HBQGRAPHICSITEM_OBJECTNAME )
+{
+ HBQGraphicsItem * p = hbqt_par_HBQGraphicsItem( 1 );
+ if( p )
+ hb_retc( ( p )->objectName().toAscii().data() );
+ else
+ {
+ HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_HBQGRAPHICSITEM_OBJECTNAME FP=hb_retc( ( p )->objectName().toAscii().data() ); p is NULL" ) );
+ }
+}
+
+/*
+ * void setObjectName( const QString & name )
+ */
+HB_FUNC( QT_HBQGRAPHICSITEM_SETOBJECTNAME )
+{
+ HBQGraphicsItem * p = hbqt_par_HBQGraphicsItem( 1 );
+ if( p )
+ ( p )->setObjectName( hbqt_par_QString( 2 ) );
+ else
+ {
+ HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_HBQGRAPHICSITEM_SETOBJECTNAME FP=( p )->setObjectName( hbqt_par_QString( 2 ) ); p is NULL" ) );
+ }
+}
+
/*
* QString text()
*/
@@ -808,6 +836,34 @@ HB_FUNC( QT_HBQGRAPHICSITEM_SETRESIZEFLAGS )
}
}
+/*
+ * int resizeHandle()
+ */
+HB_FUNC( QT_HBQGRAPHICSITEM_RESIZEHANDLE )
+{
+ HBQGraphicsItem * p = hbqt_par_HBQGraphicsItem( 1 );
+ if( p )
+ hb_retni( ( p )->resizeHandle() );
+ else
+ {
+ HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_HBQGRAPHICSITEM_RESIZEHANDLE FP=hb_retni( ( p )->resizeHandle() ); p is NULL" ) );
+ }
+}
+
+/*
+ * void setResizeHandle( int resizeHandle )
+ */
+HB_FUNC( QT_HBQGRAPHICSITEM_SETRESIZEHANDLE )
+{
+ HBQGraphicsItem * p = hbqt_par_HBQGraphicsItem( 1 );
+ if( p )
+ ( p )->setResizeHandle( hb_parni( 2 ) );
+ else
+ {
+ HB_TRACE( HB_TR_DEBUG, ( "............................... F=QT_HBQGRAPHICSITEM_SETRESIZEHANDLE FP=( p )->setResizeHandle( 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 0ad03df980..c9f0dbf6cd 100644
--- a/harbour/contrib/hbqt/qtgui/g/THBQGraphicsItem.prg
+++ b/harbour/contrib/hbqt/qtgui/g/THBQGraphicsItem.prg
@@ -92,6 +92,8 @@ CREATE CLASS HBQGraphicsItem INHERIT HbQtObjectHandler, QGraphicsItem
METHOD setGeometry( pRect )
METHOD objectType()
METHOD setObjectType( cType )
+ METHOD objectName()
+ METHOD setObjectName( cName )
METHOD text()
METHOD setText( cType )
METHOD paintType()
@@ -114,6 +116,8 @@ CREATE CLASS HBQGraphicsItem INHERIT HbQtObjectHandler, QGraphicsItem
METHOD setTextFlags( nTextFlags )
METHOD resizeFlags()
METHOD setResizeFlags( nResizeFlags )
+ METHOD resizeHandle()
+ METHOD setResizeHandle( nResizeHandle )
ENDCLASS
@@ -227,6 +231,14 @@ METHOD HBQGraphicsItem:setObjectType( cType )
RETURN Qt_HBQGraphicsItem_setObjectType( ::pPtr, cType )
+METHOD HBQGraphicsItem:objectName()
+ RETURN Qt_HBQGraphicsItem_objectName( ::pPtr )
+
+
+METHOD HBQGraphicsItem:setObjectName( cName )
+ RETURN Qt_HBQGraphicsItem_setObjectName( ::pPtr, cName )
+
+
METHOD HBQGraphicsItem:text()
RETURN Qt_HBQGraphicsItem_text( ::pPtr )
@@ -314,3 +326,11 @@ METHOD HBQGraphicsItem:resizeFlags()
METHOD HBQGraphicsItem:setResizeFlags( nResizeFlags )
RETURN Qt_HBQGraphicsItem_setResizeFlags( ::pPtr, nResizeFlags )
+
+METHOD HBQGraphicsItem:resizeHandle()
+ RETURN Qt_HBQGraphicsItem_resizeHandle( ::pPtr )
+
+
+METHOD HBQGraphicsItem:setResizeHandle( nResizeHandle )
+ RETURN Qt_HBQGraphicsItem_setResizeHandle( ::pPtr, nResizeHandle )
+
diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp
index efee470d71..9d301c2583 100644
--- a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp
+++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.cpp
@@ -49,6 +49,11 @@
* If you do not wish that, delete this exception notice.
*
*/
+ /***************************************************************************
+ * The parts of this source are borrowed and adopted from eXaro project *
+ * Copyright (C) 2008 by BogDan Vatra *
+ * bog_dan_ro@yahoo.com *
+ ***************************************************************************/
#include "hbqt.h"
#include "hbapiitm.h"
@@ -92,6 +97,8 @@ HBQGraphicsItem::HBQGraphicsItem( int type, QGraphicsItem * parent ) : QGraphics
setFlags( QGraphicsItem::ItemIsSelectable );
/* Picture */
+ m_textFlags = Qt::AlignCenter;
+
m_paintType = HBQT_GRAPHICSITEM_RESIZE_PICTURE_TO_ITEM_KEEP_ASPECT_RATIO;
m_frameType = HBQT_GRAPHICSITEM_IMAGE_NO_FRAME;
m_textColor = Qt::black;
@@ -134,6 +141,15 @@ void HBQGraphicsItem::setObjectType( const QString & type )
QString_objectType = type;
}
+QString HBQGraphicsItem::objectName()
+{
+ return QString_objectName;
+}
+void HBQGraphicsItem::setObjectName( const QString & name )
+{
+ QString_objectName = name;
+}
+
QBrush HBQGraphicsItem::brush()
{
return QBrush_brush;
@@ -368,6 +384,23 @@ void HBQGraphicsItem::setResizeFlags( int resizeFlags )
iResizeFlags = resizeFlags;
}
+int HBQGraphicsItem::resizeHandle()
+{
+ return iResizeHandle;
+}
+void HBQGraphicsItem::setResizeHandle( int resizeHandle )
+{
+ iResizeHandle = resizeHandle;
+#if 0
+ if( m_minWidth < m_resizeHandle * 2 + 1 )
+ m_minWidth = m_resizeHandle * 2 + 1;
+
+ if( m_minHeight < m_resizeHandle * 2 + 1 )
+ m_minHeight = m_resizeHandle * 2 + 1;
+#endif
+ update( boundingRect() );
+}
+
/*----------------------------------------------------------------------*/
// Mouse Events
/*----------------------------------------------------------------------*/
@@ -375,7 +408,7 @@ void HBQGraphicsItem::setResizeFlags( int resizeFlags )
void HBQGraphicsItem::mousePressEvent( QGraphicsSceneMouseEvent * event )
{
QRectF_geometry = geometry();
-
+#if 0 /* Control via user interaction - bring to front - push to back */
foreach( QGraphicsItem * item, scene()->items() )
{
if( item->zValue() == 1 ){
@@ -386,6 +419,7 @@ void HBQGraphicsItem::mousePressEvent( QGraphicsSceneMouseEvent * event )
if( objectType() == ( QString ) "Page" ){
setZValue( 0 );
}
+#endif
if( event->buttons() == Qt::LeftButton ){
iResizeMode = determineResizeMode( event->pos() );
@@ -404,8 +438,13 @@ void HBQGraphicsItem::mousePressEvent( QGraphicsSceneMouseEvent * event )
QGraphicsItem::mousePressEvent( event );
if( event->buttons() == Qt::LeftButton ){
+ // emit( itemSelected( this, event->pos() ) );
if( block ){
- // Inform if selection is made etc. Try to keep it simple.
+ PHB_ITEM p1 = hb_itemPutNI( NULL, 21101 );
+ PHB_ITEM p2 = hb_itemPutC( NULL, objectName().toLatin1().data() );
+ hb_vmEvalBlockV( block, 2, p1, p2 );
+ hb_itemRelease( p1 );
+ hb_itemRelease( p2 );
}
}
}
@@ -417,7 +456,10 @@ void HBQGraphicsItem::mouseReleaseEvent( QGraphicsSceneMouseEvent * event )
QRectF nGeometry = geometry();
if( nGeometry != QRectF_geometry ){
- // emit( geometryChanged( this, nGeometry, oGeometry ) );
+ // emit( geometryChanged( this, nGeometry, QRectF_geometry ) );
+ if( block ){
+ // Inform geometry is changed
+ }
}
}
@@ -440,9 +482,11 @@ void HBQGraphicsItem::mouseMoveEvent( QGraphicsSceneMouseEvent * event )
setHeight( height() + event->lastScenePos().y() - event->scenePos().y() );
}
if( iResizeMode & RESIZE_MODE_RIGHT ){
+ scene()->invalidate( geometry() );
setWidth( ( int ) ( width() + event->scenePos().x() - event->lastScenePos().x() ) );
}
if( iResizeMode & RESIZE_MODE_BOTTOM ){
+ scene()->invalidate( geometry() );
setHeight( ( int ) ( height() + event->scenePos().y() - event->lastScenePos().y() ) );
}
if( width() < 5 ){
@@ -469,10 +513,10 @@ int HBQGraphicsItem::determineResizeMode( const QPointF & pos )
int resizeModes = resizeFlags();
int mode = RESIZE_MODE_FIXED;
- QRectF topRect( 0, 0, width(), 2 );
- QRectF leftRect( 0, 0, 2, height() );
- QRectF bottomRect( 0, height() - 2, width(), 2 );
- QRectF rightRect( width() - 2, 0, width(), height() );
+ QRectF topRect( 0, 0, width(), iResizeHandle );
+ QRectF leftRect( 0, 0, iResizeHandle, height() );
+ QRectF bottomRect( 0, height() - iResizeHandle, width(), iResizeHandle );
+ QRectF rightRect( width() - iResizeHandle, 0, width(), height() );
if( resizeModes & RESIZE_MODE_LEFT && leftRect.contains( pos ) ){
mode |= RESIZE_MODE_LEFT;
@@ -710,11 +754,12 @@ void HBQGraphicsItem::drawSelection( QPainter * painter, QRectF rect )
if( isSelected() )
{
QBrush a;
- a.setColor( QColor( 200,0,0,150 ) );
+ //a.setColor( QColor( 200,0,0,150 ) );
+ a.setColor( QColor( 255,0,0 ) );
a.setStyle( Qt::SolidPattern );
if( bDrawSelectionBorder )
{
- QPen p( Qt::DashDotDotLine );
+ QPen p( Qt::DashLine );
p.setBrush( a );
painter->setPen( p );
painter->drawRect( rect );
diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.h b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.h
index 4626d77f19..28757a6528 100644
--- a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.h
+++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsitem.h
@@ -157,6 +157,7 @@ private:
int iStartAngle;
int iSpanAngle;
QString QString_objectType;
+ QString QString_objectName;
QString QString_text;
/* Image */
@@ -221,6 +222,8 @@ public slots:
void setGeometry( const QRectF & rect );
QString objectType();
void setObjectType( const QString & type );
+ QString objectName();
+ void setObjectName( const QString & name );
QString text();
void setText( const QString & text );
@@ -244,6 +247,8 @@ public slots:
void setTextFlags( int textFlags );
int resizeFlags();
void setResizeFlags( int resizeFlags );
+ int resizeHandle();
+ void setResizeHandle( int resizeHandle );
};
diff --git a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp
index d2f49eab06..1c1d2872a5 100644
--- a/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp
+++ b/harbour/contrib/hbqt/qtgui/hbqt_hbqgraphicsscene.cpp
@@ -50,6 +50,12 @@
*
*/
+ /***************************************************************************
+ * The parts of this source are borrowed and adopted from eXaro project *
+ * Copyright (C) 2008 by BogDan Vatra *
+ * bog_dan_ro@yahoo.com *
+ ***************************************************************************/
+
#include "hbqt.h"
#include "hbapiitm.h"
#include "hbvm.h"
@@ -595,18 +601,16 @@ void HBQGraphicsScene::drawMagnets( HBQGraphicsItem * item )
if ( ! m_magnets )
return;
- item->setToolTip( tr( "Press Ctrl key to ignore magnets when dragging the object" ) );
-
QPen p;
p.setWidth( 3 );
- p.setColor( Qt::red );
+ p.setColor( Qt::cyan );
p.setStyle( Qt::DotLine );
foreach( QGraphicsItem * it, items() )
{
HBQGraphicsItem * ite = dynamic_cast< HBQGraphicsItem * >( it );
- if( ! ite || ! item->parentItem() || ite == item )
+ if( ! ite || ite == item )
continue;
if( ( m_magnets & Left ) && abs( item->mapToScene( QPointF( 0, 0 ) ).x() - ite->mapToScene( QPointF( 0, 0 ) ).x() ) <= m_magnetArea )
diff --git a/harbour/contrib/hbqt/qtgui/qth/HBQGraphicsItem.qth b/harbour/contrib/hbqt/qtgui/qth/HBQGraphicsItem.qth
index 283562b85d..f420159916 100644
--- a/harbour/contrib/hbqt/qtgui/qth/HBQGraphicsItem.qth
+++ b/harbour/contrib/hbqt/qtgui/qth/HBQGraphicsItem.qth
@@ -116,6 +116,8 @@ HB_FUNC( QT_HBQGRAPHICSITEM )
void setGeometry( const QRectF & rect )
QString objectType()
void setObjectType( const QString & type )
+ QString objectName()
+ void setObjectName( const QString & name )
QString text()
void setText( const QString & type )
@@ -139,6 +141,8 @@ HB_FUNC( QT_HBQGRAPHICSITEM )
void setTextFlags( int textFlags )
int resizeFlags()
void setResizeFlags( int resizeFlags )
+ int resizeHandle()
+ void setResizeHandle( int resizeHandle )