Can someone please explain why on God's green earth the network classes __need__ GUI QWidget resources?
This makes them completely unusable from a console app.
Has someone filed a bug?
Printable View
Can someone please explain why on God's green earth the network classes __need__ GUI QWidget resources?
This makes them completely unusable from a console app.
Has someone filed a bug?
What makes you think they do? QtNetwork4 is not dependent on QtGui4 on my machine.Quote:
Can someone please explain why on God's green earth the network classes __need__ GUI QWidget resources?
Really? This program compiles and runs fine without Gui:Quote:
This makes them completely unusable from a console app.
It has "QT -= gui" in the PRO file and is consequently not linked to QtGui4.Code:
#include <QtCore> #include <QtNetwork> #include <QDebug> Q_OBJECT public: reply = nam.get(QNetworkRequest(url)); connect(reply, SIGNAL(finished()), SLOT(slotFinished())); } public slots: void slotFinished() { qDebug() << Q_FUNC_INFO << "Error" << reply->error(); qDebug() << ba; reply->deleteLater(); emit finished(); } signals: void finished(); private: QNetworkAccessManager nam; QNetworkReply *reply; }; int main(int argc, char *argv[]) { Fetcher f; return app.exec(); } #include "main.moc"
Plenty of people have filed bugs. This is not a bug though.Quote:
Has someone filed a bug?
Try adding QWebPage and QWebElementCollection. Even though you turn everything off and have it set to display absolutely nothing, it still needs the GUI. Why would anyone do this? To identify/verify site content with a crawler on a server.
QtWebkit is a Qt-esque wrapper around the Webkit browser (not crawler) library. If you use Webkit or QtWebkit, which has a browser widget whether you use it or not, then you need the rendering library (QtGUI in this case). QWebPage has a bunch of GUI rendering functionality that you cannot avoid. If you don't like it, don't use QtWebkit or do the work to separate non-GUI from GUI components of WebKit and contribute it to the community. Depending on your exact requirements there are other ways to go about parsing the muck called HTML.
Only partly true. You have to use QApplication but you do not need to display a GUI. On Linux X11 libraries must be present, and you can fake a running X server with Xvfb. For example, a headless QtWebKit program that extracts image links from www.google.com:Quote:
This makes them completely unusable from a console app.
Code:
$ unset DISPLAY $ ./grab grab: cannot connect to X server $ Xvfb 2>/dev/null >&2 :10 & $ DISPLAY=:10 ./grab Image at: "/images/icons/product/chrome-48.png" Image at: "/logos/2012/montessori-hp.jpg"