Aligning text on QLabel with Style Sheets in PyQt6

RedHuli redhuli.comments at gmail.com
Fri Oct 1 19:05:42 BST 2021


Hello Phil,

Thank you for that clarification about Q_PROPERTY.

After doing a bit of research, I realize now that I had made an incorrect
assumption since I was using qproperty with style sheets.

Joshua Willman

On Fri, Oct 1, 2021 at 10:41 AM Phil Thompson <phil at riverbankcomputing.com>
wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20211001/dd282fce/attachment.htm>


More information about the PyQt mailing list