[PyQt] Is this the supported PyQt5 way to reset a flag?

Phil Thompson phil at riverbankcomputing.com
Tue Mar 8 09:09:57 GMT 2016


On 8 Mar 2016, at 6:29 am, Damon Lynch <damonlynch at gmail.com> wrote:
> 
> The Qt 5 docs specify enum Qt::AlignmentFlag and flags Qt::Alignment.
> 
> Obviously this is valid: 
> 
> layout.setAlignment(widget, Qt.AlignTop)
> 
> But is this supported? 
> 
> layout.setAlignment(widget, Qt.AlignmentFlag())
> 
> It has the effect of resetting the alignment flag, which is precisely what I want it to do.  Is that the supported way of resetting a flag? If this is already discussed in the docs please let me know as I've been unable to locate it.

Yes, or just pass 0. PyQt (for historical reasons) throws away much of the type safety that QFlags implements.

Phil


More information about the PyQt mailing list