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>
This commit is contained in:
Tomaz Canabrava 2015-01-16 17:22:30 -02:00 committed by Dirk Hohndel
parent d2c5770ae1
commit 947010991d

View file

@ -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()