[webkit-qt] Could QWebFrame generate simple HTML code?

程梁 chengliang.soft at gmail.com
Tue Aug 14 00:29:00 PDT 2012

Hey, I'm trying to develop a WYSIWYG HTML editor based on QtWebkit, but
I found a problem:

The HTML source code generated by QWebFrame::toHtml() is rather complex,
for example, it will add style to <body /> which is not necessary. Could I
the HTML source code by myself? If I use QTextEdit, I could loop all text
blocks and
try to create source code according to each block. But how could I do the
with QWebFrame?

For example, the code I got will be


<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<title>HTML Editor Demo</title>

</head><body style="word-wrap: break-word; -webkit-nbsp-mode: space;
-webkit-line-break: after-white-space; ">hey<div>newline</div></body></html>

in which I just write hey and I want to get



as simple.

The problem is the first line's code is without any tags and the second
line is warpped with <div>
which <p> should be better.

How could I solve this problem? Thank you!

Cheng Liang <http://about.me/devbean>
Nanjing, China
from: devbean at devbean.info
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20120814/291999e9/attachment.html>

More information about the webkit-qt mailing list