PDA

View Full Version : DrawText with stylesheet



yagabey
17th February 2017, 02:22
Hello,

I need to draw some text on a QGraphicsPixmapItem with stylesheet. Drawing text is straight forward by using the paintevent. But I couldnt find a way to apply a stylesheet on the text to be written.

I also considered using a QLabel inside a QGraphicsProxywidget and applying the stylesheet on QLabel; but i need to create hundreds of this type of items on GraphicsScene and since QGraphicsProxyWidget has performance problems, i dont want to use this approach.

Does anybody have any idea how can i apply a stylesheet to a text on QGraphicsPixmapItem?

Thanks in advance...

Added after 1 2 minutes:

I figured it out.
QTextDocumen's setDefaultStyleSheet and drawContens did the job..

Regards..