How to find enum's in PyQt6?

Florian Bruhin me at the-compiler.org
Sun Jul 10 13:10:44 BST 2022


On Sun, Jul 10, 2022 at 12:13:28PM +0100, Barry Scott wrote:
> But I'm still none the wiser how to fix this:
> 
>    def _addMenu( self, menu, name, handler, enabler=None, icon_name=None,
> checker=None, group=None, role=QtWidgets
> .QAction.MenuRole.NoRole ):
> AttributeError: module 'PyQt6.QtWidgets' has no attribute 'QAction'
> 
> I am using the KDE build of Qt6/PyQt6 for Fedora copr that is version 6.2.3.
> 
> Is this a problem with this being an older version?

That's not really an enum-specific issue - just that QAction got moved
from QtWidgets to QtGui in Qt 6:

https://doc.qt.io/qt-6/widgets-changes-qt6.html#qaction-qactiongroup

Also see:

https://doc.qt.io/qt-6/qaction.html ("qmake: QT += gui") vs.
https://doc.qt.io/qt-5/qaction.html ("qmake: QT += widgets")

Here is the full list of changes per module:
https://doc.qt.io/qt-6/modulechanges.html

I'd recommend giving that a skim for all the modules you use in your
appliaction.

Florian

-- 
            me at the-compiler.org | https://www.qutebrowser.org 
       https://bruhin.software/ | https://github.com/sponsors/The-Compiler/
       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/20220710/16093c13/attachment.sig>


More information about the PyQt mailing list