Fixed issue #479. Improve feature: The Preferences dialog box should be expandable.
--HG-- branch : feature
This commit is contained in:
parent
15c99de75e
commit
98b232930f
|
@ -87,14 +87,20 @@ ConfigDialog::ConfigDialog(QWidget *parent) :
|
||||||
|
|
||||||
QVBoxLayout *mainLayout = new QVBoxLayout;
|
QVBoxLayout *mainLayout = new QVBoxLayout;
|
||||||
mainLayout->addLayout(horizontalLayout);
|
mainLayout->addLayout(horizontalLayout);
|
||||||
mainLayout->addStretch(1);
|
//mainLayout->addStretch(1);
|
||||||
mainLayout->addSpacing(12);
|
//mainLayout->addSpacing(12);
|
||||||
mainLayout->addLayout(buttonsLayout);
|
mainLayout->addLayout(buttonsLayout);
|
||||||
|
mainLayout->setStretch(0, 1);
|
||||||
setLayout(mainLayout);
|
setLayout(mainLayout);
|
||||||
|
|
||||||
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -145,12 +151,29 @@ void ConfigDialog::showEvent(QShowEvent *event)
|
||||||
}
|
}
|
||||||
// do your init stuff here
|
// do your init stuff here
|
||||||
|
|
||||||
setMaximumSize(size());
|
//setMaximumSize(size());
|
||||||
setMinimumSize(size());
|
if (s_iMinWidth > 0 && s_iMinHeight > 0)
|
||||||
|
{
|
||||||
|
setMinimumSize(s_iMinWidth, s_iMinHeight);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setMinimumSize(size());
|
||||||
|
s_iMinWidth = width();
|
||||||
|
s_iMinHeight = height();
|
||||||
|
}
|
||||||
|
|
||||||
isInitialized = true;//first show windows are held
|
isInitialized = true;//first show windows are held
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void ConfigDialog::resizeEvent(QResizeEvent *)
|
||||||
|
{
|
||||||
|
// remember the size for the next time this dialog is opened
|
||||||
|
s_iLastWidth = width();
|
||||||
|
s_iLastHeight = height();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void ConfigDialog::createIcons()
|
void ConfigDialog::createIcons()
|
||||||
{
|
{
|
||||||
|
@ -217,3 +240,8 @@ 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,6 +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;
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(ConfigDialog)
|
Q_DISABLE_COPY(ConfigDialog)
|
||||||
QListWidget *contentsWidget;
|
QListWidget *contentsWidget;
|
||||||
|
@ -61,6 +62,13 @@ 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();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user