Skip to content

Commit

Permalink
Readd 'QAction' to QtWidgets with Qt version validation
Browse files Browse the repository at this point in the history
  • Loading branch information
dalthviz committed Dec 13, 2024
1 parent 6643eac commit b938c9d
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions qtpy/QtWidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,20 @@ def __getattr__(name):
elif PYQT6:
from PyQt6 import QtWidgets
from PyQt6.QtGui import (
QAction,
QActionGroup,
QFileSystemModel,
QShortcut,
QUndoCommand,
)

if parse(_qt_version) < parse("6.4"):
# Make `QAction.setShortcut` and `QAction.setShortcuts` compatible with Qt>=6.4
# See spyder-ide/qtpy#461
from qtpy.QtGui import QAction
else:
from PyQt6.QtGui import QAction

from PyQt6.QtWidgets import *

# Attempt to import QOpenGLWidget, but if that fails,
Expand Down Expand Up @@ -110,9 +119,15 @@ def __getattr__(name):
from PySide2.QtWidgets import *
elif PYSIDE6:
from PySide6.QtGui import QActionGroup, QShortcut, QUndoCommand
from PySide6.QtWidgets import *

from qtpy.QtGui import QAction # See spyder-ide/qtpy#461
if parse(_qt_version) < parse("6.4"):
# Make `QAction.setShortcut` and `QAction.setShortcuts` compatible with Qt>=6.4
# See spyder-ide/qtpy#461
from qtpy.QtGui import QAction
else:
from PySide6.QtGui import QAction

from PySide6.QtWidgets import *

# Attempt to import QOpenGLWidget, but if that fails,
# don't raise an exception until the name is explicitly accessed.
Expand Down

0 comments on commit b938c9d

Please sign in to comment.