diff options
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 14 | ||||
-rw-r--r-- | qt-ui/profile/profilewidget2.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 14ae7ca5b..8d4d24ef2 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -1060,6 +1060,20 @@ bool ProfileWidget2::isAddOrPlanner() return currentState == PLAN || currentState == ADD; } +struct plot_data *ProfileWidget2::getEntryFromPos(QPointF pos) +{ + // find the time stamp corresponding to the mouse position + int seconds = timeAxis->valueAt(pos); + struct plot_data *entry; + + for (int i = 0; i < plotInfo.nr; i++) { + entry = plotInfo.entry + i; + if (entry->sec >= seconds) + break; + } + return entry; +} + void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event) { if (currentState == ADD || currentState == PLAN) { diff --git a/qt-ui/profile/profilewidget2.h b/qt-ui/profile/profilewidget2.h index 477ddf4a7..4c7951533 100644 --- a/qt-ui/profile/profilewidget2.h +++ b/qt-ui/profile/profilewidget2.h @@ -134,6 +134,7 @@ private: /*methods*/ void addItemsToScene(); void setupItemOnScene(); void disconnectTemporaryConnections(); + struct plot_data *getEntryFromPos(QPointF pos); private: DivePlotDataModel *dataModel; |