[Interest] How to develop a WYSIWYG HTML editor based on QtWebkit?
程梁
chengliang.soft at gmail.com
Wed Aug 8 05:35:44 CEST 2012
Thanks! I saw this example before. There is the same problem as I met.
If you clear editing area and type something, you will got some HTML
code like:
<!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</body></html>
in which I just write hey and I want to get
<p>hey</p>
as simple.
Thank you again!
2012/8/8 Josiah Bryan <josiahbryan at gmail.com>
> Have you seen http://labs.qt.nokia.com/2009/03/12/wysiwyg-html-editor/?
> I'm not sure if the example there will help with your problems at all. Just
> a guess, though - for your item #1 - the blog references using javascript
> code from c++ to interact. You could easily write a javascript function
> (heck, use jQuery too, if you want) to convert the DOM (or a node tree) to
> an HTML string. And the blog post even references viewing html with syntax
> highlighting.
>
> Anyway, just a heads-up to some prior work on the subject - you may have
> already seen it and know all about it. Just a thought anyway.
>
> Cheers!
> -Josiah
>
> On Tue, Aug 7, 2012 at 9:39 PM, 程梁 <chengliang.soft at gmail.com> wrote:
>
>> Hi, there!
>>
>> I'm trying to develop a WYSIWYG HTML editor based on QtWebkit, but
>> nowadays
>> I found some problems:
>>
>> 1. The HTML source code generated by QWebFrame::toHtml() is rather
>> complex,
>> for example, it will add a style in <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?
>>
>> 2. I want to format HTML generated by QWebFrame. I'm using QPlainTextEdit.
>> I could add syntax highlight by QSyntaxHighlighter, but how could I add
>> HTML formatter?
>> Maybe I could try QXMLFormatter, am I right? Or something else?
>>
>> Thank you for any suggestion!
>>
>> --
>> Cheng Liang <http://about.me/devbean>
>> Nanjing, China
>> http://www.devbean.info
>> from: devbean at devbean.info
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
>>
>>
>
>
> --
> Josiah Bryan
> 765-215-0511
> josiahbryan at gmail.com
>
--
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.qt-project.org/pipermail/interest/attachments/20120808/a0812101/attachment.html>
More information about the Interest
mailing list