Skip to content

Commit

Permalink
Merge pull request #358 from tlambert03/typing
Browse files Browse the repository at this point in the history
PR: Fix PyQt6 typing import for Qt
  • Loading branch information
dalthviz authored Jul 25, 2022
2 parents b3efba8 + 4ae7625 commit 469e8d1
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions qtpy/QtCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# -----------------------------------------------------------------------------

"""Provides QtCore classes and functions."""
from typing import TYPE_CHECKING

from . import PYQT6, PYQT5, PYSIDE2, PYSIDE6, QtBindingsNotFoundError

Expand Down Expand Up @@ -45,10 +46,11 @@
# Seems like there is an error with sip. Without first
# trying to import `PyQt6.QtGui.Qt`, some functions like
# `PyQt6.QtCore.Qt.mightBeRichText` are missing.
try:
from PyQt6.QtGui import Qt
except ImportError:
pass
if not TYPE_CHECKING:
try:
from PyQt6.QtGui import Qt
except ImportError:
pass

# Map missing methods
QCoreApplication.exec_ = QCoreApplication.exec
Expand Down

0 comments on commit 469e8d1

Please sign in to comment.