summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/profilewidget2.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-19 22:31:28 +0000
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-19 22:40:42 +0000
commit639e079131126015dff0f745d1b5d3fc51adcecc (patch)
tree81a9874fc4cd39e5b1227a2d467d2ba78ecd3068 /qt-ui/profile/profilewidget2.cpp
parent21658383e5c188b588aecab46e827cb90a88bc26 (diff)
downloadsubsurface-639e079131126015dff0f745d1b5d3fc51adcecc.tar.gz
Profile: add helper function to get the sample entry for a mouse position
This seems quite useful to have. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/profilewidget2.cpp')
-rw-r--r--qt-ui/profile/profilewidget2.cpp14
1 files changed, 14 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) {