Results 1 to 2 of 2

Thread:  appears in QTextBrowser

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Location
    Budapest, Hungary
    Posts
    125
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default  appears in QTextBrowser

    Hi,
    I have a QTextBrowser in my app, in which I post a html document with the "setHtml()" method. The problem is that there is always that srange "" at the top left corner.

    The file is saved in UTF-8, and I have read something that it is some encoding problem, but I can't find the Qt solution. I've tryed to give a html declaration for this in the head, (<meta http-equiv="content-Type" content="text/html; charset=utf-8">), but it did not work.
    Szilvi

  2. #2
    Join Date
    Nov 2010
    Location
    Budapest, Hungary
    Posts
    125
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re:  appears in QTextBrowser

    guess what I found!
    So the solution is: QString::fromUtf8

    Qt Code:
    1. QFile qfi(path);
    2. QString text;
    3. if(qfi.open(QIODevice::ReadOnly | QIODevice::Text))
    4. {
    5. while(!qfi.atEnd())
    6. {
    7. text.append(QString::fromUtf8(qfi.readLine()));
    8. }
    9. }
    To copy to clipboard, switch view to plain text mode 
    Szilvi

Similar Threads

  1. Text appears under the icon in QMenubar, how to?
    By Kevin Hoang in forum Qt Programming
    Replies: 1
    Last Post: 28th January 2011, 11:56
  2. QWidget::pos Appears Unreliable
    By mbrusati in forum Qt Programming
    Replies: 1
    Last Post: 25th February 2009, 17:01
  3. QPushButton appears differently
    By gianhut in forum Qt Tools
    Replies: 4
    Last Post: 5th January 2009, 22:08
  4. Text shifts when control appears...
    By MrGarbage in forum Qt Programming
    Replies: 4
    Last Post: 18th January 2008, 03:12

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.