mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 20:53:23 +00:00
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>
This commit is contained in:
parent
21658383e5
commit
639e079131
2 changed files with 15 additions and 0 deletions
|
@ -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) {
|
||||
|
|
|
@ -134,6 +134,7 @@ private: /*methods*/
|
|||
void addItemsToScene();
|
||||
void setupItemOnScene();
|
||||
void disconnectTemporaryConnections();
|
||||
struct plot_data *getEntryFromPos(QPointF pos);
|
||||
|
||||
private:
|
||||
DivePlotDataModel *dataModel;
|
||||
|
|
Loading…
Add table
Reference in a new issue