Reputation: 14671
I'm re-implementing QLabel()
by overriding its paintEvent.
What I'm doing is, to redraw the text 3 times in order to gain an emboss effect.
I'm using PyQT-PySide and the application is aimed for OS X, which does not support Qt's brilliant effects (shadow et al.). Therefore this is the solution I came up with.
Everything works fine except, implementation of setTextWrap(True)
. It fails.
What do I need to do to self.text()
in order to wrap it accordingly to fit into the label's box?
Thank you.
Upvotes: 0
Views: 587
Reputation: 14671
This is possible using the Qt.TextWordWrap
flag which is then added to the drawText() method of QPainter()
Example:
painter.drawText(self.rect(), self.alignment() | Qt.TextWordWrap, self.text())
Upvotes: 1