PDA

View Full Version : qt webkit



kernel_panic
4th November 2007, 16:23
hi!
full of luck, after i found the qt webkit, i started to program, when i noticed that i dont know WHAT to program. i searched for a docu.... nothing.

now my queston:
does anybody know wheres a doku for qt webkit or could give me some code that shows me how to use the webkit as qtextbrowser.

i want use the webkit for formatting chat messages. like kopete does. they use khtml, but im programming a multiplatform chat, so i need the webkit....

wysota
4th November 2007, 17:03
I know I suggested webkit as an option, but do you really need it? Maybe it's easier to write a simple style sheet parser (or take the one present in Qt that parses its stylesheets) and use the result to manipulate the char format of the text document? I doubt you need really complex things and it should take you less than an hour to have colours, decorations, font sizes, font styles and similar up and running. Using WebKit for this is like shooting a fly with an elephant gun.

kernel_panic
4th November 2007, 17:17
no i need full support of all css and html features. and i read the kopete code. they use khtml, too. aaand i dont want to add a new styling system, because the existing are good and work fine.
i know, that it seems like shooting on a fly, but i suggest to do more than formatting in my chat. when its finished youll see wherefore i need full support;)

but back to the question: do you know where i can find a doku or how i can use it like a qtextbrowser?
i think i found out how to set a url, but i need to set html text...

wysota
4th November 2007, 17:35
I'm not suggesting any new styling system. QTextCharFormat is part of Qt (contrary to WebKit which is currently a separate branch/product). Kopete uses khtml because it's part of KDE, so it has the dependency anyway. I don't know what functionality you desire exactly, but I doubt you're after something from CSS3 or something that QTextDocument can't handle - at least I can't think of any use of those in an instant messanger application. If you really need all the html/css capabilities, then indeed you might be needing WebKit, but if it's only for formatting messages, I'd think twice before using it.

pherthyl
4th November 2007, 18:50
You might consider looking at the webkitpart source in KDE for an example of how to use it.

http://websvn.kde.org/trunk/playground/libs/webkitkde/

kernel_panic
4th November 2007, 20:03
ye, the same example which is with the webkit....
but i need to set html content not an url...