[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
nowadays
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
generate
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
same
with QWebFrame?

For example, the code I got will be

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "
http://www.w3.org/TR/html4/strict.dtd"><html><head>

<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

<p>hey</p>

<p>newline</p>

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
http://www.devbean.info
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