mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile-widget2: enable vertical line with infobox
Enables the vertical mouseFollower in currentState==PROFILE, while prefs.infobox is active. The values shown in the infobox correspond to a specific data sample. This sample is exactly pointed out by the vertical line of the MouseFollower, enabling a more intuitive analysis Signed-off-by: Hannes Krueger <hannes.krueger@gmail.com>
This commit is contained in:
parent
71ebee8ab6
commit
1eefd94ac3
1 changed files with 25 additions and 4 deletions
|
@ -255,6 +255,17 @@ void ProfileWidget2::divesChanged(const QVector<dive *> &dives, DiveField field)
|
||||||
|
|
||||||
void ProfileWidget2::actionRequestedReplot(bool)
|
void ProfileWidget2::actionRequestedReplot(bool)
|
||||||
{
|
{
|
||||||
|
/* this is called vai infoboxChanged, therefore in currentState==PROFILE
|
||||||
|
we have to set the mouseFollowerVertical to visible (if prefs.infobox) hk */
|
||||||
|
#ifndef SUBSURFACE_MOBILE
|
||||||
|
if (currentState == PROFILE) {
|
||||||
|
mouseFollowerHorizontal->setVisible(false);
|
||||||
|
if (!prefs.infobox)
|
||||||
|
mouseFollowerVertical->setVisible(false);
|
||||||
|
else
|
||||||
|
mouseFollowerVertical->setVisible(true);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
settingsChanged();
|
settingsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +381,7 @@ void ProfileWidget2::mouseMoveEvent(QMouseEvent *event)
|
||||||
|
|
||||||
toolTipItem->refresh(d, mapToScene(mapFromGlobal(QCursor::pos())), currentState == PLAN);
|
toolTipItem->refresh(d, mapToScene(mapFromGlobal(QCursor::pos())), currentState == PLAN);
|
||||||
|
|
||||||
if (currentState == PLAN || currentState == EDIT) {
|
if (currentState == PLAN || currentState == EDIT || prefs.infobox) {
|
||||||
QRectF rect = profileScene->profileRegion;
|
QRectF rect = profileScene->profileRegion;
|
||||||
auto [miny, maxy] = profileScene->profileYAxis->screenMinMax();
|
auto [miny, maxy] = profileScene->profileYAxis->screenMinMax();
|
||||||
double x = std::clamp(pos.x(), rect.left(), rect.right());
|
double x = std::clamp(pos.x(), rect.left(), rect.right());
|
||||||
|
@ -423,11 +434,23 @@ void ProfileWidget2::setProfileState(const dive *dIn, int dcIn)
|
||||||
|
|
||||||
void ProfileWidget2::setProfileState()
|
void ProfileWidget2::setProfileState()
|
||||||
{
|
{
|
||||||
|
/* when infobox is active in currentState==PROFILE
|
||||||
|
or, when switching to currentState==PROFILE
|
||||||
|
the mouseFollowers are needed to be set.
|
||||||
|
However, in currentState==PROFILE on toggling infobox,
|
||||||
|
this needs to be set too! hk */
|
||||||
|
#ifndef SUBSURFACE_MOBILE
|
||||||
|
mouseFollowerHorizontal->setVisible(false);
|
||||||
|
if (!prefs.infobox)
|
||||||
|
mouseFollowerVertical->setVisible(false);
|
||||||
|
else
|
||||||
|
mouseFollowerVertical->setVisible(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (currentState == PROFILE)
|
if (currentState == PROFILE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
disconnectPlannerModel();
|
disconnectPlannerModel();
|
||||||
|
|
||||||
currentState = PROFILE;
|
currentState = PROFILE;
|
||||||
setBackgroundBrush(getColor(::BACKGROUND, profileScene->isGrayscale));
|
setBackgroundBrush(getColor(::BACKGROUND, profileScene->isGrayscale));
|
||||||
|
|
||||||
|
@ -435,8 +458,6 @@ void ProfileWidget2::setProfileState()
|
||||||
toolTipItem->readPos();
|
toolTipItem->readPos();
|
||||||
toolTipItem->setVisible(prefs.infobox);
|
toolTipItem->setVisible(prefs.infobox);
|
||||||
rulerItem->setVisible(prefs.rulergraph);
|
rulerItem->setVisible(prefs.rulergraph);
|
||||||
mouseFollowerHorizontal->setVisible(false);
|
|
||||||
mouseFollowerVertical->setVisible(false);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
handles.clear();
|
handles.clear();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue