PDA

View Full Version : QPushButton and HTML text



ivan.cukic
7th March 2007, 08:04
Ts there a way to force the QPushButton to render it's text as HTML as the QLabel does?

jpn
18th March 2007, 16:38
I'm afraid one has to subclass QPushButton and do the HTML text handling with help of a QTextDocument.

Ideas:

subclass QPushButton
do not pass any text to QPushButton
reimplement at least QWidget::sizeHint(), QWidget::minimumSizeHint() and QWidget::paintEvent()
in paintEvent(), let the base class draw it's "empty" contents first and then let the QTextDocument draw it's content over the button
check out the sources of QLabel in case you need tips how to implement aforementioned size hint methods

ivan.cukic
20th March 2007, 13:48
Thanks... I was hoping to avoid that whole mess :)