Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Map exec_ to their non-deprecated alternatives #287

Merged
merged 1 commit into from
Nov 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions qtpy/QtCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
Qt.TextColorRole = Qt.ForegroundRole
Qt.MidButton = Qt.MiddleButton

# Map DeprecationWarning methods
QCoreApplication.exec_ = QCoreApplication.exec
QEventLoop.exec_ = QEventLoop.exec
QThread.exec_ = QThread.exec
QTextStreamManipulator.exec_ = QTextStreamManipulator.exec

elif PYSIDE2:
from PySide2.QtCore import *

Expand Down
6 changes: 5 additions & 1 deletion qtpy/QtGui.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


if PYQT6:
from PyQt6 import QtGui
from PyQt6 import QtGui
from PyQt6.QtGui import *

# Map missing/renamed methods
Expand All @@ -31,5 +31,9 @@
elif PYSIDE6:
from PySide6.QtGui import *
QFontMetrics.width = QFontMetrics.horizontalAdvance

# Map DeprecationWarning methods
QDrag.exec_ = QDrag.exec
QGuiApplication.exec_ = QGuiApplication.exec
else:
raise PythonQtError('No Qt bindings could be found')
3 changes: 3 additions & 0 deletions qtpy/QtPrintSupport.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
QPrintPreviewWidget.print_ = QPrintPreviewWidget.print
elif PYSIDE6:
from PySide6.QtPrintSupport import *
# Map DeprecationWarning methods
QPageSetupDialog.exec_ = QPageSetupDialog.exec
QPrintDialog.exec_ = QPrintDialog.exec
elif PYSIDE2:
from PySide2.QtPrintSupport import *
else:
Expand Down
4 changes: 4 additions & 0 deletions qtpy/QtSql.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
QSqlResult.exec_ = QSqlResult.exec
elif PYSIDE6:
from PySide6.QtSql import *
# Map DeprecationWarning methods
QSqlDatabase.exec_ = QSqlDatabase.exec
QSqlQuery.exec_ = QSqlQuery.exec
QSqlResult.exec_ = QSqlResult.exec
elif PYSIDE2:
from PySide2.QtSql import *
else:
Expand Down
5 changes: 5 additions & 0 deletions qtpy/QtWidgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
QTextEdit.tabStopWidth = QTextEdit.tabStopDistance
QPlainTextEdit.setTabStopWidth = QPlainTextEdit.setTabStopDistance
QPlainTextEdit.tabStopWidth = QPlainTextEdit.tabStopDistance

# Map DeprecationWarning methods
QApplication.exec_ = QApplication.exec
QDialog.exec_ = QDialog.exec
QMenu.exec_ = QMenu.exec
elif PYSIDE2:
from PySide2.QtWidgets import *
else:
Expand Down