From 2e09d03cd117af39e81e08eb06513d6fbe921ab9 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 Pick-to: 6.5 Change-Id: Id10483b26937a97899d656c4b26f27b37b8d39b6 Reviewed-by: Juha Vuolle --- 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 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;