From da911f14abbe1fcc6780e53212877686bb8103aa Mon Sep 17 00:00:00 2001 From: "falktx@falktx.com" Date: Sun, 11 Aug 2024 21:41:17 +0200 Subject: [PATCH] Continue PyQt6 compatibility, seems usable now Signed-off-by: falktx@falktx.com --- Makefile.print.mk | 2 +- source/frontend/carla | 20 +- source/frontend/carla-control | 20 +- source/frontend/carla-jack-multi | 20 +- source/frontend/carla-jack-single | 20 +- source/frontend/carla-patchbay | 20 +- source/frontend/carla-plugin | 2 + source/frontend/carla-rack | 20 +- source/frontend/midipattern-ui | 30 ++- source/frontend/patchcanvas/canvasbox.py | 2 +- source/frontend/patchcanvas/canvasicon.py | 3 +- source/frontend/qt_compat.py | 247 +++++++++++++++++++++- source/frontend/widgets/ledbutton.py | 2 +- source/frontend/widgets/scalablebutton.py | 2 +- source/frontend/widgets/scalabledial.py | 3 +- source/theme/CarlaStyle.cpp | 4 +- 16 files changed, 300 insertions(+), 117 deletions(-) diff --git a/Makefile.print.mk b/Makefile.print.mk index 0f7c6b4ce..a92186197 100644 --- a/Makefile.print.mk +++ b/Makefile.print.mk @@ -27,7 +27,7 @@ endif features_print_main: @printf -- "$(tS)---> Main features $(tE)\n" ifeq ($(HAVE_FRONTEND),true) - @printf -- "Front-End: $(ANS_YES)\n" + @printf -- "Front-End: $(ANS_YES) (Qt$(FRONTEND_TYPE))\n" @printf -- "LV2 plugin: $(ANS_YES)\n" ifneq ($(HAIKU),true) @printf -- "VST2 plugin: $(ANS_YES)\n" diff --git a/source/frontend/carla b/source/frontend/carla index dd64ec477..6e7d97ad8 100755 --- a/source/frontend/carla +++ b/source/frontend/carla @@ -1,20 +1,6 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla plugin host -# Copyright (C) 2011-2022 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ---------------------------------------------------------------------------------------------------------------------- # Imports (Custom Stuff) @@ -38,6 +24,8 @@ from carla_shared import ( # Main if __name__ == '__main__': + import resources_rc + # ------------------------------------------------------------------------------------------------------------------ # Read CLI args diff --git a/source/frontend/carla-control b/source/frontend/carla-control index a7e32ed70..3039f6de5 100755 --- a/source/frontend/carla-control +++ b/source/frontend/carla-control @@ -1,20 +1,6 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla plugin host -# Copyright (C) 2011-2021 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ---------------------------------------------------------------------------------------------------------------------- # Imports (Custom Stuff) @@ -36,6 +22,8 @@ import sys # Main if __name__ == '__main__': + import resources_rc + # ------------------------------------------------------------------------------------------------------------------ # Read CLI args diff --git a/source/frontend/carla-jack-multi b/source/frontend/carla-jack-multi index c7063cf71..c5b98148a 100755 --- a/source/frontend/carla-jack-multi +++ b/source/frontend/carla-jack-multi @@ -1,20 +1,6 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla plugin host -# Copyright (C) 2011-2017 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ---------------------------------------------------------------------------------------------------------------------- # Imports (Custom Stuff) @@ -25,6 +11,8 @@ from carla_host import * # Main if __name__ == '__main__': + import resources_rc + # ------------------------------------------------------------------------------------------------------------------ # Read CLI args diff --git a/source/frontend/carla-jack-single b/source/frontend/carla-jack-single index 2049f5354..688138e26 100755 --- a/source/frontend/carla-jack-single +++ b/source/frontend/carla-jack-single @@ -1,20 +1,6 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla plugin host -# Copyright (C) 2011-2017 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ---------------------------------------------------------------------------------------------------------------------- # Imports (Custom Stuff) @@ -25,6 +11,8 @@ from carla_host import * # Main if __name__ == '__main__': + import resources_rc + # ------------------------------------------------------------------------------------------------------------------ # Read CLI args diff --git a/source/frontend/carla-patchbay b/source/frontend/carla-patchbay index 0b0e63451..757a2ce9e 100755 --- a/source/frontend/carla-patchbay +++ b/source/frontend/carla-patchbay @@ -1,20 +1,6 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla plugin host -# Copyright (C) 2011-2017 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ---------------------------------------------------------------------------------------------------------------------- # Imports (Custom Stuff) @@ -25,6 +11,8 @@ from carla_host import * # Main if __name__ == '__main__': + import resources_rc + # ------------------------------------------------------------------------------------------------------------------ # Read CLI args diff --git a/source/frontend/carla-plugin b/source/frontend/carla-plugin index 0148896f6..f23b0356e 100755 --- a/source/frontend/carla-plugin +++ b/source/frontend/carla-plugin @@ -569,6 +569,8 @@ class CarlaEmbedW(QEmbedWidget): # Main if __name__ == '__main__': + import resources_rc + # ------------------------------------------------------------- # Get details regarding target usage diff --git a/source/frontend/carla-rack b/source/frontend/carla-rack index f84dc3d4f..e959feb65 100755 --- a/source/frontend/carla-rack +++ b/source/frontend/carla-rack @@ -1,20 +1,6 @@ #!/usr/bin/env python3 -# -*- coding: utf-8 -*- - -# Carla plugin host -# Copyright (C) 2011-2015 Filipe Coelho -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# For a full copy of the GNU General Public License see the doc/GPL.txt file. +# SPDX-FileCopyrightText: 2011-2024 Filipe Coelho +# SPDX-License-Identifier: GPL-2.0-or-later # ---------------------------------------------------------------------------------------------------------------------- # Imports (Custom Stuff) @@ -25,6 +11,8 @@ from carla_host import * # Main if __name__ == '__main__': + import resources_rc + # ------------------------------------------------------------------------------------------------------------------ # Read CLI args diff --git a/source/frontend/midipattern-ui b/source/frontend/midipattern-ui index 11a1535fa..afa61a278 100755 --- a/source/frontend/midipattern-ui +++ b/source/frontend/midipattern-ui @@ -9,11 +9,11 @@ from qt_compat import qt_config if qt_config == 5: - from PyQt5.QtCore import pyqtSlot, Qt, QEvent + from PyQt5.QtCore import pyqtSlot, QT_VERSION, Qt, QEvent from PyQt5.QtGui import QKeyEvent from PyQt5.QtWidgets import QMainWindow elif qt_config == 6: - from PyQt6.QtCore import pyqtSlot, Qt, QEvent + from PyQt6.QtCore import pyqtSlot, QT_VERSION, Qt, QEvent from PyQt6.QtGui import QKeyEvent from PyQt6.QtWidgets import QMainWindow @@ -67,15 +67,25 @@ class MidiPatternW(ExternalUI, QMainWindow): self.ui.piano.modeupdate.connect(self.ui.modeIndicator.changeMode) self.ui.piano.modeupdate.connect(self.slot_modeChanged) - self.ui.timeSigBox.currentIndexChanged[int].connect(self.slot_paramChanged) - self.ui.measureBox.currentIndexChanged[int].connect(self.slot_paramChanged) - self.ui.defaultLengthBox.currentIndexChanged[int].connect(self.slot_paramChanged) - self.ui.quantizeBox.currentIndexChanged[int].connect(self.slot_paramChanged) + if QT_VERSION >= 0x60000: + self.ui.timeSigBox.currentIndexChanged.connect(self.slot_paramChanged) + self.ui.measureBox.currentIndexChanged.connect(self.slot_paramChanged) + self.ui.defaultLengthBox.currentIndexChanged.connect(self.slot_paramChanged) + self.ui.quantizeBox.currentIndexChanged.connect(self.slot_paramChanged) + self.ui.timeSigBox.currentTextChanged.connect(self.slot_setTimeSignature) + self.ui.measureBox.currentTextChanged.connect(self.ui.piano.setMeasures) + self.ui.defaultLengthBox.currentTextChanged.connect(self.ui.piano.setDefaultLength) + self.ui.quantizeBox.currentTextChanged.connect(self.ui.piano.setGridDiv) + else: + self.ui.timeSigBox.currentIndexChanged[int].connect(self.slot_paramChanged) + self.ui.measureBox.currentIndexChanged[int].connect(self.slot_paramChanged) + self.ui.defaultLengthBox.currentIndexChanged[int].connect(self.slot_paramChanged) + self.ui.quantizeBox.currentIndexChanged[int].connect(self.slot_paramChanged) + self.ui.timeSigBox.currentIndexChanged[str].connect(self.slot_setTimeSignature) + self.ui.measureBox.currentIndexChanged[str].connect(self.ui.piano.setMeasures) + self.ui.defaultLengthBox.currentIndexChanged[str].connect(self.ui.piano.setDefaultLength) + self.ui.quantizeBox.currentIndexChanged[str].connect(self.ui.piano.setGridDiv) - self.ui.timeSigBox.currentIndexChanged[str].connect(self.slot_setTimeSignature) - self.ui.measureBox.currentIndexChanged[str].connect(self.ui.piano.setMeasures) - self.ui.defaultLengthBox.currentIndexChanged[str].connect(self.ui.piano.setDefaultLength) - self.ui.quantizeBox.currentIndexChanged[str].connect(self.ui.piano.setGridDiv) self.ui.hSlider.valueChanged.connect(self.ui.graphicsView.setZoomX) self.ui.vSlider.valueChanged.connect(self.ui.graphicsView.setZoomY) diff --git a/source/frontend/patchcanvas/canvasbox.py b/source/frontend/patchcanvas/canvasbox.py index 11abc7d80..f7ee2c158 100644 --- a/source/frontend/patchcanvas/canvasbox.py +++ b/source/frontend/patchcanvas/canvasbox.py @@ -15,7 +15,7 @@ if qt_config == 5: elif qt_config == 6: from PyQt6.QtCore import pyqtSignal, pyqtSlot, qCritical, QT_VERSION, Qt, QPointF, QRectF, QTimer from PyQt6.QtGui import QCursor, QFont, QFontMetrics, QImage, QLinearGradient, QPainter, QPen - from PyQt6.QtSvg import QGraphicsSvgItem + from PyQt6.QtSvgWidgets import QGraphicsSvgItem from PyQt6.QtWidgets import QGraphicsItem, QGraphicsObject, QMenu # ------------------------------------------------------------------------------------------------------------ diff --git a/source/frontend/patchcanvas/canvasicon.py b/source/frontend/patchcanvas/canvasicon.py index 565a1cae3..b9bd3715e 100644 --- a/source/frontend/patchcanvas/canvasicon.py +++ b/source/frontend/patchcanvas/canvasicon.py @@ -15,7 +15,8 @@ if qt_config == 5: elif qt_config == 6: from PyQt6.QtCore import qCritical, QRectF from PyQt6.QtGui import QPainter - from PyQt6.QtSvg import QGraphicsSvgItem, QSvgRenderer + from PyQt6.QtSvg import QSvgRenderer + from PyQt6.QtSvgWidgets import QGraphicsSvgItem from PyQt6.QtWidgets import QGraphicsColorizeEffect # ------------------------------------------------------------------------------------------------------------ diff --git a/source/frontend/qt_compat.py b/source/frontend/qt_compat.py index 970e8025f..7ce9c4236 100644 --- a/source/frontend/qt_compat.py +++ b/source/frontend/qt_compat.py @@ -11,10 +11,253 @@ if qt_config == 5: Qt.MiddleButton = Qt.MidButton elif qt_config == 6: - from PyQt6.QtCore import Qt - from PyQt6.QtWidgets import QMessageBox + from PyQt6.QtCore import Qt, QEvent, QEventLoop + from PyQt6.QtGui import QFont, QPainter, QPalette + from PyQt6.QtWidgets import ( + QAbstractItemView, + QAbstractSpinBox, + QApplication, + QColorDialog, + QDialog, + QDialogButtonBox, + QFileDialog, + QGraphicsItem, + QGraphicsScene, + QGraphicsView, + QHeaderView, + QListWidgetItem, + QMenu, + QMessageBox, + QStyle, + ) # TODO fill up everything else + Qt.AlignCenter = Qt.AlignmentFlag.AlignCenter + Qt.AlignLeft = Qt.AlignmentFlag.AlignLeft + + Qt.AA_DontShowIconsInMenus = Qt.ApplicationAttribute.AA_DontShowIconsInMenus + + Qt.IgnoreAspectRatio = Qt.AspectRatioMode.IgnoreAspectRatio + Qt.KeepAspectRatio = Qt.AspectRatioMode.KeepAspectRatio + + Qt.NoBrush = Qt.BrushStyle.NoBrush + + Qt.Checked = Qt.CheckState.Checked + Qt.Unchecked = Qt.CheckState.Unchecked + + Qt.CustomContextMenu = Qt.ContextMenuPolicy.CustomContextMenu + Qt.NoContextMenu = Qt.ContextMenuPolicy.NoContextMenu + + Qt.ArrowCursor = Qt.CursorShape.ArrowCursor + Qt.ClosedHandCursor = Qt.CursorShape.ClosedHandCursor + Qt.CrossCursor = Qt.CursorShape.CrossCursor + Qt.OpenHandCursor = Qt.CursorShape.OpenHandCursor + Qt.PointingHandCursor = Qt.CursorShape.PointingHandCursor + Qt.SizeAllCursor = Qt.CursorShape.SizeAllCursor + Qt.SizeHorCursor = Qt.CursorShape.SizeHorCursor + + Qt.black = Qt.GlobalColor.black + Qt.blue = Qt.GlobalColor.blue + Qt.cyan = Qt.GlobalColor.cyan + Qt.darkGray = Qt.GlobalColor.darkGray + Qt.red = Qt.GlobalColor.red + Qt.transparent = Qt.GlobalColor.transparent + Qt.white = Qt.GlobalColor.white + Qt.yellow = Qt.GlobalColor.yellow + + Qt.Key_0 = Qt.Key.Key_0 + Qt.Key_1 = Qt.Key.Key_1 + Qt.Key_2 = Qt.Key.Key_2 + Qt.Key_3 = Qt.Key.Key_3 + Qt.Key_5 = Qt.Key.Key_5 + Qt.Key_6 = Qt.Key.Key_6 + Qt.Key_7 = Qt.Key.Key_7 + Qt.Key_9 = Qt.Key.Key_9 + Qt.Key_A = Qt.Key.Key_A + Qt.Key_Agrave = Qt.Key.Key_Agrave + Qt.Key_B = Qt.Key.Key_B + Qt.Key_C = Qt.Key.Key_C + Qt.Key_Ccedilla = Qt.Key.Key_Ccedilla + Qt.Key_Comma = Qt.Key.Key_Comma + Qt.Key_D = Qt.Key.Key_D + Qt.Key_Delete = Qt.Key.Key_Delete + Qt.Key_E = Qt.Key.Key_E + Qt.Key_Eacute = Qt.Key.Key_Eacute + Qt.Key_Egrave = Qt.Key.Key_Egrave + Qt.Key_Escape = Qt.Key.Key_Escape + Qt.Key_F = Qt.Key.Key_F + Qt.Key_G = Qt.Key.Key_G + Qt.Key_H = Qt.Key.Key_H + Qt.Key_Home = Qt.Key.Key_Home + Qt.Key_I = Qt.Key.Key_I + Qt.Key_J = Qt.Key.Key_J + Qt.Key_M = Qt.Key.Key_M + Qt.Key_Minus = Qt.Key.Key_Minus + Qt.Key_N = Qt.Key.Key_N + Qt.Key_O = Qt.Key.Key_O + Qt.Key_P = Qt.Key.Key_P + Qt.Key_ParenLeft = Qt.Key.Key_ParenLeft + Qt.Key_Plus = Qt.Key.Key_Plus + Qt.Key_Q = Qt.Key.Key_Q + Qt.Key_QuoteDbl = Qt.Key.Key_QuoteDbl + Qt.Key_R = Qt.Key.Key_R + Qt.Key_S = Qt.Key.Key_S + Qt.Key_T = Qt.Key.Key_T + Qt.Key_U = Qt.Key.Key_U + Qt.Key_V = Qt.Key.Key_V + Qt.Key_W = Qt.Key.Key_W + Qt.Key_X = Qt.Key.Key_X + Qt.Key_Y = Qt.Key.Key_Y + Qt.Key_Z = Qt.Key.Key_Z + + Qt.AltModifier = Qt.KeyboardModifier.AltModifier + Qt.ControlModifier = Qt.KeyboardModifier.ControlModifier + Qt.MetaModifier = Qt.KeyboardModifier.MetaModifier + Qt.NoModifier = Qt.KeyboardModifier.NoModifier + Qt.ShiftModifier = Qt.KeyboardModifier.ShiftModifier + + Qt.UserRole = Qt.ItemDataRole.UserRole + + Qt.ItemIsDragEnabled = Qt.ItemFlag.ItemIsDragEnabled + Qt.ItemIsEnabled = Qt.ItemFlag.ItemIsEnabled + Qt.ItemIsSelectable = Qt.ItemFlag.ItemIsSelectable + + Qt.ContainsItemShape = Qt.ItemSelectionMode.ContainsItemShape + + Qt.LeftButton = Qt.MouseButton.LeftButton + Qt.MiddleButton = Qt.MouseButton.MiddleButton + Qt.RightButton = Qt.MouseButton.RightButton + + Qt.MouseEventSynthesizedByApplication = Qt.MouseEventSource.MouseEventSynthesizedByApplication + + Qt.Horizontal = Qt.Orientation.Horizontal + + Qt.FlatCap = Qt.PenCapStyle.FlatCap + + Qt.MiterJoin = Qt.PenJoinStyle.MiterJoin + + Qt.DashLine = Qt.PenStyle.DashLine + Qt.NoPen = Qt.PenStyle.NoPen + Qt.SolidLine = Qt.PenStyle.SolidLine + + Qt.ScrollBarAlwaysOn = Qt.ScrollBarPolicy.ScrollBarAlwaysOn + Qt.ScrollBarAlwaysOff = Qt.ScrollBarPolicy.ScrollBarAlwaysOff + + Qt.AscendingOrder = Qt.SortOrder.AscendingOrder + + Qt.SmoothTransformation = Qt.TransformationMode.SmoothTransformation + + Qt.WA_OpaquePaintEvent = Qt.WidgetAttribute.WA_OpaquePaintEvent + + Qt.WindowModal = Qt.WindowModality.WindowModal + + Qt.WindowActive = Qt.WindowState.WindowActive + Qt.WindowMinimized = Qt.WindowState.WindowMinimized + + Qt.MSWindowsFixedSizeDialogHint = Qt.WindowType.MSWindowsFixedSizeDialogHint + Qt.WindowContextHelpButtonHint = Qt.WindowType.WindowContextHelpButtonHint + + QAbstractItemView.DropOnly = QAbstractItemView.DragDropMode.DropOnly + + QAbstractItemView.SingleSelection = QAbstractItemView.SelectionMode.SingleSelection + + QAbstractSpinBox.NoButtons = QAbstractSpinBox.ButtonSymbols.NoButtons + QAbstractSpinBox.UpDownArrows = QAbstractSpinBox.ButtonSymbols.UpDownArrows + + QAbstractSpinBox.StepNone = QAbstractSpinBox.StepEnabledFlag.StepNone + QAbstractSpinBox.StepDownEnabled = QAbstractSpinBox.StepEnabledFlag.StepDownEnabled + QAbstractSpinBox.StepUpEnabled = QAbstractSpinBox.StepEnabledFlag.StepUpEnabled + + QApplication.exec_ = lambda a: a.exec() + + QColorDialog.DontUseNativeDialog = QColorDialog.ColorDialogOption.DontUseNativeDialog + + QDialog.exec_ = lambda d: d.exec() + + QDialogButtonBox.Reset = QDialogButtonBox.StandardButton.Reset + + QEvent.EnabledChange = QEvent.Type.EnabledChange + QEvent.MouseButtonPress = QEvent.Type.MouseButtonPress + QEvent.PaletteChange = QEvent.Type.PaletteChange + QEvent.StyleChange = QEvent.Type.StyleChange + QEvent.User = QEvent.Type.User + + QEventLoop.ExcludeUserInputEvents = QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents + + QFileDialog.AcceptSave = QFileDialog.AcceptMode.AcceptSave + + QFileDialog.AnyFile = QFileDialog.FileMode.AnyFile + + QFileDialog.DontUseCustomDirectoryIcons = QFileDialog.Option.DontUseCustomDirectoryIcons + QFileDialog.ShowDirsOnly = QFileDialog.Option.ShowDirsOnly + + QFont.AllUppercase = QFont.Capitalization.AllUppercase + + QFont.Bold = QFont.Weight.Bold + QFont.Normal = QFont.Weight.Normal + + QGraphicsItem.ItemSelectedHasChanged = QGraphicsItem.GraphicsItemChange.ItemSelectedHasChanged + + QGraphicsItem.ItemIsFocusable = QGraphicsItem.GraphicsItemFlag.ItemIsFocusable + QGraphicsItem.ItemIsMovable = QGraphicsItem.GraphicsItemFlag.ItemIsMovable + QGraphicsItem.ItemIsSelectable = QGraphicsItem.GraphicsItemFlag.ItemIsSelectable + QGraphicsItem.ItemSendsGeometryChanges = QGraphicsItem.GraphicsItemFlag.ItemSendsGeometryChanges + + QGraphicsScene.NoIndex = QGraphicsScene.ItemIndexMethod.NoIndex + + QGraphicsView.NoDrag = QGraphicsView.DragMode.NoDrag + QGraphicsView.ScrollHandDrag = QGraphicsView.DragMode.ScrollHandDrag + + QGraphicsView.FullViewportUpdate = QGraphicsView.ViewportUpdateMode.FullViewportUpdate + QGraphicsView.MinimalViewportUpdate = QGraphicsView.ViewportUpdateMode.MinimalViewportUpdate + + QHeaderView.Fixed = QHeaderView.ResizeMode.Fixed + + QListWidgetItem.UserType = QListWidgetItem.ItemType.UserType + + QMenu.exec_ = lambda m, p: m.exec(p) + + QMessageBox.exec_ = lambda mb: mb.exec() + QMessageBox.No = QMessageBox.StandardButton.No QMessageBox.Yes = QMessageBox.StandardButton.Yes + + QPainter.CompositionMode_Difference = QPainter.CompositionMode.CompositionMode_Difference + QPainter.CompositionMode_Multiply = QPainter.CompositionMode.CompositionMode_Multiply + QPainter.CompositionMode_Plus = QPainter.CompositionMode.CompositionMode_Plus + QPainter.CompositionMode_SourceOver = QPainter.CompositionMode.CompositionMode_SourceOver + + QPainter.HighQualityAntialiasing = None + + QPainter.Antialiasing = QPainter.RenderHint.Antialiasing + QPainter.SmoothPixmapTransform = QPainter.RenderHint.SmoothPixmapTransform + QPainter.TextAntialiasing = QPainter.RenderHint.TextAntialiasing + + QPalette.Active = QPalette.ColorGroup.Active + QPalette.Disabled = QPalette.ColorGroup.Disabled + QPalette.Inactive = QPalette.ColorGroup.Inactive + + QPalette.AlternateBase = QPalette.ColorRole.AlternateBase + QPalette.Base = QPalette.ColorRole.Base + QPalette.BrightText = QPalette.ColorRole.BrightText + QPalette.Button = QPalette.ColorRole.Button + QPalette.ButtonText = QPalette.ColorRole.ButtonText + QPalette.Dark = QPalette.ColorRole.Dark + QPalette.Highlight = QPalette.ColorRole.Highlight + QPalette.HighlightedText = QPalette.ColorRole.HighlightedText + QPalette.Light = QPalette.ColorRole.Light + QPalette.Link = QPalette.ColorRole.Link + QPalette.LinkVisited = QPalette.ColorRole.LinkVisited + QPalette.Mid = QPalette.ColorRole.Mid + QPalette.Midlight = QPalette.ColorRole.Midlight + QPalette.Shadow = QPalette.ColorRole.Shadow + QPalette.Text = QPalette.ColorRole.Text + QPalette.ToolTipBase = QPalette.ColorRole.ToolTipBase + QPalette.ToolTipText = QPalette.ColorRole.ToolTipText + QPalette.Window = QPalette.ColorRole.Window + QPalette.WindowText = QPalette.ColorRole.WindowText + + QPalette.Background = QPalette.Window + + QStyle.State_Selected = QStyle.StateFlag.State_Selected diff --git a/source/frontend/widgets/ledbutton.py b/source/frontend/widgets/ledbutton.py index 6f1aa90dd..64fa56c95 100644 --- a/source/frontend/widgets/ledbutton.py +++ b/source/frontend/widgets/ledbutton.py @@ -15,7 +15,7 @@ if qt_config == 5: elif qt_config == 6: from PyQt6.QtCore import QRectF from PyQt6.QtGui import QPainter, QPixmap - from PyQt6.QtSvg import QSvgWidget + from PyQt6.QtSvgWidgets import QSvgWidget from PyQt6.QtWidgets import QPushButton # --------------------------------------------------------------------------------------------------------------------- diff --git a/source/frontend/widgets/scalablebutton.py b/source/frontend/widgets/scalablebutton.py index 6cbe5ddd6..494b24934 100644 --- a/source/frontend/widgets/scalablebutton.py +++ b/source/frontend/widgets/scalablebutton.py @@ -15,7 +15,7 @@ if qt_config == 5: elif qt_config == 6: from PyQt6.QtCore import QPointF, QRectF from PyQt6.QtGui import QColor, QFont, QPainter, QPixmap - from PyQt6.QtSvg import QSvgWidget + from PyQt6.QtSvgWidgets import QSvgWidget from PyQt6.QtWidgets import QPushButton # --------------------------------------------------------------------------------------------------------------------- diff --git a/source/frontend/widgets/scalabledial.py b/source/frontend/widgets/scalabledial.py index a1c760d8a..0d842c738 100644 --- a/source/frontend/widgets/scalabledial.py +++ b/source/frontend/widgets/scalabledial.py @@ -16,7 +16,7 @@ if qt_config == 5: elif qt_config == 6: from PyQt6.QtCore import pyqtSlot, Qt, QEvent, QPointF, QRectF, QTimer, QSize from PyQt6.QtGui import QColor, QConicalGradient, QFontMetrics, QPainterPath, QPen, QPixmap - from PyQt6.QtSvg import QSvgWidget + from PyQt6.QtSvgWidgets import QSvgWidget from .commondial import CommonDial from carla_shared import fontMetricsHorizontalAdvance @@ -276,7 +276,6 @@ class ScalableDial(CommonDial): # Custom knobs else: - painter.restore() return if self.HOVER_MIN < self.fHoverStep < self.HOVER_MAX: diff --git a/source/theme/CarlaStyle.cpp b/source/theme/CarlaStyle.cpp index bd94f0ea0..72555a87a 100644 --- a/source/theme/CarlaStyle.cpp +++ b/source/theme/CarlaStyle.cpp @@ -1700,7 +1700,7 @@ void CarlaStyle::drawControl(ControlElement element, const QStyleOption *option, // Get extra style options if version 2 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - vertical = bar->state != QStyle::State_Horizontal; + vertical = (bar->state & QStyle::State_Horizontal) == 0; #else vertical = (bar->orientation == Qt::Vertical); #endif @@ -1809,7 +1809,7 @@ void CarlaStyle::drawControl(ControlElement element, const QStyleOption *option, painter->save(); bool vertical = false, inverted = false; #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - vertical = bar->state != QStyle::State_Horizontal; + vertical = (bar->state & QStyle::State_Horizontal) == 0; #else vertical = (bar->orientation == Qt::Vertical); #endif