rsslisting example: use initializer list to construct string list

It's cleaner than declaring, using << to populate, then using once.
Just construct it and use it where it's needed.

Task-number: QTBUG-111228
Pick-to: 6.5
Change-Id: Id10483b26937a97899d656c4b26f27b37b8d39b6
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
This commit is contained in:
Edward Welbourne 2023-05-05 18:18:14 +02:00
parent 3c78f1e96e
commit 2e09d03cd1

View File

@ -48,9 +48,7 @@ RSSListing::RSSListing(const QString &url, QWidget *parent)
connect(treeWidget, &QTreeWidget::itemActivated, connect(treeWidget, &QTreeWidget::itemActivated,
// Open the link in the browser: // Open the link in the browser:
this, [](QTreeWidgetItem *item) { QDesktopServices::openUrl(QUrl(item->text(1))); }); this, [](QTreeWidgetItem *item) { QDesktopServices::openUrl(QUrl(item->text(1))); });
QStringList headerLabels; treeWidget->setHeaderLabels(QStringList { tr("Title"), tr("Link") });
headerLabels << tr("Title") << tr("Link");
treeWidget->setHeaderLabels(headerLabels);
treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents); treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
QHBoxLayout *hboxLayout = new QHBoxLayout; QHBoxLayout *hboxLayout = new QHBoxLayout;