[PyQt] Rich text in buttons

Richard A. Litherland lither at math.lsu.edu
Sat Nov 21 19:54:53 GMT 2009


On Sat, 21 Nov 2009, Baz Walter wrote:

> Richard A. Litherland wrote:
>> I'm very new to this, so I apologize if this question has been asked 1000 
>> times before. The text property of QAbstractButton doesn't recognize HTML 
>> markup, but the developers of KCalc, at least, have managed to work around 
>> this. I can't figure out how. Does anybody know?
>
> well, i suppose the kde developers do :)
>
> so why not have a look at the kcalc source code?
>
> http://api.kde.org/4.3-api/kdeutils-apidocs/kcalc/html/kcalc__button_8cpp_source.html
>

I had, but was unable to find the relevant code. I've since discovered 
that it's in an override of QPushButton's paintEvent method. Now all I 
have to do is work out what's going on there... The author of the code 
doesn't seem entirely happy with the amount of work needed, since he or 
she includes the comment

   // rant: Qt4 needs QSimpleRichText, dammit!

Sorry for wasting your time; I should have looked harder before posting.

Rick L.
-- 
R.A. Litherland: <lither at math.lsu.edu>
Web page: http://www.math.lsu.edu/~lither/
Other web page: http://www.orangeclawhammer.net/
"Charity is a cold grey loveless thing." -- Clement Attlee


More information about the PyQt mailing list