Examples/Marketplace: Put separator into heading for expanded view too

Amends e596ee2b68

Change-Id: I888942bab2d330e8e8028e01017e7599a8fa567d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Eike Ziller
2023-04-25 13:53:56 +02:00
parent aeb2b458d0
commit ea5e78e822

View File

@@ -723,6 +723,15 @@ void SectionedGridView::setSearchString(const QString &searchString)
filterModel->setSearchString(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 &section, const QList<ListItem *> &items) ListModel *SectionedGridView::addSection(const Section &section, const QList<ListItem *> &items)
{ {
auto model = new ListModel(this); auto model = new ListModel(this);
@@ -747,12 +756,8 @@ ListModel *SectionedGridView::addSection(const Section &section, const QList<Lis
auto seeAllLink = new QLabel("<a href=\"link\">" + Tr::tr("Show All") + " &gt;</a>", this); auto seeAllLink = new QLabel("<a href=\"link\">" + Tr::tr("Show All") + " &gt;</a>", this);
seeAllLink->setVisible(gridView->maxRows().has_value()); seeAllLink->setVisible(gridView->maxRows().has_value());
connect(seeAllLink, &QLabel::linkActivated, this, [this, section] { zoomInSection(section); }); connect(seeAllLink, &QLabel::linkActivated, this, [this, section] { zoomInSection(section); });
QWidget *line = createHr(this); QWidget *sectionLabel = Row{section.name, createSeparator(this), seeAllLink, Space(HSpacing)}
QSizePolicy linePolicy(QSizePolicy::Expanding, QSizePolicy::Ignored); .emerge(Layouting::WithoutMargins);
linePolicy.setHorizontalStretch(2);
line->setSizePolicy(linePolicy);
QWidget *sectionLabel = Row{section.name, line, seeAllLink, Space(HSpacing)}.emerge(
Layouting::WithoutMargins);
m_sectionLabels.append(sectionLabel); m_sectionLabels.append(sectionLabel);
sectionLabel->setContentsMargins(0, ItemGap, 0, 0); sectionLabel->setContentsMargins(0, ItemGap, 0, 0);
sectionLabel->setFont(Core::WelcomePageHelpers::brandFont()); sectionLabel->setFont(Core::WelcomePageHelpers::brandFont());
@@ -804,8 +809,8 @@ void SectionedGridView::zoomInSection(const Section &section)
delete zoomedInWidget; delete zoomedInWidget;
setCurrentIndex(0); setCurrentIndex(0);
}); });
QWidget *sectionLabel = Column{hr, Row{section.name, st, backLink, Space(HSpacing)}}.emerge( QWidget *sectionLabel = Row{section.name, createSeparator(this), backLink, Space(HSpacing)}
Layouting::WithoutMargins); .emerge(Layouting::WithoutMargins);
sectionLabel->setContentsMargins(0, ItemGap, 0, 0); sectionLabel->setContentsMargins(0, ItemGap, 0, 0);
sectionLabel->setFont(Core::WelcomePageHelpers::brandFont()); sectionLabel->setFont(Core::WelcomePageHelpers::brandFont());