rsslisting example: move default URL to main()
It felt more natural that the RSSListing class would be agnostic about the default URL, so let it be a constructor parameter. In the process, update the URL to what the old one now redirects to (thanks to Ivan Solovev for spotting that) and make the constructor explcit (thaks to Ievgenii Meshcheriakov for suggesting this). Task-number: QTBUG-111228 Pick-to: 6.5 Change-Id: I9f4c0d126e0872bb4ec6e6bb41add7e9d2a9537f Reviewed-by: Ievgenii Meshcheriakov <ievgenii.meshcheriakov@qt.io>
This commit is contained in:
parent
3cdc65c2ec
commit
233ca06500
@ -9,6 +9,7 @@ Provides the main function for the RSS news reader example.
|
||||
|
||||
#include "rsslisting.h"
|
||||
#include <QtWidgets>
|
||||
using namespace Qt::StringLiterals;
|
||||
|
||||
/*!
|
||||
Create an application and a main widget. Open the main widget for
|
||||
@ -19,7 +20,7 @@ Provides the main function for the RSS news reader example.
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
QApplication app(argc, argv);
|
||||
RSSListing rsslisting;
|
||||
RSSListing rsslisting(u"https://www.qt.io/blog/rss.xml"_s);
|
||||
rsslisting.show();
|
||||
return app.exec();
|
||||
}
|
||||
|
@ -32,12 +32,12 @@ its operation, and also allows very large data sources to be read.
|
||||
news.
|
||||
*/
|
||||
|
||||
RSSListing::RSSListing(QWidget *parent)
|
||||
RSSListing::RSSListing(const QString &url, QWidget *parent)
|
||||
: QWidget(parent), currentReply(0)
|
||||
{
|
||||
|
||||
lineEdit = new QLineEdit(this);
|
||||
lineEdit->setText("http://blog.qt.io/feed/");
|
||||
lineEdit->setText(url);
|
||||
|
||||
fetchButton = new QPushButton(tr("Fetch"), this);
|
||||
|
||||
|
@ -21,7 +21,7 @@ class RSSListing : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RSSListing(QWidget *widget = nullptr);
|
||||
explicit RSSListing(const QString &url = QString(), QWidget *widget = nullptr);
|
||||
|
||||
public slots:
|
||||
void fetch();
|
||||
|
Loading…
Reference in New Issue
Block a user