mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: show events in ToolTipItem
Reimplement a feature that was lost when porting the ToolTipOtem to QtQuick. This is a bit of a longer commit, because the icon of the event is now drawn explicitly, instead of using HTML. This encompasses a UI change: the icon is now the icon shown on the profile and not a general "warning" icon. This commit also fixes update of the tooltip when panning the profile. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
c6eeeb7d28
commit
06b0a7eeae
8 changed files with 105 additions and 91 deletions
|
@ -184,8 +184,6 @@ void ProfileView::plotDive(const struct dive *dIn, int dcIn, int flags)
|
|||
//else
|
||||
//plotPicturesInternal(d, flags & RenderFlags::Instant);
|
||||
|
||||
//toolTipItem->refresh(d, mapToScene(mapFromGlobal(QCursor::pos())), currentState == PLAN);
|
||||
|
||||
update();
|
||||
|
||||
// OK, how long did this take us? Anything above the second is way too long,
|
||||
|
@ -201,8 +199,9 @@ void ProfileView::plotDive(const struct dive *dIn, int dcIn, int flags)
|
|||
if (!tooltip)
|
||||
tooltip = createChartItem<ToolTipItem>(dpr);
|
||||
if (prefs.infobox) {
|
||||
QPoint pos = mapFromGlobal(QCursor::pos()).toPoint();
|
||||
tooltip->setVisible(true);
|
||||
tooltip->update(d, dpr, 0, profileScene->getPlotInfo(), flags & RenderFlags::PlanMode);
|
||||
updateTooltip(pos, flags & RenderFlags::PlanMode);
|
||||
} else {
|
||||
tooltip->setVisible(false);
|
||||
}
|
||||
|
@ -296,8 +295,6 @@ void ProfileView::mouseMoveEvent(QMouseEvent *event)
|
|||
if (panning)
|
||||
pan(pos.x(), pos.y());
|
||||
|
||||
//toolTipItem->refresh(d, mapToScene(mapFromGlobal(QCursor::pos())), currentState == PLAN);
|
||||
|
||||
//if (currentState == PLAN || currentState == EDIT) {
|
||||
//QRectF rect = profileScene->profileRegion;
|
||||
//auto [miny, maxy] = profileScene->profileYAxis->screenMinMax();
|
||||
|
@ -378,14 +375,15 @@ void ProfileView::hoverMoveEvent(QHoverEvent *event)
|
|||
{
|
||||
if (!profileScene)
|
||||
return;
|
||||
QPointF pos = event->pos();
|
||||
int time = profileScene->timeAt(pos);
|
||||
bool requires_update = false;
|
||||
if (tooltip) {
|
||||
tooltip->update(d, dpr, time, profileScene->getPlotInfo(), false); // TODO: plan mode
|
||||
requires_update = true;
|
||||
}
|
||||
|
||||
if (requires_update)
|
||||
if (tooltip && prefs.infobox) {
|
||||
updateTooltip(event->pos(), false); // TODO: plan mode
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void ProfileView::updateTooltip(QPointF pos, bool plannerMode)
|
||||
{
|
||||
int time = profileScene->timeAt(pos);
|
||||
auto events = profileScene->eventsAt(pos);
|
||||
tooltip->update(d, dpr, time, profileScene->getPlotInfo(), events, plannerMode);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue