Aligning text on QLabel with Style Sheets in PyQt6
Phil Thompson
phil at riverbankcomputing.com
Fri Oct 1 18:40:59 BST 2021
On 01/10/2021 16:32, RedHuli wrote:
> 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.
PyQt has never supported Q_PROPERTY.
Phil
More information about the PyQt
mailing list