Skip to content

Commit

Permalink
Merge pull request #287 from kumattau/pyside6-exec_
Browse files Browse the repository at this point in the history
PR: Map exec_ to their non-deprecated alternatives
  • Loading branch information
dalthviz authored Nov 26, 2021
2 parents 53ce7b0 + eafc078 commit 016e8c5
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 1 deletion.
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

0 comments on commit 016e8c5

Please sign in to comment.