summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/divetextitem.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-29 10:57:05 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-07-29 10:59:28 -0700
commit487ddce3531f6b738affc84edf066bd0ea4a16bb (patch)
treef3113d1f2b2082d0b7f98c55c7198b205b366b85 /qt-ui/profile/divetextitem.cpp
parentccaff3a06da9c638cd1088329e10944320e1f66e (diff)
downloadsubsurface-487ddce3531f6b738affc84edf066bd0ea4a16bb.tar.gz
Profile: make sure text is scaled correctly when drawn
We had all this wonderful code to scale the text correctly, except we went out of our way to make sure the code wouldn't be called unless something changed on this specific text item. But that's bogus because the scaling depends on external factors like the fontPrintScale. So instead of calling updateText() when attributes of this DiveTextItem change simply call it right before the DiveTextItem gets painted. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/divetextitem.cpp')
-rw-r--r--qt-ui/profile/divetextitem.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/qt-ui/profile/divetextitem.cpp b/qt-ui/profile/divetextitem.cpp
index 4c0137177..b3d5c39aa 100644
--- a/qt-ui/profile/divetextitem.cpp
+++ b/qt-ui/profile/divetextitem.cpp
@@ -14,11 +14,16 @@ DiveTextItem::DiveTextItem(QGraphicsItem *parent) : QGraphicsItemGroup(parent),
textItem->setPen(Qt::NoPen);
}
+void DiveTextItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
+{
+ updateText();
+ QGraphicsItemGroup::paint(painter, option, widget);
+}
+
void DiveTextItem::setAlignment(int alignFlags)
{
if (alignFlags != internalAlignFlags) {
internalAlignFlags = alignFlags;
- updateText();
}
}
@@ -31,7 +36,6 @@ void DiveTextItem::setScale(double newscale)
{
if (scale != newscale) {
scale = newscale;
- updateText();
}
}
@@ -39,7 +43,6 @@ void DiveTextItem::setText(const QString &t)
{
if (internalText != t) {
internalText = t;
- updateText();
}
}