From 947010991da4b44cbbf1a2e7c63d3f6a65c41404 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Fri, 16 Jan 2015 17:22:30 -0200 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/profile/divetextitem.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'qt-ui/profile') 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() -- cgit v1.2.3-70-g09d2