Qt.FocusPolicy and StrongFocus

Phil Thompson phil at riverbankcomputing.com
Tue Aug 16 19:58:03 BST 2022


On 15/08/2022 16:16, John Ehresman wrote:
> I’m seeing exceptions with PyQt 6.3.1 when converting a C++
> Qt.StrongFocus enum to a python enum when the int value is 10. I think
> what’s happening is that a StrongFocus value (11) is being set and
> then some code is clearing the TabFocus flag, leaving a value of 10 —
> I think the clearing of TabFocus happens in Qt C++ code, but I haven’t
> verified this. The following Python code demonstrates the problem:
> 
> p = Qt.FocusPolicy.StrongFocus
> i = p.value & ~Qt.FocusPolicy.TabFocus.value
> Qt.FocusPolicy(i)

Should be fixed in the next PyQt6 snapshot. The fix is to change /Flag/ 
to /IntFlag/ in the definition of FocusPolicy.

Thanks,
Phil


More information about the PyQt mailing list