Prettied up SimplePreview.
This commit is contained in:
+13
-6
@@ -29,13 +29,15 @@ namespace
|
|||||||
{
|
{
|
||||||
const QColor paperColor( 255, 255, 255 );
|
const QColor paperColor( 255, 255, 255 );
|
||||||
const QColor paperOutlineColor( 0, 0, 0 );
|
const QColor paperOutlineColor( 0, 0, 0 );
|
||||||
|
const double paperOutlineWidthPixels = 1;
|
||||||
|
|
||||||
const QColor shadowColor( 64, 64, 64 );
|
const QColor shadowColor( 64, 64, 64 );
|
||||||
const double shadowOffset = 3;
|
const double shadowOffsetPixels = 3;
|
||||||
const double shadowRadius = 12;
|
const double shadowRadiusPixels = 12;
|
||||||
|
|
||||||
const QColor labelColor( 242, 242, 242 );
|
const QColor labelColor( 255, 255, 255 );
|
||||||
const QColor labelOutlineColor( 64, 64, 64 );
|
const QColor labelOutlineColor( 128, 128, 255 );
|
||||||
|
const double labelOutlineWidthPixels = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -51,6 +53,7 @@ namespace gLabels
|
|||||||
viewport()->setAutoFillBackground(false);
|
viewport()->setAutoFillBackground(false);
|
||||||
|
|
||||||
setFrameStyle( QFrame::NoFrame );
|
setFrameStyle( QFrame::NoFrame );
|
||||||
|
setRenderHints( QPainter::Antialiasing );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -69,6 +72,8 @@ namespace gLabels
|
|||||||
mScene->setSceneRect( x, y, w, h );
|
mScene->setSceneRect( x, y, w, h );
|
||||||
fitInView( x, y, w, h, Qt::KeepAspectRatio );
|
fitInView( x, y, w, h, Qt::KeepAspectRatio );
|
||||||
|
|
||||||
|
mScale = matrix().m11();
|
||||||
|
|
||||||
drawPaper( tmplate->pageWidth(), tmplate->pageHeight() );
|
drawPaper( tmplate->pageWidth(), tmplate->pageHeight() );
|
||||||
drawLabels( tmplate );
|
drawLabels( tmplate );
|
||||||
}
|
}
|
||||||
@@ -89,11 +94,12 @@ namespace gLabels
|
|||||||
{
|
{
|
||||||
QGraphicsDropShadowEffect *shadowEffect = new QGraphicsDropShadowEffect();
|
QGraphicsDropShadowEffect *shadowEffect = new QGraphicsDropShadowEffect();
|
||||||
shadowEffect->setColor( shadowColor );
|
shadowEffect->setColor( shadowColor );
|
||||||
shadowEffect->setOffset( shadowOffset );
|
shadowEffect->setOffset( shadowOffsetPixels );
|
||||||
shadowEffect->setBlurRadius( shadowRadius );
|
shadowEffect->setBlurRadius( shadowRadiusPixels );
|
||||||
|
|
||||||
QBrush brush( paperColor );
|
QBrush brush( paperColor );
|
||||||
QPen pen( paperOutlineColor );
|
QPen pen( paperOutlineColor );
|
||||||
|
pen.setWidthF( paperOutlineWidthPixels / mScale );
|
||||||
|
|
||||||
QGraphicsRectItem *pageItem = new QGraphicsRectItem( 0, 0, pw, ph );
|
QGraphicsRectItem *pageItem = new QGraphicsRectItem( 0, 0, pw, ph );
|
||||||
pageItem->setBrush( brush );
|
pageItem->setBrush( brush );
|
||||||
@@ -119,6 +125,7 @@ namespace gLabels
|
|||||||
{
|
{
|
||||||
QBrush brush( labelColor );
|
QBrush brush( labelColor );
|
||||||
QPen pen( labelOutlineColor );
|
QPen pen( labelOutlineColor );
|
||||||
|
pen.setWidthF( labelOutlineWidthPixels / mScale );
|
||||||
|
|
||||||
QGraphicsPathItem *labelItem = new QGraphicsPathItem( path );
|
QGraphicsPathItem *labelItem = new QGraphicsPathItem( path );
|
||||||
labelItem->setBrush( brush );
|
labelItem->setBrush( brush );
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ namespace gLabels
|
|||||||
void drawLabel( double x, double y, const QPainterPath &path );
|
void drawLabel( double x, double y, const QPainterPath &path );
|
||||||
|
|
||||||
QGraphicsScene *mScene;
|
QGraphicsScene *mScene;
|
||||||
|
double mScale;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>860</width>
|
<width>1012</width>
|
||||||
<height>777</height>
|
<height>777</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -138,7 +138,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="page">
|
<widget class="QWidget" name="page">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
@@ -184,15 +184,6 @@
|
|||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>12</number>
|
<number>12</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
|
||||||
<widget class="QGroupBox" name="selectionInfoGroup">
|
|
||||||
<property name="title">
|
|
||||||
<string>Selection</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="gLabels::SimplePreview" name="simplePreview">
|
<widget class="gLabels::SimplePreview" name="simplePreview">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@@ -335,9 +326,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QGroupBox" name="groupBox_2">
|
<widget class="QGroupBox" name="groupBox_2">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
|||||||
Reference in New Issue
Block a user