QWebPage and non-GUI app
Hi to all!!
This is my first post in this forum. I’m learning Qt and I’m trying to manipulate some web pages from a console qt app.
I started this little program because in the QWebPage documentation there is the following statement, that maybe, I’m not getting correctly (Qt 4.6.3):
“This class is not part of the Qt GUI Framework Edition.
This class was introduced in Qt 4.4.”
I understood that this class can be used even in a “widget-less” application, am I wrong?
If this is not the case what does the “This class is not part of the Qt GUI Framework Edition” statement mean?
However, if I try to instantiate a QWebPage in a simple object’s constructor the program crashes prompting this:
QWidget: Cannot create a QWidget when no GUI is being used.
Is there a way to use QtWebkit capabilities in a console app ??
If an object does not inherit QWidget, you can usually use it in a non-gui application. However, this one seems particularly geared towards providing something for a GUI (menu’s and stuff). However, they state in the documentation that you should be able to use it in a widget-less environment.
QWebPage holds a main frame responsible for web content, settings, the history of navigated links and actions. This class can be used, together with QWebFrame, to provide functionality like QWebView in a widget-less environment.
I’ve tested it and it seems to want to create a QPushButton.
> I understood that this class can be used even in a “widget-less” application, am I wrong?
Widget less in the sense no QWidget. You can render on any windows surface (graphics view for example, like the new QGraphicsWebView).
> This class is not part of the Qt GUI Framework Edition.
This just says QtWebKit is not a part of Qt GUI.
> Is there a way to use QtWebkit capabilities in a console app ??
You do a console app with QtWebKit, but you still need the dependency on QtGui and a connection to the graphic server (if only in order to get the fonts…). There are plenty of such tool, look at http://code.google.com/p/wkhtmltopdf/ for example.
The “Qt GUI Framework Edition” is one of the editions of the comertial licenses.
Does anyone have any ideas which versions of Qt have this problem and which versions don’t? I tried it on 4.6.3 and it has the problem and was wondering if anyone could recommend a version which doesn’t (maybe the prerelease versions of 4.7?).
I need to compile the versions and don’t really want to compile another version only to find that it also doesn’t work (It takes me 4-5 hours to compile).