View Full Version : Can a KHTMLPart be used without a window?

6th October 2006, 04:42
Howdy All.

I'm trying to get at some form data on HTML pages in
a dedicated data collection environment where there
is no display.

It would be very convenient to use the KDE DOM
methods as well. It seems like a natural choice.

However, even very simple programs like this

main(int argc, char *argv[])
QApplication *qa = new QApplication(argc, argv, false); // attempt non-gui operation
KHTMLPart *html = new KHTMLPart();

error out with:

QPixmap: Cannot create a QPixmap when no GUI is being used

Can I really not access the DOM and HTML parsing routines without a window?

If so, does anybody have a sense for how hard that might be to "fix"??

Finally, alternate suggestions are quite welcome!


6th October 2006, 05:25
I don't know about KHTML, so I can't help you there, but if you can use Qt 4, there are some great dom support classes.

Qt 4 DOM classes (http://doc.trolltech.com/4.2/qtxml.html#the-qt-dom-classes)

Just as a guess though, i think QPixmap uses native calls on the platforms Qt supports, I think it uses xlib stuff on linux and gdi stuff on windows. If so, then you need to able to use those libraries

6th October 2006, 05:27
Actually Qt 3 has similar classes too


6th October 2006, 15:21
Hey, thanks for chiming in!

Let me rephrase my question: I know QT and KDE have some great
DOM methods, that's why I'm here.

I'm trying to use them in a standalone environment where I have
no display. Therefore no X windows, and therefore, it appears,
not much access to QT and KDE other than the string functions...

Any pointers?

9th October 2006, 22:56
In Qt4 you can build console only projects. This is not possible with KDE3 as it's based on Qt3. KDE4 is not stable yet, I would not touch it.