Remember Formula Wizard dialog size.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-06-16 17:05:35 +03:00
parent 67928c16a2
commit 61dcc52965
6 changed files with 48 additions and 9 deletions

View File

@ -72,6 +72,7 @@ const QString settingGeneralWindowState = QStringLiteral("windowState")
const QString settingGeneralToolbarsState = QStringLiteral("toolbarsState");
const QString settingPreferenceDialogSize = QStringLiteral("preferenceDialogSize");
const QString settingToolSeamAllowanceDialogSize = QStringLiteral("toolSeamAllowanceDialogSize");
const QString settingFormulaWizardDialogSize = QStringLiteral("formulaWizardDialogSize");
const QString settingLatestSkippedVersion = QStringLiteral("lastestSkippedVersion");
const QString settingDateOfLastRemind = QStringLiteral("dateOfLastRemind");
const QString settingUserDefinedMaterials = QStringLiteral("configuration/userDefinedMaterials");
@ -571,6 +572,18 @@ void VCommonSettings::SetToolSeamAllowanceDialogSize(const QSize &sz)
setValue(settingToolSeamAllowanceDialogSize, sz);
}
//---------------------------------------------------------------------------------------------------------------------
QSize VCommonSettings::GetFormulaWizardDialogSize() const
{
return value(settingFormulaWizardDialogSize, QSize(0, 0)).toSize();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetFormulaWizardDialogSize(const QSize &sz)
{
setValue(settingFormulaWizardDialogSize, sz);
}
//---------------------------------------------------------------------------------------------------------------------
int VCommonSettings::GetLatestSkippedVersion() const
{

View File

@ -123,6 +123,9 @@ public:
QSize GetToolSeamAllowanceDialogSize() const;
void SetToolSeamAllowanceDialogSize(const QSize& sz);
QSize GetFormulaWizardDialogSize() const;
void SetFormulaWizardDialogSize(const QSize& sz);
int GetLatestSkippedVersion() const;
void SetLatestSkippedVersion(int value);

View File

@ -350,14 +350,38 @@ void DialogEditWrongFormula::closeEvent(QCloseEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::showEvent(QShowEvent *event)
{
DialogTool::showEvent( event );
QDialog::showEvent( event );
if ( event->spontaneous() )
{
return;
}
setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
setMinimumSize(QSize(0, 0));
if (isInitialized)
{
return;
}
// do your init stuff here
const QSize sz = qApp->Settings()->GetFormulaWizardDialogSize();
if (not sz.isEmpty())
{
resize(sz);
}
isInitialized = true;//first show windows are held
}
//---------------------------------------------------------------------------------------------------------------------
void DialogEditWrongFormula::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)
{
qApp->Settings()->SetFormulaWizardDialogSize(size());
}
DialogTool::resizeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -91,6 +91,7 @@ protected:
virtual void CheckState() Q_DECL_FINAL;
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
virtual void showEvent( QShowEvent *event ) Q_DECL_OVERRIDE;
virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
private slots:
void FilterVariablesEdited(const QString &filter);
private:

View File

@ -89,7 +89,6 @@ DialogSeamAllowance::DialogSeamAllowance(const VContainer *data, const quint32 &
m_tabPins(new QWidget),
m_tabPassmarks(new QWidget),
m_ftb(new FancyTabBar(FancyTabBar::Left, this)),
m_isInitialized(false),
applyAllowed(false),// By default disabled
flagGPin(true),
flagDPin(true),
@ -432,7 +431,7 @@ void DialogSeamAllowance::showEvent(QShowEvent *event)
return;
}
if (m_isInitialized)
if (isInitialized)
{
return;
}
@ -444,20 +443,20 @@ void DialogSeamAllowance::showEvent(QShowEvent *event)
resize(sz);
}
m_isInitialized = true;//first show windows are held
isInitialized = true;//first show windows are held
}
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::resizeEvent(QResizeEvent *event)
{
Q_UNUSED(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 (m_isInitialized)
if (isInitialized)
{
qApp->Settings()->SetToolSeamAllowanceDialogSize(size());
}
DialogTool::resizeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -174,7 +174,6 @@ private:
FancyTabBar* m_ftb;
bool m_isInitialized;
bool applyAllowed;
bool flagGPin;
bool flagDPin;