From 0fb6f9569dcafd1dfe91b7b1e50d8a034880aa7f Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Fri, 5 May 2023 18:18:14 +0200 Subject: [PATCH] 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 Change-Id: Id10483b26937a97899d656c4b26f27b37b8d39b6 Reviewed-by: Juha Vuolle (cherry picked from commit 2e09d03cd117af39e81e08eb06513d6fbe921ab9) Reviewed-by: Qt Cherry-pick Bot --- examples/corelib/serialization/rsslisting/rsslisting.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/examples/corelib/serialization/rsslisting/rsslisting.cpp b/examples/corelib/serialization/rsslisting/rsslisting.cpp index 8d59341d699..61088c74506 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;