Sync graphics item with matrix and shadow common parameters.

This commit is contained in:
Jim Evins
2013-12-05 19:45:39 -05:00
parent 385df72c9b
commit 52755383ed
3 changed files with 33 additions and 0 deletions
+6
View File
@@ -40,6 +40,9 @@ namespace glabels
pen.setWidthF( lineWidth() );
rectItem->setPen( pen );
updateGraphicsItemMatrix( rectItem );
updateGraphicsItemShadow( rectItem );
return rectItem;
}
@@ -58,6 +61,9 @@ namespace glabels
QPen pen( lineColorNode().color() );
pen.setWidthF( lineWidth() );
rectItem->setPen( pen );
updateGraphicsItemMatrix( rectItem );
updateGraphicsItemShadow( rectItem );
}
}
+23
View File
@@ -20,6 +20,8 @@
#include "LabelModelObject.h"
#include <QGraphicsDropShadowEffect>
namespace glabels
{
@@ -178,5 +180,26 @@ namespace glabels
emit changed();
}
void LabelModelObject::updateGraphicsItemMatrix( QGraphicsItem* graphicsItem )
{
graphicsItem->setTransform( mMatrix );
}
void LabelModelObject::updateGraphicsItemShadow( QGraphicsItem* graphicsItem )
{
QGraphicsDropShadowEffect *shadowEffect = new QGraphicsDropShadowEffect();
QColor color = mShadowColorNode.color();
color.setAlphaF( mShadowOpacity );
shadowEffect->setColor( color );
shadowEffect->setOffset( mShadowX, mShadowY );
shadowEffect->setBlurRadius( 0 );
graphicsItem->setGraphicsEffect( shadowEffect );
}
}
+4
View File
@@ -429,6 +429,10 @@ namespace glabels
virtual QGraphicsItem* createGraphicsItem() = 0;
virtual void updateGraphicsItem( QGraphicsItem* graphicsItem ) = 0;
protected:
void updateGraphicsItemMatrix( QGraphicsItem* graphicsItem );
void updateGraphicsItemShadow( QGraphicsItem* graphicsItem );
///////////////////////////////////////////////////////////////
// Private Members