Files
RFP_Infinity-Vis/app/qt_compat.py

116 lines
2.4 KiB
Python

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()