Results 1 to 3 of 3

Thread: HTML special symbols problem in QLabel and QwtText

  1. #1
    Join Date
    Mar 2012
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default HTML special symbols problem in QLabel and QwtText

    Hi

    I have a problem with render special HTML symbols by QLabel and QwtText (I mean). Difficulty is in that the symbols render is wrong not always. It is with ƒ and Δ symbols somtimes.
    Google and forums was searched but with no results.
    I have read sources of QLabel painEvent() and QwtText::draw() methods to understand why that problems is, but not find anything helpful. There used QTextDocument::documentLayout()->draw(QPainter*, PaintContext) methods, but I realized html delegete for item views with these methonds and in the views it working fine.
    Than I have some dummy proxy style to render html in tabs of QTabWidget with QPlastiqueStyle and HtmlLineEdit and several other widget promoted classes with ability to render html, but with the QTextDocument::drawContents() is used there. It working fine everywhere and I don't understand why the wrong behaviour takes place.

    I have Qt 4.4.2 and qwt 6.0.1 libraries

    If someone can help with it will be great

  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: HTML special symbols problem in QLabel and QwtText

    These work fine here (Qt 4.7.4):
    Qt Code:
    1. // Force the text format
    2. QLabel *label1 = new QLabel(this);
    3. label1->setTextFormat(Qt::RichText);
    4. label1->setText("ƒ Δ");
    5.  
    6. // Qt::AutoText detects the HTML and goes rich text
    7. QLabel *label1 = new QLabel("<html><body>&fnof; &Delta;<body></html>", this);
    To copy to clipboard, switch view to plain text mode 
    and this does not because the rich text processing is not triggered:
    Qt Code:
    1. QLabel *label1 = new QLabel("&fnof; &Delta;", this);
    To copy to clipboard, switch view to plain text mode 

  3. The following 2 users say thank you to ChrisW67 for this useful post:

    Lawful_Evil (16th March 2012), rawfool (3rd July 2013)

  4. #3
    Join Date
    Mar 2012
    Posts
    2
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: HTML special symbols problem in QLabel and QwtText

    Thanks ChrisW67. It's helpful.
    In fact that these symbols have no any html tags in difference of other places where html is used and it go out of my mind.
    Thanks for help!

Similar Threads

  1. Write Qt program to a language with special symbols
    By hakermania in forum Qt Programming
    Replies: 9
    Last Post: 7th September 2010, 00:05
  2. Encode html special characters
    By miraks in forum Qt Programming
    Replies: 4
    Last Post: 21st September 2009, 08:51
  3. Special characters in Html blocks
    By giusepped in forum Qt Programming
    Replies: 4
    Last Post: 27th October 2008, 08:13
  4. Replies: 2
    Last Post: 14th January 2008, 18:09
  5. Display special symbols
    By ShaChris23 in forum Newbie
    Replies: 1
    Last Post: 30th April 2007, 23:51

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.