Re: Qt/PyQt 5.9.x. Correct way to get an "enumeration flags" to return 0?
J Barchan <[email protected]>
| Newsgroups | gmane.comp.python.pyqt-pykde |
|---|---|
| Message-ID | <CABz3M_9uX8SL3qmyjx5zV4WDbZioFZQfDcqRWVT6EaaOWj1kcg@mail.gmail.com> |
On Wed, 10 Jul 2019 at 21:28, Barry Scott <[email protected]> wrote: > > > On 10 Jul 2019, at 11:55, J Barchan <[email protected]> wrote: > > If I return QOrientations() that works, but I'm unsure if that guarantees > to return zero. > > > I've not tried this - not ready to update Qt yet - does this print 0 to > confirm the value in the enum? > > print( int( QOrientations()) > > Barry > > I confirm that int( QOrientations() ) returns 0. Assuming that is consistent/deliberate and not random (which I imagine it is) I guess that is what I will use here. I am still a little troubled by the fact that I can convert enum to int via int(QOrientations(enum_value)) but have trouble converting int to enum via QOrientations(int_value). However the latter does seem to be a PyCharm IDE warning ("Unexpected type 'int', expected 'Orientations', 'Orientation'") but works at run-time, so I guess it's OK even if I cannot find a formula which works without warning. It would be nice to see a PyQt expert statement on what is the correct way to handle this not-unusual requirement.... -- Kindest, Jonathan _______________________________________________ PyQt mailing list [email protected] https://www.riverbankcomputing.com/mailman/listinfo/pyqt