diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2023-05-05 18:20:55 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2023-05-15 14:02:46 +0200 |
commit | fb2d4074c18b0a47ee5b65e3145124f92d9fe1df (patch) | |
tree | 33ce668e8a8249bd1cd73d9cd80102eb73e49a3b | |
parent | 233ca06500245a3d61432a7edce1668aa4ce35c9 (diff) | |
download | qtbase-fb2d4074c18b0a47ee5b65e3145124f92d9fe1df.tar.gz |
rsslisting example: shuffle parts of constructor for clarity
Group related things together, improve the logical flow of the code.
Pick-to: 6.5
Task-number: QTBUG-111228
Change-Id: If3eb577b74128b305ca5fb3074168280ec2d4db8
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
-rw-r--r-- | examples/corelib/serialization/rsslisting/rsslisting.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/examples/corelib/serialization/rsslisting/rsslisting.cpp b/examples/corelib/serialization/rsslisting/rsslisting.cpp index 7c1f57ecc9..8316b17f20 100644 --- a/examples/corelib/serialization/rsslisting/rsslisting.cpp +++ b/examples/corelib/serialization/rsslisting/rsslisting.cpp @@ -35,11 +35,14 @@ its operation, and also allows very large data sources to be read. RSSListing::RSSListing(const QString &url, QWidget *parent) : QWidget(parent), currentReply(0) { + connect(&manager, &QNetworkAccessManager::finished, this, &RSSListing::finished); lineEdit = new QLineEdit(this); lineEdit->setText(url); + connect(lineEdit, &QLineEdit::returnPressed, this, &RSSListing::fetch); fetchButton = new QPushButton(tr("Fetch"), this); + connect(fetchButton, &QPushButton::clicked, this, &RSSListing::fetch); treeWidget = new QTreeWidget(this); connect(treeWidget, &QTreeWidget::itemActivated, @@ -49,18 +52,11 @@ RSSListing::RSSListing(const QString &url, QWidget *parent) treeWidget->setHeaderLabels(headerLabels); treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents); - connect(&manager, &QNetworkAccessManager::finished, - this, &RSSListing::finished); - - connect(lineEdit, &QLineEdit::returnPressed, this, &RSSListing::fetch); - connect(fetchButton, &QPushButton::clicked, this, &RSSListing::fetch); - - QVBoxLayout *layout = new QVBoxLayout(this); QHBoxLayout *hboxLayout = new QHBoxLayout; - hboxLayout->addWidget(lineEdit); hboxLayout->addWidget(fetchButton); + QVBoxLayout *layout = new QVBoxLayout(this); layout->addLayout(hboxLayout); layout->addWidget(treeWidget); |