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);
}
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)
{
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);
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 &section)
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());