From ea5e78e822c83ff072202a2710a86fbabe03d8c6 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 25 Apr 2023 13:53:56 +0200 Subject: [PATCH] Examples/Marketplace: Put separator into heading for expanded view too Amends e596ee2b68f359397c7828c71f206e906d81cbe7 Change-Id: I888942bab2d330e8e8028e01017e7599a8fa567d Reviewed-by: Reviewed-by: Alessandro Portale --- src/plugins/coreplugin/welcomepagehelper.cpp | 21 ++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/plugins/coreplugin/welcomepagehelper.cpp b/src/plugins/coreplugin/welcomepagehelper.cpp index 62f8ef6054a..4826984d3d9 100644 --- a/src/plugins/coreplugin/welcomepagehelper.cpp +++ b/src/plugins/coreplugin/welcomepagehelper.cpp @@ -723,6 +723,15 @@ void SectionedGridView::setSearchString(const QString &searchString) filterModel->setSearchString(searchString); } +static QWidget *createSeparator(QWidget *parent) +{ + QWidget *line = Layouting::createHr(parent); + QSizePolicy linePolicy(QSizePolicy::Expanding, QSizePolicy::Ignored); + linePolicy.setHorizontalStretch(2); + line->setSizePolicy(linePolicy); + return line; +} + ListModel *SectionedGridView::addSection(const Section §ion, const QList &items) { auto model = new ListModel(this); @@ -747,12 +756,8 @@ ListModel *SectionedGridView::addSection(const Section §ion, const QList" + Tr::tr("Show All") + " >", this); seeAllLink->setVisible(gridView->maxRows().has_value()); connect(seeAllLink, &QLabel::linkActivated, this, [this, section] { zoomInSection(section); }); - QWidget *line = createHr(this); - QSizePolicy linePolicy(QSizePolicy::Expanding, QSizePolicy::Ignored); - linePolicy.setHorizontalStretch(2); - line->setSizePolicy(linePolicy); - QWidget *sectionLabel = Row{section.name, line, seeAllLink, Space(HSpacing)}.emerge( - Layouting::WithoutMargins); + QWidget *sectionLabel = Row{section.name, createSeparator(this), seeAllLink, Space(HSpacing)} + .emerge(Layouting::WithoutMargins); m_sectionLabels.append(sectionLabel); sectionLabel->setContentsMargins(0, ItemGap, 0, 0); sectionLabel->setFont(Core::WelcomePageHelpers::brandFont()); @@ -804,8 +809,8 @@ void SectionedGridView::zoomInSection(const Section §ion) delete zoomedInWidget; setCurrentIndex(0); }); - QWidget *sectionLabel = Column{hr, Row{section.name, st, backLink, Space(HSpacing)}}.emerge( - Layouting::WithoutMargins); + QWidget *sectionLabel = Row{section.name, createSeparator(this), backLink, Space(HSpacing)} + .emerge(Layouting::WithoutMargins); sectionLabel->setContentsMargins(0, ItemGap, 0, 0); sectionLabel->setFont(Core::WelcomePageHelpers::brandFont());