From 4c3b6a899c41ae143ef4d2aacf360a3960302e22 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 5 Sep 2022 14:38:26 +0300 Subject: [PATCH] Allow resizing Spline path dialog. --- ChangeLog.txt | 1 + src/libs/vmisc/vcommonsettings.cpp | 13 + src/libs/vmisc/vcommonsettings.h | 3 + .../vtools/dialogs/tools/dialogsplinepath.cpp | 39 + .../vtools/dialogs/tools/dialogsplinepath.h | 2 + .../vtools/dialogs/tools/dialogsplinepath.ui | 1791 +++++++++-------- 6 files changed, 963 insertions(+), 886 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 3997bb2f2..3dc297bd3 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -23,6 +23,7 @@ - Fix calculating an elliptical arc. - Enable Approximation scale option for Elliptical arc. - Fix bug in seam allowance. +- Allow resizing Spline path dialog. # Valentina 0.7.51 April 18, 2022 - Z value change for a layout piece. diff --git a/src/libs/vmisc/vcommonsettings.cpp b/src/libs/vmisc/vcommonsettings.cpp index 5f3d66f5d..72c7dd872 100644 --- a/src/libs/vmisc/vcommonsettings.cpp +++ b/src/libs/vmisc/vcommonsettings.cpp @@ -121,6 +121,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingIncrementsDialogSize, (QLatin1St Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFormulaWizardDialogSize, (QLatin1String("formulaWizardDialogSize"))) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingFinalMeasurementsDialogSize, (QLatin1String("finalMeasurementsDialogSize"))) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSettingsDialogSize, (QLatin1String("layoutSettingsDialogSize"))) // NOLINT +Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDialogSplinePathSize, (QLatin1String("splinePathDialogSize"))) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingAutomaticallyCheckUpdates, (QLatin1String("automaticallyCheckUpdates"))) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLatestSkippedVersion, (QLatin1String("lastestSkippedVersion"))) // NOLINT Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingDateOfLastRemind, (QLatin1String("dateOfLastRemind"))) // NOLINT @@ -830,6 +831,18 @@ void VCommonSettings::SetLayoutSettingsDialogSize(const QSize &sz) setValue(*settingLayoutSettingsDialogSize, sz); } +//--------------------------------------------------------------------------------------------------------------------- +QSize VCommonSettings::GetDialogSplinePathSize() const +{ + return value(*settingDialogSplinePathSize, QSize(0, 0)).toSize(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void VCommonSettings::SetDialogSplinePathSize(const QSize &sz) +{ + setValue(*settingDialogSplinePathSize, sz); +} + //--------------------------------------------------------------------------------------------------------------------- auto VCommonSettings::IsAutomaticallyCheckUpdates() const -> bool { diff --git a/src/libs/vmisc/vcommonsettings.h b/src/libs/vmisc/vcommonsettings.h index 8809c5a7f..58821d57b 100644 --- a/src/libs/vmisc/vcommonsettings.h +++ b/src/libs/vmisc/vcommonsettings.h @@ -161,6 +161,9 @@ public: auto GetLayoutSettingsDialogSize() const -> QSize; void SetLayoutSettingsDialogSize(const QSize& sz); + auto GetDialogSplinePathSize() const -> QSize; + void SetDialogSplinePathSize(const QSize& sz); + auto IsAutomaticallyCheckUpdates() const -> bool; void SetAutomaticallyCheckUpdates(bool value); diff --git a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp index 8f9fe2962..fe15f41de 100644 --- a/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp +++ b/src/libs/vtools/dialogs/tools/dialogsplinepath.cpp @@ -1004,6 +1004,45 @@ bool DialogSplinePath::IsValid() const return fAngle1 && fAngle2 && fLength1 && fLength2 && flagError && flagAlias; } +//--------------------------------------------------------------------------------------------------------------------- +void DialogSplinePath::showEvent(QShowEvent *event) +{ + QDialog::showEvent( event ); // NOLINT(bugprone-parent-virtual-call) + if ( event->spontaneous() ) + { + return; + } + if (isInitialized) + { + return; + } + // do your init stuff here + + const QSize sz = VAbstractApplication::VApp()->Settings()->GetDialogSplinePathSize(); + if (not sz.isEmpty()) + { + resize(sz); + } + + isInitialized = true;//first show windows are held + ShowVisualization(); + + CheckState(); +} + +//--------------------------------------------------------------------------------------------------------------------- +void DialogSplinePath::resizeEvent(QResizeEvent *event) +{ + // remember the size for the next time this dialog is opened, but only + // if widget was already initialized, which rules out the resize at + // dialog creating, which would + if (isInitialized) + { + VAbstractApplication::VApp()->Settings()->SetDialogSplinePathSize(size()); + } + QDialog::resizeEvent(event); +} + //--------------------------------------------------------------------------------------------------------------------- void DialogSplinePath::SetNotes(const QString ¬es) { diff --git a/src/libs/vtools/dialogs/tools/dialogsplinepath.h b/src/libs/vtools/dialogs/tools/dialogsplinepath.h index 203a5c87f..beef24689 100644 --- a/src/libs/vtools/dialogs/tools/dialogsplinepath.h +++ b/src/libs/vtools/dialogs/tools/dialogsplinepath.h @@ -70,6 +70,8 @@ protected: virtual void SaveData() override; virtual void closeEvent(QCloseEvent *event) override; virtual bool IsValid() const final; + void showEvent( QShowEvent *event ) override; + void resizeEvent(QResizeEvent *event) override; private slots: void PointChanged(int row); void currentPointChanged(int index); diff --git a/src/libs/vtools/dialogs/tools/dialogsplinepath.ui b/src/libs/vtools/dialogs/tools/dialogsplinepath.ui index 8638f1340..2df1d2fd3 100644 --- a/src/libs/vtools/dialogs/tools/dialogsplinepath.ui +++ b/src/libs/vtools/dialogs/tools/dialogsplinepath.ui @@ -6,8 +6,8 @@ 0 0 - 460 - 677 + 576 + 707 @@ -20,907 +20,926 @@ - + - - - 0 + + + true - - - Tool - - + + + + 0 + 0 + 556 + 656 + + + - - - + + + 0 + + + + Tool + + - + - - - Point: - - + + + + + + + Point: + + + + + + + + + + + + First control point + + + + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + Length: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Formula wizard + + + ... + + + + :/icon/24x24/fx.png:/icon/24x24/fx.png + + + + 24 + 24 + + + + + + + + + + + :/icon/24x24/equal.png + + + + + + + + 0 + 0 + + + + + 87 + 0 + + + + Value + + + _ + + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 28 + + + + Calculation + + + true + + + + + + + + 18 + 18 + + + + + 0 + 0 + + + + <html><head/><body><p>Show full calculation in message box</p></body></html> + + + + + + + .. + + + + 16 + 16 + + + + true + + + + + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + Angle: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Formula wizard + + + ... + + + + :/icon/24x24/fx.png:/icon/24x24/fx.png + + + + 24 + 24 + + + + + + + + + + + :/icon/24x24/equal.png + + + + + + + + 0 + 0 + + + + + 87 + 0 + + + + Value + + + _ + + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 28 + + + + Calculation + + + true + + + + + + + + 18 + 18 + + + + + 0 + 0 + + + + <html><head/><body><p>Show full calculation in message box</p></body></html> + + + + + + + .. + + + + 16 + 16 + + + + true + + + + + + + + + + + + + + Second control point + + + + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + Length: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Formula wizard + + + ... + + + + :/icon/24x24/fx.png:/icon/24x24/fx.png + + + + 24 + 24 + + + + + + + + + + + :/icon/24x24/equal.png + + + + + + + + 0 + 0 + + + + + 87 + 0 + + + + Value + + + _ + + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 28 + + + + Calculation + + + true + + + + + + + + 18 + 18 + + + + + 0 + 0 + + + + <html><head/><body><p>Show full calculation in message box</p></body></html> + + + + + + + .. + + + + 16 + 16 + + + + true + + + + + + + + + + + + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 255 + 0 + 0 + + + + + + + + + 159 + 158 + 158 + + + + + + + + Angle: + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Formula wizard + + + ... + + + + :/icon/24x24/fx.png:/icon/24x24/fx.png + + + + 24 + 24 + + + + + + + + + + + :/icon/24x24/equal.png + + + + + + + + 0 + 0 + + + + + 87 + 0 + + + + Value + + + _ + + + + + + + + + + + + 0 + 0 + + + + + 16777215 + 28 + + + + Calculation + + + true + + + + + + + + 18 + 18 + + + + + 0 + 0 + + + + <html><head/><body><p>Show full calculation in message box</p></body></html> + + + + + + + .. + + + + 16 + 16 + + + + true + + + + + + + + + + + - + + + List of points + + - - - First control point + + + QFormLayout::ExpandingFieldsGrow - - - - - - - - - - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 159 - 158 - 158 - - - - - - - - Length: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Formula wizard - - - ... - - - - :/icon/24x24/fx.png:/icon/24x24/fx.png - - - - 24 - 24 - - - - - - - - - - - :/icon/24x24/equal.png - - - - - - - - 0 - 0 - - - - - 87 - 0 - - - - Value - - - _ - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 28 - - - - Calculation - - - true - - - - - - - - 18 - 18 - - - - - 0 - 0 - - - - <html><head/><body><p>Show full calculation in message box</p></body></html> - - - - - - - .. - - - - 16 - 16 - - - - true - - - - - - - - - - - - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 159 - 158 - 158 - - - - - - - - Angle: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Formula wizard - - - ... - - - - :/icon/24x24/fx.png:/icon/24x24/fx.png - - - - 24 - 24 - - - - - - - - - - - :/icon/24x24/equal.png - - - - - - - - 0 - 0 - - - - - 87 - 0 - - - - Value - - - _ - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 28 - - - - Calculation - - - true - - - - - - - - 18 - 18 - - - - - 0 - 0 - - - - <html><head/><body><p>Show full calculation in message box</p></body></html> - - - - - - - .. - - - - 16 - 16 - - - - true - - - - - - - - - + + + + Color: + + + + + + + + + + Name: + + + + + + + true + + + + + + + Pen style: + + + + + + + + 80 + 0 + + + + + 110 + 16777215 + + + + + 80 + 14 + + + + + + + + Approximation scale: + + + + + + + Set approximation scale for this curve, 0 - use global value + + + 1 + + + 10.000000000000000 + + + 0.100000000000000 + + + + + + + Alias: + + + + + + + - - - Second control point + + + Qt::Vertical - - - - - - - - - - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 159 - 158 - 158 - - - - - - - - Length: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Formula wizard - - - ... - - - - :/icon/24x24/fx.png:/icon/24x24/fx.png - - - - 24 - 24 - - - - - - - - - - - :/icon/24x24/equal.png - - - - - - - - 0 - 0 - - - - - 87 - 0 - - - - Value - - - _ - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 28 - - - - Calculation - - - true - - - - - - - - 18 - 18 - - - - - 0 - 0 - - - - <html><head/><body><p>Show full calculation in message box</p></body></html> - - - - - - - .. - - - - 16 - 16 - - - - true - - - - - - - - - - - - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 255 - 0 - 0 - - - - - - - - - 159 - 158 - 158 - - - - - - - - Angle: - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Formula wizard - - - ... - - - - :/icon/24x24/fx.png:/icon/24x24/fx.png - - - - 24 - 24 - - - - - - - - - - - :/icon/24x24/equal.png - - - - - - - - 0 - 0 - - - - - 87 - 0 - - - - Value - - - _ - - - - - - - - - - - - 0 - 0 - - - - - 16777215 - 28 - - - - Calculation - - - true - - - - - - - - 18 - 18 - - - - - 0 - 0 - - - - <html><head/><body><p>Show full calculation in message box</p></body></html> - - - - - - - .. - - - - 16 - 16 - - - - true - - - - - - - - - + + + 20 + 40 + + + - - - - - List of points - - - - - - - - - QFormLayout::ExpandingFieldsGrow - - - - - Color: - - - - - - - - - - Name: - - - - - - - true - - - - - - - Pen style: - - - - - - - - 80 - 0 - - - - - 110 - 16777215 - - - - - 80 - 14 - - - - - - - - Approximation scale: - - - - - - - Set approximation scale for this curve, 0 - use global value - - - 1 - - - 10.000000000000000 - - - 0.100000000000000 - - - - - - - Alias: - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Notes - - - - + + + + Notes + + + + + + + +