Results 1 to 2 of 2

Thread: QTextEdit insert and get html

  1. #1
    Join Date
    Jul 2012
    Posts
    40
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QTextEdit insert and get html

    Hi,
    I want to develop a QTextEdit, which allows the user to do some basic formatting(bold,italic,lists, ...). So the user inserts html tags like <b>text</b> and so on.
    After editing, the html should be stored in a database, but if I call toHtml() the output is different (with info about the font and so on. (The docu confirm that)). If I call toPlainText() the tags go away.

    Now I want to know I I have the possibility to get the html, the user inserted before...

    thank you
    Last edited by Qtonimo; 30th October 2012 at 15:24.
    Pursue your targets and don't give up....

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QTextEdit insert and get html

    If you are use the QTextEdit::toHtml() then the the text the user typed will be encoded inside the <body> element. Where the user typed in <> characters (and others) they will be encoded in the resulting HTML. Putting that HTML back will give the user the same text you started with.

    If you want the raw text the user typed, including the HTML markup as typed, then you probably should consider using a QPlainTextEdit.

Similar Threads

  1. QTextEdit insert html
    By abrahametalero in forum Newbie
    Replies: 4
    Last Post: 12th February 2011, 18:58
  2. insert number to qtextEdit
    By Jeneo W. in forum Qt Programming
    Replies: 8
    Last Post: 5th October 2010, 01:58
  3. Insert image in RTL QTextEdit problem!
    By SudaNix in forum Newbie
    Replies: 2
    Last Post: 23rd October 2009, 22:53
  4. QTextEdit slow to insert text
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 12:05
  5. Replies: 1
    Last Post: 21st March 2007, 14:13

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.