PDA

View Full Version : HTML special symbols problem in QLabel and QwtText



Lawful_Evil
14th March 2012, 07:17
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

ChrisW67
15th March 2012, 22:27
These work fine here (Qt 4.7.4):


// Force the text format
QLabel *label1 = new QLabel(this);
label1->setTextFormat(Qt::RichText);
label1->setText("ƒ Δ");

// Qt::AutoText detects the HTML and goes rich text
QLabel *label1 = new QLabel("<html><body>&fnof; &Delta;<body></html>", this);

and this does not because the rich text processing is not triggered:


QLabel *label1 = new QLabel("&fnof; &Delta;", this);

Lawful_Evil
16th March 2012, 06:55
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!