mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profilewidget2: add resetZoom()
resetZoom() is now a new method that is called both when 'printMode' is updated or when the dive is re-plotted. Fixes a bug where zooming in on the profile and then printing the dive has the profile at the wrong zoom level (makes the profile look smaller). Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
f1b4fb21db
commit
11e38710e4
2 changed files with 12 additions and 5 deletions
|
@ -477,6 +477,15 @@ void ProfileWidget2::setupSceneAndFlags()
|
||||||
background->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
background->setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ProfileWidget2::resetZoom()
|
||||||
|
{
|
||||||
|
if (!zoomLevel)
|
||||||
|
return;
|
||||||
|
const qreal defScale = 1.0 / qPow(zoomFactor, (qreal)zoomLevel);
|
||||||
|
scale(defScale, defScale);
|
||||||
|
zoomLevel = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Currently just one dive, but the plan is to enable All of the selected dives.
|
// Currently just one dive, but the plan is to enable All of the selected dives.
|
||||||
void ProfileWidget2::plotDive(struct dive *d, bool force)
|
void ProfileWidget2::plotDive(struct dive *d, bool force)
|
||||||
{
|
{
|
||||||
|
@ -521,11 +530,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
|
||||||
}
|
}
|
||||||
|
|
||||||
// restore default zoom level
|
// restore default zoom level
|
||||||
if (zoomLevel) {
|
resetZoom();
|
||||||
const qreal defScale = 1.0 / qPow(zoomFactor, (qreal)zoomLevel);
|
|
||||||
scale(defScale, defScale);
|
|
||||||
zoomLevel = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// reset some item visibility on printMode changes
|
// reset some item visibility on printMode changes
|
||||||
toolTipItem->setVisible(!printMode);
|
toolTipItem->setVisible(!printMode);
|
||||||
|
@ -1473,6 +1478,7 @@ bool ProfileWidget2::getPrintMode()
|
||||||
void ProfileWidget2::setPrintMode(bool mode, bool grayscale)
|
void ProfileWidget2::setPrintMode(bool mode, bool grayscale)
|
||||||
{
|
{
|
||||||
printMode = mode;
|
printMode = mode;
|
||||||
|
resetZoom();
|
||||||
isGrayscale = mode ? grayscale : false;
|
isGrayscale = mode ? grayscale : false;
|
||||||
mouseFollowerHorizontal->setVisible(!mode);
|
mouseFollowerHorizontal->setVisible(!mode);
|
||||||
mouseFollowerVertical->setVisible(!mode);
|
mouseFollowerVertical->setVisible(!mode);
|
||||||
|
|
|
@ -71,6 +71,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
ProfileWidget2(QWidget *parent = 0);
|
ProfileWidget2(QWidget *parent = 0);
|
||||||
|
void resetZoom();
|
||||||
void plotDive(struct dive *d = 0, bool force = false);
|
void plotDive(struct dive *d = 0, bool force = false);
|
||||||
virtual bool eventFilter(QObject *, QEvent *);
|
virtual bool eventFilter(QObject *, QEvent *);
|
||||||
void setupItem(AbstractProfilePolygonItem *item, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis, DivePlotDataModel *model, int vData, int hData, int zValue);
|
void setupItem(AbstractProfilePolygonItem *item, DiveCartesianAxis *hAxis, DiveCartesianAxis *vAxis, DivePlotDataModel *model, int vData, int hData, int zValue);
|
||||||
|
|
Loading…
Add table
Reference in a new issue