Welcome: Relax the SideBar spacings a bit

I got a new Laptop with 720px screen height (actually 1440px with 200%
scaling). That causes an unpleasant scrollbar in the SideBar, even with
fullscreen maximized Qt Creator.

This makes the spaces between the three content blocks shrinkable.

Change-Id: I188a38580cc59b410ecf25fa2422a8d94a44b9f0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Alessandro Portale
2017-12-14 12:32:19 +01:00
parent ce86831781
commit b3dd52b30f

View File

@@ -90,6 +90,15 @@ static QPalette lightText()
return pal; return pal;
} }
static void addWeakVerticalSpacerToLayout(QVBoxLayout *layout, int maximumSize)
{
auto weakSpacer = new QWidget;
weakSpacer->setMaximumHeight(maximumSize);
weakSpacer->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Maximum);
layout->addWidget(weakSpacer);
layout->setStretchFactor(weakSpacer, 1);
}
class WelcomeMode : public IMode class WelcomeMode : public IMode
{ {
Q_OBJECT Q_OBJECT
@@ -218,13 +227,14 @@ public:
l->setContentsMargins(lrPadding, 0, lrPadding, 0); l->setContentsMargins(lrPadding, 0, lrPadding, 0);
l->setSpacing(19); l->setSpacing(19);
vbox->addItem(l); vbox->addItem(l);
vbox->addSpacing(62);
} }
addWeakVerticalSpacerToLayout(vbox, 62);
{ {
auto l = new QVBoxLayout; auto l = new QVBoxLayout;
l->setContentsMargins(lrPadding, 0, lrPadding, 0); l->setContentsMargins(lrPadding, 0, lrPadding, 0);
l->setSpacing(8); l->setSpacing(12);
auto newLabel = new QLabel(tr("New to Qt?"), this); auto newLabel = new QLabel(tr("New to Qt?"), this);
newLabel->setFont(sizedFont(18, this)); newLabel->setFont(sizedFont(18, this));
@@ -240,7 +250,7 @@ public:
learnLabel->setPalette(lightText()); learnLabel->setPalette(lightText());
l->addWidget(learnLabel); l->addWidget(learnLabel);
l->addSpacing(12); l->addSpacing(8);
auto getStartedButton = new WelcomePageButton(this); auto getStartedButton = new WelcomePageButton(this);
getStartedButton->setText(tr("Get Started Now")); getStartedButton->setText(tr("Get Started Now"));
@@ -250,9 +260,10 @@ public:
l->addWidget(getStartedButton); l->addWidget(getStartedButton);
vbox->addItem(l); vbox->addItem(l);
vbox->addSpacing(77);
} }
vbox->addStretch(1);
{ {
auto l = new QVBoxLayout; auto l = new QVBoxLayout;
l->setContentsMargins(0, 0, 0, 0); l->setContentsMargins(0, 0, 0, 0);
@@ -265,7 +276,7 @@ public:
vbox->addItem(l); vbox->addItem(l);
} }
vbox->addStretch(1); addWeakVerticalSpacerToLayout(vbox, vbox->contentsMargins().top());
} }
QVBoxLayout *m_pluginButtons = nullptr; QVBoxLayout *m_pluginButtons = nullptr;