diff --git a/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp b/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp
index 607bd2367..c6a80a87f 100644
--- a/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp
+++ b/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.cpp
@@ -108,6 +108,7 @@ PreferencesConfigurationPage::PreferencesConfigurationPage(QWidget *parent)
});
ui->checkBoxFreeCurve->setChecked(qApp->ValentinaSettings()->IsFreeCurveMode());
+ ui->checkBoxZoomFitBestCurrentPP->setChecked(qApp->ValentinaSettings()->IsDoubleClickZoomFitBestCurrentPP());
//----------------------- Toolbar
ui->toolBarStyleCheck->setChecked(qApp->ValentinaSettings()->GetToolBarStyle());
@@ -135,6 +136,7 @@ QStringList PreferencesConfigurationPage::Apply()
settings->SetOsSeparator(ui->osOptionCheck->isChecked());
settings->SetToolBarStyle(ui->toolBarStyleCheck->isChecked());
settings->SetFreeCurveMode(ui->checkBoxFreeCurve->isChecked());
+ settings->SetDoubleClickZoomFitBestCurrentPP(ui->checkBoxZoomFitBestCurrentPP->isChecked());
if (m_langChanged || m_systemChanged)
{
diff --git a/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.ui b/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.ui
index 1e73fc4a2..2845e97fe 100644
--- a/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.ui
+++ b/src/app/valentina/dialogs/configpages/preferencesconfigurationpage.ui
@@ -7,7 +7,7 @@
0
0
501
- 582
+ 611
@@ -200,6 +200,16 @@
+ -
+
+
+ Double click calls Zoom fit best for current pattern piece
+
+
+ true
+
+
+
diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp
index bda206d1f..ca360c8bc 100644
--- a/src/libs/vmisc/vcommonsettings.cpp
+++ b/src/libs/vmisc/vcommonsettings.cpp
@@ -63,6 +63,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationConfirmItemDeletion
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationConfirmFormatRewriting, (QLatin1String("configuration/confirm_format_rewriting")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationToolBarStyle, (QLatin1String("configuration/tool_bar_style")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationFreeCurveMode, (QLatin1String("configuration/freeCurveMode")))
+Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingConfigurationDoubleClickZoomFitBestCurrentPP, (QLatin1String("configuration/doubleClickZoomFitBestCurrentPP")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternUndo, (QLatin1String("pattern/undo")))
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternForbidFlipping, (QLatin1String("pattern/forbidFlipping")))
@@ -524,6 +525,18 @@ void VCommonSettings::SetFreeCurveMode(bool value)
setValue(*settingConfigurationFreeCurveMode, value);
}
+//---------------------------------------------------------------------------------------------------------------------
+bool VCommonSettings::IsDoubleClickZoomFitBestCurrentPP() const
+{
+ return value(*settingConfigurationDoubleClickZoomFitBestCurrentPP, 1).toBool();
+}
+
+//---------------------------------------------------------------------------------------------------------------------
+void VCommonSettings::SetDoubleClickZoomFitBestCurrentPP(bool value)
+{
+ setValue(*settingConfigurationDoubleClickZoomFitBestCurrentPP, value);
+}
+
//---------------------------------------------------------------------------------------------------------------------
int VCommonSettings::GetUndoCount() const
{
diff --git a/src/libs/vmisc/vcommonsettings.h b/src/libs/vmisc/vcommonsettings.h
index 1ebecdbd5..0e35449ef 100644
--- a/src/libs/vmisc/vcommonsettings.h
+++ b/src/libs/vmisc/vcommonsettings.h
@@ -102,6 +102,9 @@ public:
bool IsFreeCurveMode() const;
void SetFreeCurveMode(bool value);
+ bool IsDoubleClickZoomFitBestCurrentPP() const;
+ void SetDoubleClickZoomFitBestCurrentPP(bool value);
+
int GetUndoCount() const;
void SetUndoCount(const int &value);
diff --git a/src/libs/vwidgets/vmaingraphicsview.cpp b/src/libs/vwidgets/vmaingraphicsview.cpp
index 69239cbbe..231de5c70 100644
--- a/src/libs/vwidgets/vmaingraphicsview.cpp
+++ b/src/libs/vwidgets/vmaingraphicsview.cpp
@@ -607,7 +607,7 @@ void VMainGraphicsView::mouseReleaseEvent(QMouseEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void VMainGraphicsView::mouseDoubleClickEvent(QMouseEvent *event)
{
- if (event->button() == Qt::LeftButton)
+ if (event->button() == Qt::LeftButton && qApp->Settings()->IsDoubleClickZoomFitBestCurrentPP())
{
if (VAbstractMainWindow *window = qobject_cast(qApp->getMainWindow()))
{