Results 1 to 9 of 9

Thread: Inserting html and plain text in QTextEdit

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    Join Date
    Feb 2007
    Location
    Karlsruhe, Germany
    Posts
    469
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    17
    Thanked 90 Times in 88 Posts

    Default Re: Inserting html and plain text in QTextEdit

    Qt Code:
    1. #include <QtGui>
    2.  
    3. int main(int argc, char *argv[])
    4. {
    5. QApplication a(argc, argv);
    6.  
    7. QTextCursor cursor = te.textCursor();
    8. cursor.insertHtml("<a href='http://www.w3schools.com/'>Link!</a>oops<br>");
    9. cursor.insertHtml("<a href='http://www.w3schools.com/'>Link!</a>");
    10. cursor.insertHtml("something");
    11. cursor.insertHtml("<br>");
    12. cursor.insertHtml("<a href='http://www.w3schools.com/'>Link!</a>");
    13. cursor.insertText("something");
    14. te.show();
    15. return a.exec();
    16. }
    To copy to clipboard, switch view to plain text mode 
    LinkEdit..png
    So you are right.. this is unexpected beviour. But inserting as html seems to work..

    BTW:
    Qt Code:
    1. self.cursor = QTextCursor(self.textArea.document())
    To copy to clipboard, switch view to plain text mode 
    Is this correct for PyQt? Seems strange to me.

    Johannes
    Last edited by JohannesMunk; 13th April 2010 at 19:38.

Similar Threads

  1. How to convert text to HTML in QTextEdit
    By Roszko in forum Newbie
    Replies: 5
    Last Post: 31st December 2009, 09:40
  2. put html text into a qtextedit
    By dreamer in forum Qt Programming
    Replies: 2
    Last Post: 8th May 2008, 19:44
  3. QTextEdit + paste rich text as plain text only
    By Yong in forum Qt Programming
    Replies: 2
    Last Post: 6th February 2008, 16:45
  4. QTextEdit API questions (plain text)
    By Gaspar in forum Qt Programming
    Replies: 4
    Last Post: 16th May 2006, 06:03
  5. Problem with inserting text into QTextEdit
    By xorrr in forum Qt Programming
    Replies: 0
    Last Post: 6th February 2006, 11:45

Tags for this Thread

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
  •  
Qt is a trademark of The Qt Company.