Fixed issue #479. Improve feature: The Preferences dialog box in Valentina and Tape should be expandable.
--HG-- branch : feature
This commit is contained in:
parent
1738972c85
commit
96b2d28604
|
@ -1,5 +1,5 @@
|
||||||
# Version 0.5.0
|
# Version 0.5.0
|
||||||
- [#479] Preferences dialog is now extendable and when it is opened again, it will be resized to its previous size
|
- [#479] Preferences dialog is now extendable and when it is opened again, it will be resized to its previous size.
|
||||||
- [#193] Undeletable zombie arc objects.
|
- [#193] Undeletable zombie arc objects.
|
||||||
- New feature. Groups.
|
- New feature. Groups.
|
||||||
- Tool "Curve intersect axis" store data about subpaths.
|
- Tool "Curve intersect axis" store data about subpaths.
|
||||||
|
|
|
@ -147,12 +147,30 @@ void TapeConfigDialog::showEvent(QShowEvent *event)
|
||||||
}
|
}
|
||||||
// do your init stuff here
|
// do your init stuff here
|
||||||
|
|
||||||
setMaximumSize(size());
|
|
||||||
setMinimumSize(size());
|
setMinimumSize(size());
|
||||||
|
|
||||||
|
QSize sz = qApp->Settings()->GetPreferenceDialogSize();
|
||||||
|
if (sz.isEmpty() == false)
|
||||||
|
{
|
||||||
|
resize(sz);
|
||||||
|
}
|
||||||
|
|
||||||
isInitialized = true;//first show windows are held
|
isInitialized = true;//first show windows are held
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void TapeConfigDialog::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 (isInitialized == true)
|
||||||
|
{
|
||||||
|
qApp->Settings()->SetPreferenceDialogSize(size());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void TapeConfigDialog::createIcons()
|
void TapeConfigDialog::createIcons()
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,6 +50,7 @@ protected:
|
||||||
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
|
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
|
||||||
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
|
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
|
||||||
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
||||||
|
virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(TapeConfigDialog)
|
Q_DISABLE_COPY(TapeConfigDialog)
|
||||||
QListWidget *contentsWidget;
|
QListWidget *contentsWidget;
|
||||||
|
|
|
@ -87,8 +87,7 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
mainLayout->addLayout(horizontalLayout);
|
mainLayout->addLayout(horizontalLayout);
|
||||||
//mainLayout->addStretch(1);
|
mainLayout->addSpacing(12);
|
||||||
//mainLayout->addSpacing(12);
|
|
||||||
mainLayout->addLayout(buttonsLayout);
|
mainLayout->addLayout(buttonsLayout);
|
||||||
mainLayout->setStretch(0, 1);
|
mainLayout->setStretch(0, 1);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
@ -96,11 +95,6 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
|
||||||
setWindowTitle(tr("Config Dialog"));
|
setWindowTitle(tr("Config Dialog"));
|
||||||
|
|
||||||
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
qApp->Settings()->GetOsSeparator() ? setLocale(QLocale::system()) : setLocale(QLocale(QLocale::C));
|
||||||
|
|
||||||
if (s_iLastWidth > 0 && s_iLastHeight > 0)
|
|
||||||
{
|
|
||||||
resize(s_iLastWidth, s_iLastHeight);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -151,27 +145,28 @@ void ConfigDialog::showEvent(QShowEvent *event)
|
||||||
}
|
}
|
||||||
// do your init stuff here
|
// do your init stuff here
|
||||||
|
|
||||||
//setMaximumSize(size());
|
|
||||||
if (s_iMinWidth > 0 && s_iMinHeight > 0)
|
|
||||||
{
|
|
||||||
setMinimumSize(s_iMinWidth, s_iMinHeight);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
setMinimumSize(size());
|
setMinimumSize(size());
|
||||||
s_iMinWidth = width();
|
|
||||||
s_iMinHeight = height();
|
QSize sz = qApp->Settings()->GetPreferenceDialogSize();
|
||||||
|
if (sz.isEmpty() == false)
|
||||||
|
{
|
||||||
|
resize(sz);
|
||||||
}
|
}
|
||||||
|
|
||||||
isInitialized = true;//first show windows are held
|
isInitialized = true;//first show windows are held
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void ConfigDialog::resizeEvent(QResizeEvent *)
|
void ConfigDialog::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
// remember the size for the next time this dialog is opened
|
Q_UNUSED(event);
|
||||||
s_iLastWidth = width();
|
// remember the size for the next time this dialog is opened, but only
|
||||||
s_iLastHeight = height();
|
// if widget was already initialized, which rules out the resize at
|
||||||
|
// dialog creating, which would
|
||||||
|
if (isInitialized == true)
|
||||||
|
{
|
||||||
|
qApp->Settings()->SetPreferenceDialogSize(size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -240,8 +235,3 @@ void ConfigDialog::RetranslateUi()
|
||||||
contentsWidget->item(3)->setText(tr("Paths"));
|
contentsWidget->item(3)->setText(tr("Paths"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
|
||||||
int ConfigDialog::s_iLastWidth = 0;
|
|
||||||
int ConfigDialog::s_iLastHeight = 0;
|
|
||||||
int ConfigDialog::s_iMinWidth = 0;
|
|
||||||
int ConfigDialog::s_iMinHeight = 0;
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ protected:
|
||||||
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
|
virtual void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;
|
||||||
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
|
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
|
||||||
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
virtual void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
|
||||||
virtual void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE;
|
virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(ConfigDialog)
|
Q_DISABLE_COPY(ConfigDialog)
|
||||||
QListWidget *contentsWidget;
|
QListWidget *contentsWidget;
|
||||||
|
@ -62,13 +62,6 @@ private:
|
||||||
QPushButton *cancelButton;
|
QPushButton *cancelButton;
|
||||||
QPushButton *okButton;
|
QPushButton *okButton;
|
||||||
bool isInitialized;
|
bool isInitialized;
|
||||||
// the following static variables are used to preserve the dialog size when it
|
|
||||||
// is opened again and to hold the minimum size (which will be determined when
|
|
||||||
// the dialog is opened for the first time)
|
|
||||||
static int s_iLastWidth;
|
|
||||||
static int s_iLastHeight;
|
|
||||||
static int s_iMinWidth;
|
|
||||||
static int s_iMinHeight;
|
|
||||||
void createIcons();
|
void createIcons();
|
||||||
void createIcon(const QString &icon, const QString &text);
|
void createIcon(const QString &icon, const QString &text);
|
||||||
void Apply();
|
void Apply();
|
||||||
|
|
|
@ -64,6 +64,7 @@ const QString VCommonSettings::SettingGeneralRestoreFileList = QString
|
||||||
const QString VCommonSettings::SettingGeneralGeometry = QStringLiteral("geometry");
|
const QString VCommonSettings::SettingGeneralGeometry = QStringLiteral("geometry");
|
||||||
const QString VCommonSettings::SettingGeneralWindowState = QStringLiteral("windowState");
|
const QString VCommonSettings::SettingGeneralWindowState = QStringLiteral("windowState");
|
||||||
const QString VCommonSettings::SettingGeneralToolbarsState = QStringLiteral("toolbarsState");
|
const QString VCommonSettings::SettingGeneralToolbarsState = QStringLiteral("toolbarsState");
|
||||||
|
const QString VCommonSettings::SettingPreferenceDialogSize = QStringLiteral("preferenceDialogSize");
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
VCommonSettings::VCommonSettings(Format format, Scope scope, const QString &organization,
|
VCommonSettings::VCommonSettings(Format format, Scope scope, const QString &organization,
|
||||||
|
@ -414,3 +415,15 @@ void VCommonSettings::SetToolbarsState(const QByteArray &value)
|
||||||
{
|
{
|
||||||
setValue(SettingGeneralToolbarsState, value);
|
setValue(SettingGeneralToolbarsState, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
QSize VCommonSettings::GetPreferenceDialogSize() const
|
||||||
|
{
|
||||||
|
return value(SettingPreferenceDialogSize, QSize(0, 0)).toSize();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VCommonSettings::SetPreferenceDialogSize(const QSize& sz)
|
||||||
|
{
|
||||||
|
setValue(SettingPreferenceDialogSize, sz);
|
||||||
|
}
|
||||||
|
|
|
@ -99,6 +99,9 @@ public:
|
||||||
QByteArray GetToolbarsState() const;
|
QByteArray GetToolbarsState() const;
|
||||||
void SetToolbarsState(const QByteArray &value);
|
void SetToolbarsState(const QByteArray &value);
|
||||||
|
|
||||||
|
QSize GetPreferenceDialogSize() const;
|
||||||
|
void SetPreferenceDialogSize(const QSize& sz);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VCommonSettings)
|
Q_DISABLE_COPY(VCommonSettings)
|
||||||
|
|
||||||
|
@ -124,6 +127,7 @@ private:
|
||||||
static const QString SettingGeneralGeometry;
|
static const QString SettingGeneralGeometry;
|
||||||
static const QString SettingGeneralWindowState;
|
static const QString SettingGeneralWindowState;
|
||||||
static const QString SettingGeneralToolbarsState;
|
static const QString SettingGeneralToolbarsState;
|
||||||
|
static const QString SettingPreferenceDialogSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VCOMMONSETTINGS_H
|
#endif // VCOMMONSETTINGS_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user