[PyQt] Getting parent class for an enum

Florian Bruhin me at the-compiler.org
Thu May 17 10:12:22 BST 2018

On Thu, May 17, 2018 at 09:50:13AM +0100, J Barchan wrote:
> ​I'm not sure whether ​I am hijacking a relevant thread, or whether this
> can already be done, but I would like to know how to (easily) get the
> symbolic string for an ItemDataRole constant:
> class MySqlQueryModel(QSqlQueryModel):
>     def data(self, index: QtCore.QModelIndex, role:
> QtCore.Qt.ItemDataRole=QtCore.Qt.DisplayRole) -> typing.Any:
>         print(role)
> ​How do I get to print that role as, say, "DisplayRole" instead of as 0,
> for debugging?​

I wrote something to do that here:


https://www.qutebrowser.org | me at the-compiler.org (Mail/XMPP)
   GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc
         I love long mails! | https://email.is-not-s.ms/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20180517/cde0a78f/attachment-0001.sig>

More information about the PyQt mailing list