Remeber size of tool Seam allowance dialog between sessions. ref #683.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-05-30 11:47:27 +03:00
parent 156f259468
commit fb64c8d2e8
4 changed files with 59 additions and 10 deletions

View File

@ -64,15 +64,16 @@ const QString settingPatternForbidFlipping = QStringLiteral("pattern/forbidFlipp
const QString settingPatternHideMainPath = QStringLiteral("pattern/hideMainPath");
const QString settingDoublePassmark = QStringLiteral("pattern/doublePassmark");
const QString settingGeneralRecentFileList = QStringLiteral("recentFileList");
const QString settingGeneralRestoreFileList = QStringLiteral("restoreFileList");
const QString settingGeneralGeometry = QStringLiteral("geometry");
const QString settingGeneralWindowState = QStringLiteral("windowState");
const QString settingGeneralToolbarsState = QStringLiteral("toolbarsState");
const QString settingPreferenceDialogSize = QStringLiteral("preferenceDialogSize");
const QString settingLatestSkippedVersion = QStringLiteral("lastestSkippedVersion");
const QString settingDateOfLastRemind = QStringLiteral("dateOfLastRemind");
const QString settingUserDefinedMaterials = QStringLiteral("configuration/userDefinedMaterials");
const QString settingGeneralRecentFileList = QStringLiteral("recentFileList");
const QString settingGeneralRestoreFileList = QStringLiteral("restoreFileList");
const QString settingGeneralGeometry = QStringLiteral("geometry");
const QString settingGeneralWindowState = QStringLiteral("windowState");
const QString settingGeneralToolbarsState = QStringLiteral("toolbarsState");
const QString settingPreferenceDialogSize = QStringLiteral("preferenceDialogSize");
const QString settingToolSeamAllowanceDialogSize = QStringLiteral("toolSeamAllowanceDialogSize");
const QString settingLatestSkippedVersion = QStringLiteral("lastestSkippedVersion");
const QString settingDateOfLastRemind = QStringLiteral("dateOfLastRemind");
const QString settingUserDefinedMaterials = QStringLiteral("configuration/userDefinedMaterials");
const QString settingCSVWithHeader = QStringLiteral("csv/withHeader");
const QString settingCSVCodec = QStringLiteral("csv/withCodec");
@ -544,6 +545,18 @@ void VCommonSettings::SetPreferenceDialogSize(const QSize& sz)
setValue(settingPreferenceDialogSize, sz);
}
//---------------------------------------------------------------------------------------------------------------------
QSize VCommonSettings::GetToolSeamAllowanceDialogSize() const
{
return value(settingToolSeamAllowanceDialogSize, QSize(0, 0)).toSize();
}
//---------------------------------------------------------------------------------------------------------------------
void VCommonSettings::SetToolSeamAllowanceDialogSize(const QSize &sz)
{
setValue(settingToolSeamAllowanceDialogSize, sz);
}
//---------------------------------------------------------------------------------------------------------------------
int VCommonSettings::GetLatestSkippedVersion() const
{

View File

@ -120,6 +120,9 @@ public:
QSize GetPreferenceDialogSize() const;
void SetPreferenceDialogSize(const QSize& sz);
QSize GetToolSeamAllowanceDialogSize() const;
void SetToolSeamAllowanceDialogSize(const QSize& sz);
int GetLatestSkippedVersion() const;
void SetLatestSkippedVersion(int value);

View File

@ -89,6 +89,7 @@ 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),
@ -425,8 +426,38 @@ void DialogSeamAllowance::closeEvent(QCloseEvent *event)
//---------------------------------------------------------------------------------------------------------------------
void DialogSeamAllowance::showEvent(QShowEvent *event)
{
// Skip DialotTool implementation. For this tool don't need disable resizing because it uses a scroll area.
QDialog::showEvent( event );
if ( event->spontaneous() )
{
return;
}
if (m_isInitialized)
{
return;
}
// do your init stuff here
const QSize sz = qApp->Settings()->GetToolSeamAllowanceDialogSize();
if (not sz.isEmpty())
{
resize(sz);
}
m_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)
{
qApp->Settings()->SetToolSeamAllowanceDialogSize(size());
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -73,6 +73,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;
protected slots:
void UpdateList();
@ -173,6 +174,7 @@ private:
FancyTabBar* m_ftb;
bool m_isInitialized;
bool applyAllowed;
bool flagGPin;
bool flagDPin;