diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-03-16 15:10:03 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-03-16 15:11:35 -0700 |
commit | 33b1b0ed9d6a9ccb41d0a86eae105903e61880e7 (patch) | |
tree | 07fe1289c547121ca91a75debf94c0ec9bae1807 /qt-ui/profile/diveeventitem.cpp | |
parent | 0f7dfcee26812b44d276ea44acefa135a376c0f6 (diff) | |
download | subsurface-33b1b0ed9d6a9ccb41d0a86eae105903e61880e7.tar.gz |
New profile: fix event hiding logic
Turns out we unconditionally set all events as visible when redrawing the
dive - even with a comment that this should take into account if the event
is visible. Oops.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/diveeventitem.cpp')
-rw-r--r-- | qt-ui/profile/diveeventitem.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/qt-ui/profile/diveeventitem.cpp b/qt-ui/profile/diveeventitem.cpp index cb04d6e56..3f75ab10a 100644 --- a/qt-ui/profile/diveeventitem.cpp +++ b/qt-ui/profile/diveeventitem.cpp @@ -109,9 +109,17 @@ void DiveEventItem::eventVisibilityChanged(const QString &eventName, bool visibl { } +bool DiveEventItem::shouldBeHidden() +{ + for (int i = 0; i < evn_used; i++) { + if (!strcmp(internalEvent->name, ev_namelist[i].ev_name) && ev_namelist[i].plot_ev == false) + return true; + } + return false; +} + void DiveEventItem::recalculatePos(bool instant) { - bool hidden = false; if (!vAxis || !hAxis || !internalEvent || !dataModel) return; @@ -121,11 +129,7 @@ void DiveEventItem::recalculatePos(bool instant) hide(); return; } - for (int i = 0; i < evn_used; i++) { - if (!strcmp(internalEvent->name, ev_namelist[i].ev_name) && ev_namelist[i].plot_ev == false) - hidden = true; - } - if (!isVisible() && !hidden) + if (!isVisible() && !shouldBeHidden()) show(); int depth = dataModel->data(dataModel->index(result.first().row(), DivePlotDataModel::DEPTH)).toInt(); qreal x = hAxis->posAtValue(internalEvent->time.seconds); @@ -134,6 +138,6 @@ void DiveEventItem::recalculatePos(bool instant) Animations::moveTo(this, x, y); else setPos(x, y); - if (isVisible() && hidden) + if (isVisible() && shouldBeHidden()) hide(); } |