QSql.TableType is wrong enum type in PyQt6

Phil Thompson phil at riverbankcomputing.com
Mon Mar 30 10:54:10 BST 2026


On 28/03/2026 13:37, ekhumoro wrote:
> Hello Phil
> 
> Previously, it was possible to OR together the values of
> QSql.TableType, but it's no longer possible to do this in PyQt6, as
> it's wrongly defined as an opaque enum, thus causing a regression when
> porting from PyQt5. In the Qt source, TableType is declared as an
> ordinary unscoped int enum, but it's clear from the docs that its
> members are meant to be used as flags:
> 
>     https://doc.qt.io/qt-6/qsql.html#TableType-enum
> 
> Of course, it's possible to work around the issue like this:
> 
>     flags = QSql.TableType(QSql.TableType.Tables.value |
> QSql.TableType.Views.value))
> 
> but it would be much nicer if the enum worked as intended. Could it
> please be converted to an enum type that supports the appropriate
> binary operators?

It will be in the next release.

Thanks,
Phil


More information about the PyQt mailing list