First upload, 18 controller version
This commit is contained in:
115
app/qt_compat.py
Normal file
115
app/qt_compat.py
Normal file
@@ -0,0 +1,115 @@
|
||||
from __future__ import annotations
|
||||
|
||||
QT_API = "unknown"
|
||||
QT_IMPORT_ERROR: Exception | None = None
|
||||
|
||||
try:
|
||||
from PySide6.QtCore import QObject, QPointF, QRectF, Qt, QTimer, Signal
|
||||
from PySide6.QtGui import (
|
||||
QAction,
|
||||
QColor,
|
||||
QFont,
|
||||
QKeySequence,
|
||||
QLinearGradient,
|
||||
QPainter,
|
||||
QPainterPath,
|
||||
QPalette,
|
||||
QPen,
|
||||
QRadialGradient,
|
||||
)
|
||||
from PySide6.QtWidgets import (
|
||||
QApplication,
|
||||
QCheckBox,
|
||||
QColorDialog,
|
||||
QComboBox,
|
||||
QDialog,
|
||||
QDialogButtonBox,
|
||||
QFileDialog,
|
||||
QFormLayout,
|
||||
QGroupBox,
|
||||
QHBoxLayout,
|
||||
QInputDialog,
|
||||
QLabel,
|
||||
QLineEdit,
|
||||
QListWidget,
|
||||
QListWidgetItem,
|
||||
QMainWindow,
|
||||
QMessageBox,
|
||||
QPlainTextEdit,
|
||||
QPushButton,
|
||||
QScrollArea,
|
||||
QSlider,
|
||||
QSplitter,
|
||||
QSpinBox,
|
||||
QDoubleSpinBox,
|
||||
QStatusBar,
|
||||
QTabWidget,
|
||||
QTableWidget,
|
||||
QTableWidgetItem,
|
||||
QToolBar,
|
||||
QVBoxLayout,
|
||||
QWidget,
|
||||
QHeaderView,
|
||||
)
|
||||
|
||||
QT_API = "PySide6"
|
||||
except ImportError as exc:
|
||||
QT_IMPORT_ERROR = exc
|
||||
|
||||
from PyQt5.QtCore import QObject, QPointF, QRectF, Qt, QTimer, pyqtSignal as Signal
|
||||
from PyQt5.QtGui import (
|
||||
QColor,
|
||||
QFont,
|
||||
QKeySequence,
|
||||
QLinearGradient,
|
||||
QPainter,
|
||||
QPainterPath,
|
||||
QPalette,
|
||||
QPen,
|
||||
QRadialGradient,
|
||||
)
|
||||
from PyQt5.QtWidgets import (
|
||||
QApplication,
|
||||
QAction,
|
||||
QCheckBox,
|
||||
QColorDialog,
|
||||
QComboBox,
|
||||
QDialog,
|
||||
QDialogButtonBox,
|
||||
QFileDialog,
|
||||
QFormLayout,
|
||||
QGroupBox,
|
||||
QHBoxLayout,
|
||||
QInputDialog,
|
||||
QLabel,
|
||||
QLineEdit,
|
||||
QListWidget,
|
||||
QListWidgetItem,
|
||||
QMainWindow,
|
||||
QMessageBox,
|
||||
QPlainTextEdit,
|
||||
QPushButton,
|
||||
QScrollArea,
|
||||
QSlider,
|
||||
QSplitter,
|
||||
QSpinBox,
|
||||
QDoubleSpinBox,
|
||||
QStatusBar,
|
||||
QTabWidget,
|
||||
QTableWidget,
|
||||
QTableWidgetItem,
|
||||
QToolBar,
|
||||
QVBoxLayout,
|
||||
QWidget,
|
||||
QHeaderView,
|
||||
)
|
||||
|
||||
QT_API = "PyQt5"
|
||||
|
||||
|
||||
def event_posf(event) -> QPointF:
|
||||
if hasattr(event, "position"):
|
||||
return event.position()
|
||||
if hasattr(event, "localPos"):
|
||||
return event.localPos()
|
||||
return QPointF()
|
||||
Reference in New Issue
Block a user