summaryrefslogtreecommitdiffstats
path: root/examples/corelib
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2023-05-05 18:18:14 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2023-05-25 17:40:37 +0200
commit2e09d03cd117af39e81e08eb06513d6fbe921ab9 (patch)
tree1552dadebf688df9d36df9a18f1058c9bb3d5abf /examples/corelib
parent3c78f1e96e17f5becb6830ea473c1ed16ac261ea (diff)
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>
Diffstat (limited to 'examples/corelib')
-rw-r--r--examples/corelib/serialization/rsslisting/rsslisting.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/examples/corelib/serialization/rsslisting/rsslisting.cpp b/examples/corelib/serialization/rsslisting/rsslisting.cpp
index 27e3dbce793..805b6b51fc2 100644
--- a/examples/corelib/serialization/rsslisting/rsslisting.cpp
+++ b/examples/corelib/serialization/rsslisting/rsslisting.cpp
@@ -48,9 +48,7 @@ RSSListing::RSSListing(const QString &url, QWidget *parent)
connect(treeWidget, &QTreeWidget::itemActivated,
// Open the link in the browser:
this, [](QTreeWidgetItem *item) { QDesktopServices::openUrl(QUrl(item->text(1))); });
- QStringList headerLabels;
- headerLabels << tr("Title") << tr("Link");
- treeWidget->setHeaderLabels(headerLabels);
+ treeWidget->setHeaderLabels(QStringList { tr("Title"), tr("Link") });
treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
QHBoxLayout *hboxLayout = new QHBoxLayout;