Results 1 to 2 of 2

Thread: QTextEdit::append help

  1. #1
    Join Date
    Sep 2007
    Posts
    16
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QTextEdit::append help

    I want to append the text into QTextEdit 1 line after another, but whenever I use append(), it gives a text then new empty line then the next text. How can I rewrite the append() to make it not insert the new line into QtextEdit ?
    like

    line1
    line2
    line3

    not like (with append())
    line1

    line2

    line3

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QTextEdit::append help

    QTextEdit::append() inserts a new block so you don't have to append any newline characters.

    I presume you have:
    Qt Code:
    1. textEdit->append("line1\n");
    2. textEdit->append("line2\n");
    3. textEdit->append("line3\n");
    To copy to clipboard, switch view to plain text mode 
    However, you should do:
    Qt Code:
    1. textEdit->append("line1");
    2. textEdit->append("line2");
    3. textEdit->append("line3");
    To copy to clipboard, switch view to plain text mode 
    J-P Nurmi

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.