Refactor frame and markup code to use paths.

- CD frames are currently broken.
This commit is contained in:
Jim Evins
2015-08-12 01:20:52 -04:00
parent 0ad6caeeca
commit 721746007c
13 changed files with 110 additions and 164 deletions
+7 -8
View File
@@ -33,7 +33,6 @@ namespace libglabels
: mW(w), mH(h), mWaste(waste), Frame(id)
{
mPath.addEllipse( 0, 0, mW, mH );
mRotatedPath.addEllipse( 0, 0, mH, mW );
}
FrameEllipse::FrameEllipse( const FrameEllipse& other )
@@ -60,7 +59,7 @@ namespace libglabels
}
const QString FrameEllipse::sizeDescription( const Units *units ) const
const QString FrameEllipse::sizeDescription( const Units* units ) const
{
if ( units->id() == "in" )
{
@@ -96,21 +95,21 @@ namespace libglabels
}
const QPainterPath& FrameEllipse::path( bool isRotated ) const
const QPainterPath& FrameEllipse::path() const
{
return isRotated ? mRotatedPath : mPath;
return mPath;
}
QGraphicsItem* FrameEllipse::createMarginGraphicsItem( double size, const QPen& pen ) const
QPainterPath FrameEllipse::marginPath( double size ) const
{
double w = mW - 2*size;
double h = mH - 2*size;
QGraphicsEllipseItem* item = new QGraphicsEllipseItem( size, size, w, h );
item->setPen( pen );
QPainterPath path;
path.addEllipse( size, size, w, h );
return item;
return path;
}
}