QSql.TableType is wrong enum type in PyQt6
ekhumoro
ekhumoro at gmx.com
Sat Mar 28 13:37:02 GMT 2026
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?
More information about the PyQt
mailing list