aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-01-16 17:22:30 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-01-17 08:54:11 +1300
commit947010991da4b44cbbf1a2e7c63d3f6a65c41404 (patch)
treea74c27a4769f87f50f315ed6d1c5471c1f4949f3 /qt-ui
parentd2c5770ae14a79ee124959f20b01161da52c62c2 (diff)
downloadsubsurface-947010991da4b44cbbf1a2e7c63d3f6a65c41404.tar.gz
Only update text if something changed
We were calling this even if we didn't really change anything and paths are expensive to paint. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/profile/divetextitem.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/qt-ui/profile/divetextitem.cpp b/qt-ui/profile/divetextitem.cpp
index 24f9d6b25..761f0e6f7 100644
--- a/qt-ui/profile/divetextitem.cpp
+++ b/qt-ui/profile/divetextitem.cpp
@@ -24,8 +24,10 @@ DiveTextItem::DiveTextItem(QGraphicsItem *parent) : QGraphicsItemGroup(parent),
void DiveTextItem::setAlignment(int alignFlags)
{
- internalAlignFlags = alignFlags;
- updateText();
+ if (alignFlags != internalAlignFlags) {
+ internalAlignFlags = alignFlags;
+ updateText();
+ }
}
void DiveTextItem::setBrush(const QBrush &b)
@@ -35,13 +37,18 @@ void DiveTextItem::setBrush(const QBrush &b)
void DiveTextItem::setScale(double newscale)
{
- scale = newscale;
+ if (scale != newscale) {
+ scale = newscale;
+ updateText();
+ }
}
void DiveTextItem::setText(const QString &t)
{
- internalText = t;
- updateText();
+ if (internalText != t) {
+ internalText = t;
+ updateText();
+ }
}
const QString &DiveTextItem::text()