25#include "rsslisting.h"
49 headerLabels <<
tr(
"Title") <<
tr(
"Link");
58 this,
SLOT(finished(
int,
bool)));
75 setWindowTitle(
tr(
"RSS listing example"));
98void RSSListing::fetch()
101 fetchButton->setEnabled(
false);
107 newInformation =
true;
111 handler =
new Handler;
113 xmlReader.setContentHandler(handler);
114 xmlReader.setErrorHandler(handler);
122 connectionId = http.get(
url.
path());
137void RSSListing::readData(
const QHttpResponseHeader &resp)
141 if (resp.statusCode() != 200)
144 xmlInput.setData(http.readAll());
146 if (newInformation) {
147 ok = xmlReader.parse(&xmlInput,
true);
148 newInformation =
false;
151 ok = xmlReader.parseContinue();
173void RSSListing::finished(
int id,
bool error)
176 qWarning(
"Received error during HTTP fetch.");
179 fetchButton->setEnabled(
true);
181 else if (
id == connectionId) {
183 bool ok = xmlReader.parseContinue();
185 qWarning(
"Parse error at the end of input.");
189 fetchButton->setEnabled(
true);
206 item->setText(1, link);
208 lastItemCreated =
item;
void addWidget(QWidget *, int stretch=0, Qt::Alignment alignment=Qt::Alignment())
Adds widget to the end of this box layout, with a stretch factor of stretch and alignment alignment.
void addLayout(QLayout *layout, int stretch=0)
Adds layout to the end of the box, with serial stretch factor stretch.
The QHBoxLayout class lines up widgets horizontally.
The QLineEdit widget is a one-line text editor.
QString text
the line edit's text.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString host(ComponentFormattingOptions=FullyDecoded) const
Returns the host of the URL if it is defined; otherwise an empty string is returned.
QString path(ComponentFormattingOptions options=FullyDecoded) const
Returns the path of the URL.
The QVBoxLayout class lines up widgets vertically.
DBusConnection const char DBusError * error
QUrl url("example.com")
[constructor-url-reference]
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
QPushButton * abortButton
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent