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>
This commit is contained in:
parent
233ca06500
commit
fb2d4074c1
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user