Turn itemActivated() slot of RSS listing example into a lambda
It needs nothing but the parameter it is passed and has no material interaction with the rest of the RSSListing class, so there's no point devoting a slot to it, much less a public one. Task-number: QTBUG-111228 Pick-to: 6.5 Change-Id: I46d572982197550801c6fa4425453fc670c6f2f1 Reviewed-by: Marc Mutz <marc.mutz@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
parent
bdbfa7757a
commit
e7b1bc6590
@ -46,7 +46,8 @@ RSSListing::RSSListing(const QString &url, QWidget *parent)
|
||||
|
||||
treeWidget = new QTreeWidget(this);
|
||||
connect(treeWidget, &QTreeWidget::itemActivated,
|
||||
this, &RSSListing::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);
|
||||
@ -179,14 +180,6 @@ void RSSListing::parseXml()
|
||||
qWarning() << "XML ERROR:" << xml.lineNumber() << ": " << xml.errorString();
|
||||
}
|
||||
|
||||
/*
|
||||
Open the link in the browser
|
||||
*/
|
||||
void RSSListing::itemActivated(QTreeWidgetItem *item)
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl(item->text(1)));
|
||||
}
|
||||
|
||||
void RSSListing::error(QNetworkReply::NetworkError)
|
||||
{
|
||||
qWarning("error retrieving RSS feed");
|
||||
|
@ -28,7 +28,6 @@ public slots:
|
||||
void finished(QNetworkReply *reply);
|
||||
void readyRead();
|
||||
void metaDataChanged();
|
||||
void itemActivated(QTreeWidgetItem *item);
|
||||
void error(QNetworkReply::NetworkError);
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user