Sync graphics item with matrix and shadow common parameters.
This commit is contained in:
@@ -40,6 +40,9 @@ namespace glabels
|
|||||||
pen.setWidthF( lineWidth() );
|
pen.setWidthF( lineWidth() );
|
||||||
rectItem->setPen( pen );
|
rectItem->setPen( pen );
|
||||||
|
|
||||||
|
updateGraphicsItemMatrix( rectItem );
|
||||||
|
updateGraphicsItemShadow( rectItem );
|
||||||
|
|
||||||
return rectItem;
|
return rectItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,6 +61,9 @@ namespace glabels
|
|||||||
QPen pen( lineColorNode().color() );
|
QPen pen( lineColorNode().color() );
|
||||||
pen.setWidthF( lineWidth() );
|
pen.setWidthF( lineWidth() );
|
||||||
rectItem->setPen( pen );
|
rectItem->setPen( pen );
|
||||||
|
|
||||||
|
updateGraphicsItemMatrix( rectItem );
|
||||||
|
updateGraphicsItemShadow( rectItem );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
|
|
||||||
#include "LabelModelObject.h"
|
#include "LabelModelObject.h"
|
||||||
|
|
||||||
|
#include <QGraphicsDropShadowEffect>
|
||||||
|
|
||||||
|
|
||||||
namespace glabels
|
namespace glabels
|
||||||
{
|
{
|
||||||
@@ -178,5 +180,26 @@ namespace glabels
|
|||||||
emit changed();
|
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 );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -429,6 +429,10 @@ namespace glabels
|
|||||||
virtual QGraphicsItem* createGraphicsItem() = 0;
|
virtual QGraphicsItem* createGraphicsItem() = 0;
|
||||||
virtual void updateGraphicsItem( QGraphicsItem* graphicsItem ) = 0;
|
virtual void updateGraphicsItem( QGraphicsItem* graphicsItem ) = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void updateGraphicsItemMatrix( QGraphicsItem* graphicsItem );
|
||||||
|
void updateGraphicsItemShadow( QGraphicsItem* graphicsItem );
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////
|
||||||
// Private Members
|
// Private Members
|
||||||
|
|||||||
Reference in New Issue
Block a user