Skip to content
Snippets Groups Projects

Qt6 fixes and scheduler class started

Merged Oscar Gustafsson requested to merge add-list-scheduler into master
2 unresolved threads
2 files
+ 268
544
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -31,7 +31,7 @@ from qtpy.QtCore import (
Qt,
Slot,
)
from qtpy.QtGui import QCloseEvent, QColor, QFont, QIcon, QIntValidator
from qtpy.QtGui import QCloseEvent, QColor, QFont, QIcon, QIntValidator, QPalette
from qtpy.QtWidgets import (
QAbstractButton,
QAction,
@@ -98,9 +98,9 @@ if __debug__:
log.debug(f"Qt version (compile time): {QtCore.__version__}")
log.debug(f"QT_API: {QT_API}")
if QT_API.lower().startswith("pyside"):
import PySide2
import PySide6
log.debug(f"PySide version: {PySide2.__version__}")
log.debug(f"PySide version: {PySide6.__version__}")
if QT_API.lower().startswith("pyqt"):
from qtpy.QtCore import PYQT_VERSION_STR
@@ -1688,8 +1688,16 @@ def start_scheduler(schedule: Optional[Schedule] = None) -> Optional[Schedule]:
The edited schedule.
"""
if not QApplication.instance():
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
app = QApplication(sys.argv)
# Enforce a light palette regardless of laptop theme
palette = QPalette()
palette.setColor(QPalette.ColorRole.Window, QtCore.Qt.white)
palette.setColor(QPalette.ColorRole.WindowText, QtCore.Qt.black)
palette.setColor(QPalette.ColorRole.ButtonText, QtCore.Qt.black)
palette.setColor(QPalette.ColorRole.Base, QtCore.Qt.white)
palette.setColor(QPalette.ColorRole.AlternateBase, QtCore.Qt.lightGray)
palette.setColor(QPalette.ColorRole.Text, QtCore.Qt.black)
app.setPalette(palette)
else:
app = QApplication.instance()
window = ScheduleMainWindow()
Loading