Results 1 to 2 of 2

Thread: QTextBrowser NewLine

  1. #1
    Join Date
    Jul 2008
    Posts
    139
    Thanks
    9
    Thanked 18 Times in 15 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default QTextBrowser NewLine

    Hi,
    I have a standard .txt file I am trying to display in a QTextBrowser widget. I create the (file.txt) from standard IO stream.
    If I view the (file.txt) in my editor it is properly formatted. However when I display the QTextBrowser widget the text is not formatted to the end of each line. Seems like it doesn't recognize the 'endl' -- new line in my text document.
    The text is wrapped until the end of the widget. I tried nowrapping but it doesn't work.
    for example (text.file):
    I want this.
    Item#1: Test item
    Item#2: Test 2 Item
    Item#3: Test 3 Item

    QTextBrowser displays this as
    Item#1: Test Item Item#2: Test 2 Item Item#3 Test 3 Item..(until end of widget)

    Thanks.

    EDIT*** My bad, fixed the problem
    inserted <pre> "my text" </pre>, at the beginning and end of the file.
    Last edited by QbelcorT; 17th January 2009 at 05:48.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QTextBrowser NewLine

    If you only want to display a pure text document without HTML, better use QPlainTextEdit with is editable set to false. It is much more efficient for your needs.

    Lykurg

Similar Threads

  1. link from QTextBrowser to QWebView
    By lamera in forum Qt Programming
    Replies: 4
    Last Post: 12th October 2008, 15:46
  2. Replies: 1
    Last Post: 5th August 2008, 20:44
  3. qtextbrowser stop scrolling on append
    By tpf80 in forum Qt Programming
    Replies: 2
    Last Post: 16th September 2007, 20:28
  4. [QT4] QtextBrowser and image size (win)
    By sebgui in forum Qt Programming
    Replies: 0
    Last Post: 28th March 2006, 21:01
  5. how to adjust sizes of QTextBrowser?
    By Pan Wojtas in forum Qt Programming
    Replies: 2
    Last Post: 7th February 2006, 22:25

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.