profle: port event manipulation to QtQuick

UI change: the context menu is opened when left-clicking on
the event. This is probably more compatible with mobile UI.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2024-02-24 09:07:23 +01:00
parent f0fe52d42b
commit faf18ef36b
6 changed files with 147 additions and 124 deletions

View file

@ -526,6 +526,8 @@ void ProfileScene::plotDive(const struct dive *dIn, int dcIn, int animSpeed, boo
struct gasmix lastgasmix = d->get_gasmix_at_time(*currentdc, 1_sec);
for (auto [idx, event]: enumerated_range(currentdc->events)) {
if (event.hidden)
continue;
// if print mode is selected only draw headings, SP change, gas events or bookmark event
if (printMode) {
if (event.name.empty() ||
@ -663,3 +665,12 @@ std::vector<std::pair<QString, QPixmap>> ProfileScene::eventsAt(QPointF pos) con
}
return res;
}
DiveEventItem *ProfileScene::eventAtPosition(QPointF pos) const
{
for (const auto &item: eventItems) {
if (item->contains(item->mapFromScene(pos)))
return item.get();
}
return nullptr;
}