aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/profile
diff options
context:
space:
mode:
Diffstat (limited to 'qt-ui/profile')
-rw-r--r--qt-ui/profile/diveeventitem.cpp18
-rw-r--r--qt-ui/profile/diveeventitem.h1
-rw-r--r--qt-ui/profile/profilewidget2.cpp4
3 files changed, 14 insertions, 9 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();
}
diff --git a/qt-ui/profile/diveeventitem.h b/qt-ui/profile/diveeventitem.h
index 1b138163c..f358fee6d 100644
--- a/qt-ui/profile/diveeventitem.h
+++ b/qt-ui/profile/diveeventitem.h
@@ -17,6 +17,7 @@ public:
void setVerticalAxis(DiveCartesianAxis *axis);
void setHorizontalAxis(DiveCartesianAxis *axis);
void setModel(DivePlotDataModel *model);
+ bool shouldBeHidden();
public
slots:
void recalculatePos(bool instant = false);
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp
index 7e0aba001..d5cf41981 100644
--- a/qt-ui/profile/profilewidget2.cpp
+++ b/qt-ui/profile/profilewidget2.cpp
@@ -441,8 +441,8 @@ void ProfileWidget2::plotDives(QList<dive *> dives)
}
// Only set visible the ones that should be visible, but how?
Q_FOREACH(DiveEventItem * event, eventItems) {
- event->setVisible(true);
- // qDebug() << event->getEvent()->name << "@" << event->getEvent()->time.seconds;
+ event->setVisible(!event->shouldBeHidden());
+ // qDebug() << event->getEvent()->name << "@" << event->getEvent()->time.seconds << "is hidden:" << event->isHidden();
}
diveComputerText->setText(currentdc->model);
if (MainWindow::instance()->filesFromCommandLine() && animSpeedBackup != -1){