|
1 | | -# -*- coding: utf-8 -*- |
2 | 1 | # |
3 | 2 | # Copyright © 2014-2015 Colin Duquesnoy |
4 | 3 | # Copyright © 2009- The Spyder Development Team |
|
10 | 9 | Provides QtCore classes and functions. |
11 | 10 | """ |
12 | 11 |
|
13 | | -from . import PYQT5, PYSIDE2, PYSIDE6, PYQT4, PYSIDE, PythonQtError |
| 12 | +from . import PYQT6, PYQT5, PYSIDE2, PYSIDE6, PythonQtError |
14 | 13 |
|
| 14 | +if PYQT6: |
| 15 | + from PyQt6.QtCore import * |
| 16 | + from PyQt6.QtCore import pyqtSignal as Signal |
| 17 | + from PyQt6.QtCore import QT_VERSION_STR as __version__ |
15 | 18 |
|
16 | | -if PYQT5: |
| 19 | + QCoreApplication.exec_ = QCoreApplication.exec |
| 20 | + QEventLoop.exec_ = QEventLoop.exec |
| 21 | + QThread.exec_ = QThread.exec |
| 22 | + |
| 23 | +elif PYQT5: |
17 | 24 | from PyQt5.QtCore import * |
18 | 25 | from PyQt5.QtCore import pyqtSignal as Signal |
19 | 26 | from PyQt5.QtCore import pyqtBoundSignal as SignalInstance |
|
32 | 39 | from PySide6.QtCore import * |
33 | 40 | import PySide6.QtCore |
34 | 41 | __version__ = PySide6.QtCore.__version__ |
35 | | - Qt.BackgroundColorRole=Qt.BackgroundRole # suggested addition stonebig |
36 | | - Qt.TextColorRole=Qt.ForegroundRole # suggested addition stonebig |
37 | | - Qt.MidButton = Qt.MiddleButton # suggested addition stonebig |
| 42 | + |
| 43 | + # obsolete in qt6 |
| 44 | + Qt.BackgroundColorRole = Qt.BackgroundRole |
| 45 | + Qt.TextColorRole = Qt.ForegroundRole |
| 46 | + Qt.MidButton = Qt.MiddleButton |
| 47 | + |
38 | 48 | elif PYSIDE2: |
39 | 49 | from PySide2.QtCore import * |
40 | 50 |
|
|
45 | 55 |
|
46 | 56 | import PySide2.QtCore |
47 | 57 | __version__ = PySide2.QtCore.__version__ |
48 | | -elif PYQT4: |
49 | | - from PyQt4.QtCore import * |
50 | | - # Those are things we inherited from Spyder that fix crazy crashes under |
51 | | - # some specific situations. (See #34) |
52 | | - from PyQt4.QtCore import QCoreApplication |
53 | | - from PyQt4.QtCore import Qt |
54 | | - from PyQt4.QtCore import pyqtSignal as Signal |
55 | | - from PyQt4.Qtcore import pyqtBoundSignal as SignalInstance |
56 | | - from PyQt4.QtCore import pyqtSlot as Slot |
57 | | - from PyQt4.QtCore import pyqtProperty as Property |
58 | | - from PyQt4.QtGui import (QItemSelection, QItemSelectionModel, |
59 | | - QItemSelectionRange, QSortFilterProxyModel, |
60 | | - QStringListModel) |
61 | | - from PyQt4.QtCore import QT_VERSION_STR as __version__ |
62 | | - from PyQt4.QtCore import qInstallMsgHandler as qInstallMessageHandler |
63 | | - |
64 | | - # QDesktopServices has has been split into (QDesktopServices and |
65 | | - # QStandardPaths) in Qt5 |
66 | | - # This creates a dummy class that emulates QStandardPaths |
67 | | - from PyQt4.QtGui import QDesktopServices as _QDesktopServices |
68 | | - |
69 | | - class QStandardPaths(): |
70 | | - StandardLocation = _QDesktopServices.StandardLocation |
71 | | - displayName = _QDesktopServices.displayName |
72 | | - DesktopLocation = _QDesktopServices.DesktopLocation |
73 | | - DocumentsLocation = _QDesktopServices.DocumentsLocation |
74 | | - FontsLocation = _QDesktopServices.FontsLocation |
75 | | - ApplicationsLocation = _QDesktopServices.ApplicationsLocation |
76 | | - MusicLocation = _QDesktopServices.MusicLocation |
77 | | - MoviesLocation = _QDesktopServices.MoviesLocation |
78 | | - PicturesLocation = _QDesktopServices.PicturesLocation |
79 | | - TempLocation = _QDesktopServices.TempLocation |
80 | | - HomeLocation = _QDesktopServices.HomeLocation |
81 | | - DataLocation = _QDesktopServices.DataLocation |
82 | | - CacheLocation = _QDesktopServices.CacheLocation |
83 | | - writableLocation = _QDesktopServices.storageLocation |
84 | | - |
85 | | - # Those are imported from `import *` |
86 | | - del pyqtSignal, pyqtBoundSignal, pyqtSlot, pyqtProperty, QT_VERSION_STR, qInstallMsgHandler |
87 | | -elif PYSIDE: |
88 | | - from PySide.QtCore import * |
89 | | - from PySide.QtGui import (QItemSelection, QItemSelectionModel, |
90 | | - QItemSelectionRange, QSortFilterProxyModel, |
91 | | - QStringListModel) |
92 | | - from PySide.QtCore import qInstallMsgHandler as qInstallMessageHandler |
93 | | - del qInstallMsgHandler |
94 | | - |
95 | | - # QDesktopServices has has been split into (QDesktopServices and |
96 | | - # QStandardPaths) in Qt5 |
97 | | - # This creates a dummy class that emulates QStandardPaths |
98 | | - from PySide.QtGui import QDesktopServices as _QDesktopServices |
99 | | - |
100 | | - class QStandardPaths(): |
101 | | - StandardLocation = _QDesktopServices.StandardLocation |
102 | | - displayName = _QDesktopServices.displayName |
103 | | - DesktopLocation = _QDesktopServices.DesktopLocation |
104 | | - DocumentsLocation = _QDesktopServices.DocumentsLocation |
105 | | - FontsLocation = _QDesktopServices.FontsLocation |
106 | | - ApplicationsLocation = _QDesktopServices.ApplicationsLocation |
107 | | - MusicLocation = _QDesktopServices.MusicLocation |
108 | | - MoviesLocation = _QDesktopServices.MoviesLocation |
109 | | - PicturesLocation = _QDesktopServices.PicturesLocation |
110 | | - TempLocation = _QDesktopServices.TempLocation |
111 | | - HomeLocation = _QDesktopServices.HomeLocation |
112 | | - DataLocation = _QDesktopServices.DataLocation |
113 | | - CacheLocation = _QDesktopServices.CacheLocation |
114 | | - writableLocation = _QDesktopServices.storageLocation |
115 | | - |
116 | | - import PySide.QtCore |
117 | | - __version__ = PySide.QtCore.__version__ |
118 | 58 | else: |
119 | 59 | raise PythonQtError('No Qt bindings could be found') |
0 commit comments