[PyQt] using HTML in a QLabel

James Polk jpolk5001 at yahoo.com
Fri Dec 10 19:16:05 GMT 2010


Greetings All,..

I used PyQt's Designer to create a ".ui" file...
In this file, I created a simple QLabel, but I wanted/needed to
change the font, size, and color.

In Maya, there is a custom command (loadUI) that will automatically
interpret and display the UI correctly.

Separately, I used "pyuic" to convert the ".ui" file into a normal ".py" file..
When I run this from command line (outside of Maya) everything
displays properly except the QLabel.  Upon examining the 
pyuic-generated py commands, i see that the font, size and color
changes are achieved thru HTML ...like:

    self.thisLabel.setText(  <bunch of HTML>  )

I guess my question is...do I need to create a custom HTML delegate
to handle the rendering/painting of the HTML ?  Or is there an easier way ?

Finally,...in the delegate examples I've seen that handle HTML,
most seem to be used in conjunction with Tables, Trees,etc...
I tried to "setItemDelegate" on the QLabel, but it complains that
it's not a property,etc...so how does one associate a delegate
(if that's the solution) to a single graphical item ?

Any help or advice is very greatly appreciated..
Cheers,
James




      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20101210/7f7fb214/attachment.html>


More information about the PyQt mailing list