Do not force an artificially high minimum size on the options dialog

We want it to have a reasonable first-use size, but we can just set that
manually when opening it the first time. Afterwards the geometry is
restored from the settings.

All pages already have a vertical scrollbar available, but that also
forced a relatively large minimum size. Reduce this.

Fix-up of dba102ff61 and
63be3a4024

Fixes: QTCREATORBUG-21678
Change-Id: Iff5810b6ebfe51e3fe4da528bc859598c8df2bb4
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Eike Ziller
2018-12-17 16:32:17 +01:00
parent f377e81ca7
commit 6247b24392

View File

@@ -56,6 +56,11 @@
#include <QStyle>
#include <QStyledItemDelegate>
const int kInitialWidth = 750;
const int kInitialHeight = 450;
const int kMaxMinimumWidth = 250;
const int kMaxMinimumHeight = 250;
static const char pageKeyC[] = "General/LastPreferencePage";
const int categoryIconSize = 24;
@@ -362,8 +367,8 @@ private:
QSize minSize = inner->minimumSizeHint();
minSize += QSize(fw, fw);
minSize += QSize(scrollBarWidth(), 0);
minSize.setHeight(qMin(minSize.height(), 450));
minSize.setWidth(qMin(minSize.width(), 810));
minSize.setWidth(qMin(minSize.width(), kMaxMinimumWidth));
minSize.setHeight(qMin(minSize.height(), kMaxMinimumHeight));
return minSize;
}
return QSize(0, 0);
@@ -547,7 +552,6 @@ void SettingsDialog::createGui()
m_stackedLayout->setMargin(0);
QWidget *emptyWidget = new QWidget(this);
emptyWidget->setMinimumSize(QSize(500, 500));
m_stackedLayout->addWidget(emptyWidget); // no category selected, for example when filtering
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok |
@@ -740,6 +744,8 @@ bool SettingsDialog::execDialog()
static const QLatin1String kPreferenceDialogSize("Core/PreferenceDialogSize");
if (ICore::settings()->contains(kPreferenceDialogSize))
resize(ICore::settings()->value(kPreferenceDialogSize).toSize());
else
resize(kInitialWidth, kInitialHeight);
exec();
m_running = false;
m_instance = nullptr;