summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-05-26 18:01:38 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-05-26 14:07:48 -0700
commit4c9dd0e698f7d62f19b2097c03f99fe9d8f3ed6a (patch)
treea30ed848435b1453a64d8c68dab6d32f2c77fac1 /qt-ui/profile
parentaddec6b69fe9022a79d83945b865a0b518f556e8 (diff)
downloadsubsurface-4c9dd0e698f7d62f19b2097c03f99fe9d8f3ed6a.tar.gz
Speed up the grid: don't repaint when uneeded.
Added a flag to only recalculate the axis when needed. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile')
-rw-r--r--qt-ui/profile/divecartesianaxis.cpp11
-rw-r--r--qt-ui/profile/divecartesianaxis.h1
2 files changed, 10 insertions, 2 deletions
diff --git a/qt-ui/profile/divecartesianaxis.cpp b/qt-ui/profile/divecartesianaxis.cpp
index 353f9880c..25b8a55a7 100644
--- a/qt-ui/profile/divecartesianaxis.cpp
+++ b/qt-ui/profile/divecartesianaxis.cpp
@@ -34,6 +34,7 @@ double DiveCartesianAxis::tickSize() const
void DiveCartesianAxis::setFontLabelScale(qreal scale)
{
labelScale = scale;
+ changed = true;
}
void DiveCartesianAxis::setMaximum(double maximum)
@@ -41,6 +42,7 @@ void DiveCartesianAxis::setMaximum(double maximum)
if (IS_FP_SAME(max, maximum))
return;
max = maximum;
+ changed = true;
emit maxChanged();
}
@@ -49,6 +51,7 @@ void DiveCartesianAxis::setMinimum(double minimum)
if (IS_FP_SAME(min, minimum))
return;
min = minimum;
+ changed = true;
}
void DiveCartesianAxis::setTextColor(const QColor &color)
@@ -67,7 +70,8 @@ DiveCartesianAxis::DiveCartesianAxis() : QObject(),
textVisibility(true),
lineVisibility(true),
labelScale(1.0),
- line_size(1)
+ line_size(1),
+ changed(true)
{
setPen(gridPen());
}
@@ -79,11 +83,13 @@ DiveCartesianAxis::~DiveCartesianAxis()
void DiveCartesianAxis::setLineSize(qreal lineSize)
{
line_size = lineSize;
+ changed = true;
}
void DiveCartesianAxis::setOrientation(Orientation o)
{
orientation = o;
+ changed = true;
}
QColor DiveCartesianAxis::colorForValue(double value)
@@ -126,7 +132,7 @@ void emptyList(QList<T *> &list, double steps)
void DiveCartesianAxis::updateTicks(color_indice_t color)
{
- if (!scene())
+ if (!scene() || !changed)
return;
QLineF m = line();
// unused so far:
@@ -241,6 +247,7 @@ void DiveCartesianAxis::updateTicks(color_indice_t color)
item->setVisible(textVisibility);
Q_FOREACH (DiveLineItem *item, lines)
item->setVisible(lineVisibility);
+ changed = false;
}
void DiveCartesianAxis::animateChangeLine(const QLineF &newLine)
diff --git a/qt-ui/profile/divecartesianaxis.h b/qt-ui/profile/divecartesianaxis.h
index 34089e614..e7fa68cc3 100644
--- a/qt-ui/profile/divecartesianaxis.h
+++ b/qt-ui/profile/divecartesianaxis.h
@@ -69,6 +69,7 @@ protected:
bool lineVisibility;
double labelScale;
qreal line_size;
+ bool changed;
};
class DepthAxis : public DiveCartesianAxis {