feat: add option to avoid reset transform when switching between images
It's not enabled for now so it's not available to end-users.
This commit is contained in:
@ -121,7 +121,9 @@ qreal GraphicsView::scaleFactor() const
|
||||
|
||||
void GraphicsView::resetTransform()
|
||||
{
|
||||
QGraphicsView::resetTransform();
|
||||
if (!m_avoidResetTransform) {
|
||||
QGraphicsView::resetTransform();
|
||||
}
|
||||
}
|
||||
|
||||
void GraphicsView::zoomView(qreal scaleFactor)
|
||||
@ -197,6 +199,11 @@ void GraphicsView::fitByOrientation(Qt::Orientation ori, bool scaleDownOnly)
|
||||
|
||||
void GraphicsView::displayScene()
|
||||
{
|
||||
if (m_avoidResetTransform) {
|
||||
emit navigatorViewRequired(!isThingSmallerThanWindowWith(transform()), transform());
|
||||
return;
|
||||
}
|
||||
|
||||
if (isSceneBiggerThanView()) {
|
||||
fitInView(sceneRect(), Qt::KeepAspectRatio);
|
||||
}
|
||||
@ -219,6 +226,16 @@ void GraphicsView::setEnableAutoFitInView(bool enable)
|
||||
m_enableFitInView = enable;
|
||||
}
|
||||
|
||||
bool GraphicsView::avoidResetTransform() const
|
||||
{
|
||||
return m_avoidResetTransform;
|
||||
}
|
||||
|
||||
void GraphicsView::setAvoidResetTransform(bool avoidReset)
|
||||
{
|
||||
m_avoidResetTransform = avoidReset;
|
||||
}
|
||||
|
||||
inline double zeroOrOne(double number)
|
||||
{
|
||||
return qFuzzyIsNull(number) ? 0 : (number > 0 ? 1 : -1);
|
||||
|
Reference in New Issue
Block a user