Return resizing Increments Dialog.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-07-26 09:13:29 +03:00
parent 4d7d2ac607
commit 1fff49936b
5 changed files with 60 additions and 4 deletions

View File

@ -864,6 +864,44 @@ bool DialogIncrements::eventFilter(QObject *object, QEvent *event)
return false;// pass the event to the widget
}
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::showEvent(QShowEvent *event)
{
// Skip DialogTool implementation
QDialog::showEvent(event);
if ( event->spontaneous() )
{
return;
}
if (isInitialized)
{
return;
}
// do your init stuff here
const QSize sz = qApp->Settings()->GetIncrementsDialogSize();
if (not sz.isEmpty())
{
resize(sz);
}
isInitialized = true;//first show windows are held
}
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::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()->SetIncrementsDialogSize(size());
}
DialogTool::resizeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogIncrements::ShowIncrementDetails()
{

View File

@ -47,13 +47,15 @@ class DialogIncrements : public DialogTool
{
Q_OBJECT
public:
DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent = nullptr);
virtual ~DialogIncrements() Q_DECL_OVERRIDE;
DialogIncrements(VContainer *data, VPattern *doc, QWidget *parent = nullptr);
virtual ~DialogIncrements() Q_DECL_OVERRIDE;
protected:
virtual void closeEvent ( QCloseEvent * event ) Q_DECL_OVERRIDE;
virtual void changeEvent ( QEvent * event) Q_DECL_OVERRIDE;
virtual bool eventFilter(QObject *object, QEvent *event) Q_DECL_OVERRIDE;
virtual void showEvent( QShowEvent *event ) Q_DECL_OVERRIDE;
virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
private slots:
void ShowIncrementDetails();
void AddIncrement();

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>979</width>
<height>729</height>
<width>800</width>
<height>497</height>
</rect>
</property>
<property name="minimumSize">

View File

@ -75,6 +75,7 @@ const QString settingGeneralWindowState = QStringLiteral("windowState")
const QString settingGeneralToolbarsState = QStringLiteral("toolbarsState");
const QString settingPreferenceDialogSize = QStringLiteral("preferenceDialogSize");
const QString settingToolSeamAllowanceDialogSize = QStringLiteral("toolSeamAllowanceDialogSize");
const QString settingIncrementsDialogSize = QStringLiteral("toolIncrementsDialogSize");
const QString settingFormulaWizardDialogSize = QStringLiteral("formulaWizardDialogSize");
const QString settingLatestSkippedVersion = QStringLiteral("lastestSkippedVersion");
const QString settingDateOfLastRemind = QStringLiteral("dateOfLastRemind");
@ -587,6 +588,18 @@ void VCommonSettings::SetFormulaWizardDialogSize(const QSize &sz)
setValue(settingFormulaWizardDialogSize, sz);
}
//---------------------------------------------------------------------------------------------------------------------
QSize VCommonSettings::GetIncrementsDialogSize() const
{
return value(settingIncrementsDialogSize, QSize(0, 0)).toSize();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetIncrementsDialogSize(const QSize &sz)
{
setValue(settingIncrementsDialogSize, sz);
}
//---------------------------------------------------------------------------------------------------------------------
int VCommonSettings::GetLatestSkippedVersion() const
{

View File

@ -126,6 +126,9 @@ public:
QSize GetFormulaWizardDialogSize() const;
void SetFormulaWizardDialogSize(const QSize& sz);
QSize GetIncrementsDialogSize() const;
void SetIncrementsDialogSize(const QSize& sz);
int GetLatestSkippedVersion() const;
void SetLatestSkippedVersion(int value);