diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-03-15 21:12:34 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-03-15 21:12:34 -0700 |
commit | 401aa210ffb33cfefc94906a4cc476e00c4b1cff (patch) | |
tree | 0203c269ae5f824422ca91c0f7d6e5378996eb89 /qt-ui/profile/diveeventitem.cpp | |
parent | cb41f34826e7cc1caf0fd0358f99266030f8c0c3 (diff) | |
download | subsurface-401aa210ffb33cfefc94906a4cc476e00c4b1cff.tar.gz |
New profile: add event manipulation to context menu
This got lost when we switched to the new profile.
Remove event works. Hide events does call hide() on the DiveEventItem but
for some reason it stays visible. I'll hope for one of the more
experienced Qt people to fix that.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/diveeventitem.cpp')
-rw-r--r-- | qt-ui/profile/diveeventitem.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/qt-ui/profile/diveeventitem.cpp b/qt-ui/profile/diveeventitem.cpp index 1fd4ef07a..cb04d6e56 100644 --- a/qt-ui/profile/diveeventitem.cpp +++ b/qt-ui/profile/diveeventitem.cpp @@ -4,8 +4,12 @@ #include "animationfunctions.h" #include "libdivecomputer.h" #include "dive.h" +#include "profile.h" #include <QDebug> +extern struct ev_select *ev_namelist; +extern int evn_used; + DiveEventItem::DiveEventItem(QObject *parent) : DivePixmapItem(parent), vAxis(NULL), hAxis(NULL), @@ -107,6 +111,7 @@ void DiveEventItem::eventVisibilityChanged(const QString &eventName, bool visibl void DiveEventItem::recalculatePos(bool instant) { + bool hidden = false; if (!vAxis || !hAxis || !internalEvent || !dataModel) return; @@ -116,9 +121,12 @@ void DiveEventItem::recalculatePos(bool instant) hide(); return; } - if (!isVisible()) + 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) show(); - int depth = dataModel->data(dataModel->index(result.first().row(), DivePlotDataModel::DEPTH)).toInt(); qreal x = hAxis->posAtValue(internalEvent->time.seconds); qreal y = vAxis->posAtValue(depth); @@ -126,4 +134,6 @@ void DiveEventItem::recalculatePos(bool instant) Animations::moveTo(this, x, y); else setPos(x, y); + if (isVisible() && hidden) + hide(); } |