Aligning text on QLabel with Style Sheets in PyQt6

RedHuli redhuli.comments at gmail.com
Fri Oct 1 16:32:38 BST 2021


Hello,

I have a quick question. Back in PyQt5, I could use stylesheets and QObject
properties for aligning text, like so:
label = QLabel("Test")
label.setStyleSheet("qproperty-alignment: AlignCenter")

I know I can use label.setAlignment(Qt.AlignmentFlag.AlignCenter) in PyQt6.
label.setAlignement(Qt.AlignmentFlag.AlignCenter)

What I was more so curious about is if Q_PROPERTY is still available in
PyQt6. I haven't seen anything about it being removed. I assume that I can
still use it and that something is wrong with my syntax.

Thanks for your help!

Joshua Willman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20211001/13fd6bfa/attachment.htm>


More information about the PyQt mailing list