diff options
author | Katja Marttila <katja.marttila@qt.io> | 2019-09-24 10:19:30 +0300 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2019-10-30 08:14:52 +0000 |
commit | 64e656846eb11be5aef4ee729ac83e37bd40f207 (patch) | |
tree | 45f8c94880059a07b558152a2efcdc67edea42bd | |
parent | 7dd35b336fbaa78e5f3b347c5e1875743d146fb0 (diff) |
Use grid layout in component selection page
The layout in component selection page looked bad, especially in macOS
with dark mode as the widgets were not aligned properly vertically.
Task-number: QTIFW-1334
Change-Id: I718b7eaded78906027ce227671e955afda50c264
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Reviewed-by: Antti Kokko <antti.kokko@qt.io>
-rw-r--r-- | src/libs/installer/componentselectionpage_p.cpp | 21 | ||||
-rw-r--r-- | src/libs/installer/componentselectionpage_p.h | 3 |
2 files changed, 14 insertions, 10 deletions
diff --git a/src/libs/installer/componentselectionpage_p.cpp b/src/libs/installer/componentselectionpage_p.cpp index e1b9649a7..917dae4c1 100644 --- a/src/libs/installer/componentselectionpage_p.cpp +++ b/src/libs/installer/componentselectionpage_p.cpp @@ -85,6 +85,7 @@ ComponentSelectionPagePrivate::ComponentSelectionPagePrivate(ComponentSelectionP m_descriptionVLayout->addWidget(m_descriptionScrollArea); m_sizeLabel = new QLabel(q); + m_sizeLabel->setMargin(5); m_sizeLabel->setWordWrap(true); m_sizeLabel->setObjectName(QLatin1String("ComponentSizeLabel")); m_descriptionVLayout->addWidget(m_sizeLabel); @@ -128,8 +129,6 @@ ComponentSelectionPagePrivate::ComponentSelectionPagePrivate(ComponentSelectionP m_uncheckAll->setText(ComponentSelectionPage::tr("&Deselect All")); buttonHLayout->addWidget(m_uncheckAll); - m_treeViewVLayout->addLayout(buttonHLayout); - m_metadataProgressLabel = new QLabel(); m_metadataProgressLabel->hide(); m_treeViewVLayout->addWidget(m_metadataProgressLabel); @@ -151,9 +150,12 @@ ComponentSelectionPagePrivate::ComponentSelectionPagePrivate(ComponentSelectionP connect(q, &ComponentSelectionPage::left, m_core, &PackageManagerCore::clearComponentsToInstallCalculated); - m_mainHLayout = new QHBoxLayout(q); - m_mainHLayout->addLayout(m_treeViewVLayout, 3); - m_mainHLayout->addLayout(m_descriptionVLayout, 2); + m_mainGLayout = new QGridLayout(q); + m_mainGLayout->addLayout(buttonHLayout, 0, 1); + m_mainGLayout->addLayout(m_treeViewVLayout, 1, 1); + m_mainGLayout->addLayout(m_descriptionVLayout, 1, 2); + m_mainGLayout->setColumnStretch(1, 3); + m_mainGLayout->setColumnStretch(2, 2); #ifdef INSTALLCOMPRESSED allowCompressedRepositoryInstall(); @@ -200,6 +202,7 @@ void ComponentSelectionPagePrivate::setupCategoryLayout() return; m_categoryWidget = new QWidget(); QVBoxLayout *vLayout = new QVBoxLayout; + vLayout->setContentsMargins(0, 0, 0, 0); m_categoryWidget->setLayout(vLayout); m_categoryGroupBox = new QGroupBox(q); m_categoryGroupBox->setTitle(m_core->settings().repositoryCategoryDisplayName()); @@ -224,7 +227,7 @@ void ComponentSelectionPagePrivate::setupCategoryLayout() vLayout->addWidget(m_categoryGroupBox); vLayout->addStretch(); - m_mainHLayout->insertWidget(0, m_categoryWidget); + m_mainGLayout->addWidget(m_categoryWidget, 1, 0); } void ComponentSelectionPagePrivate::showCategoryLayout(bool show) @@ -372,19 +375,19 @@ void ComponentSelectionPagePrivate::updateWidgetVisibility(bool show) QSpacerItem *verticalSpacer2 = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding); m_treeViewVLayout->addSpacerItem(verticalSpacer2); - m_mainHLayout->removeItem(m_descriptionVLayout); + m_mainGLayout->removeItem(m_descriptionVLayout); //Hide next button during category fetch QPushButton *const b = qobject_cast<QPushButton *>(q->gui()->button(QWizard::NextButton)); b->setEnabled(!show); } else { QSpacerItem *item = m_treeViewVLayout->spacerItem(); m_treeViewVLayout->removeItem(item); - m_mainHLayout->addLayout(m_descriptionVLayout, 2); + m_mainGLayout->addLayout(m_descriptionVLayout, 1, 2); //Call completeChanged() to determine if NextButton should be shown or not after category fetch. q->completeChanged(); } if (m_categoryWidget) - m_categoryWidget->setDisabled(show); + m_categoryWidget->setVisible(!show); m_progressBar->setVisible(show); m_metadataProgressLabel->setVisible(show); diff --git a/src/libs/installer/componentselectionpage_p.h b/src/libs/installer/componentselectionpage_p.h index 6169a06f5..591cd08f7 100644 --- a/src/libs/installer/componentselectionpage_p.h +++ b/src/libs/installer/componentselectionpage_p.h @@ -44,6 +44,7 @@ class QListWidgetItem; class QProgressBar; class QVBoxLayout; class QHBoxLayout; +class QGridLayout; namespace QInstaller { @@ -98,7 +99,7 @@ private: QGroupBox *m_categoryGroupBox; QLabel *m_metadataProgressLabel; QProgressBar *m_progressBar; - QHBoxLayout *m_mainHLayout; + QGridLayout *m_mainGLayout; QVBoxLayout *m_treeViewVLayout; bool m_allowCompressedRepositoryInstall; ComponentModel *m_allModel; |