Results 1 to 2 of 2

Thread: QTextEdit::toHtml() - get clear html

  1. #1
    Join Date
    Nov 2011
    Posts
    79
    Thanks
    5
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTextEdit::toHtml() - get clear html

    I use QTextEdit as HTML editor for templates in my application.
    So, when I save resulted HTML structure via toHtml() I get string looked like a garbage. QTextEdit inserts style to every tag. for example if I press enter new paragraph looks like
    Qt Code:
    1. <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Some text</p>
    To copy to clipboard, switch view to plain text mode 
    There is sence to add style to formatted text, for example, if I set text to "bold", result looks like
    Qt Code:
    1. <p style=" font-weight:600;">Bolded text</p>
    To copy to clipboard, switch view to plain text mode 
    but for what it inserts styles to paragraph without format?
    So my question - is there way to get "clean" HTML, without unwanted styles?

  2. #2
    Join Date
    Nov 2011
    Posts
    79
    Thanks
    5
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTextEdit::toHtml() - get clear html

    I've solved the problem.
    QTextEdit totally useless to edit HTML (limited HTML tags set, no external css files etc.) so I switched to WebKit (QWebView)
    Good example - https://qt.gitorious.org/qt-labs/gra...63a:htmleditor

Similar Threads

  1. QTextEdit and toHtml()
    By Qiieha in forum Qt Programming
    Replies: 2
    Last Post: 26th April 2013, 13:28
  2. QTextEdit and toHtml()
    By prof.ebral in forum Newbie
    Replies: 1
    Last Post: 27th June 2010, 15:16
  3. Can not clear paragraph in QTextEdit
    By December in forum Qt Programming
    Replies: 0
    Last Post: 26th December 2009, 04:57
  4. QTextEdit and Html
    By giusepped in forum Qt Programming
    Replies: 1
    Last Post: 28th October 2008, 17:20
  5. QTextEdit::toHtml()
    By lewis in forum Qt Programming
    Replies: 3
    Last Post: 20th July 2006, 14:31

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.