Allow resizing Spline path dialog.

This commit is contained in:
Roman Telezhynskyi 2022-09-05 14:38:26 +03:00
parent c51559e0ef
commit 4c3b6a899c
6 changed files with 963 additions and 886 deletions

View File

@ -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.

View File

@ -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
{

View File

@ -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);

View File

@ -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 &notes)
{

View File

@ -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);

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>460</width>
<height>677</height>
<width>576</width>
<height>707</height>
</rect>
</property>
<property name="windowTitle">
@ -20,6 +20,21 @@
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>556</width>
<height>656</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QTabWidget" name="tabWidget">
@ -926,6 +941,10 @@
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">