diff --git a/src/classes/ui_util.py b/src/classes/ui_util.py index d1e703dfde..48e86a34e2 100644 --- a/src/classes/ui_util.py +++ b/src/classes/ui_util.py @@ -107,15 +107,15 @@ def get_default_icon(theme_name): def make_dark_palette(darkPalette: QPalette) -> QPalette: darkPalette.setColor(QPalette.Window, QColor(53, 53, 53)) - darkPalette.setColor(QPalette.WindowText, Qt.white) + darkPalette.setColor(QPalette.WindowText, Qt.GlobalColor.white) darkPalette.setColor(QPalette.Base, QColor(25, 25, 25)) darkPalette.setColor(QPalette.AlternateBase, QColor(53, 53, 53)) darkPalette.setColor(QPalette.Light, QColor(68, 68, 68)) - darkPalette.setColor(QPalette.Text, Qt.white) + darkPalette.setColor(QPalette.Text, Qt.GlobalColor.white) darkPalette.setColor(QPalette.Button, QColor(53, 53, 53)) - darkPalette.setColor(QPalette.ButtonText, Qt.white) + darkPalette.setColor(QPalette.ButtonText, Qt.GlobalColor.white) darkPalette.setColor(QPalette.Highlight, QColor(42, 130, 218, 192)) - darkPalette.setColor(QPalette.HighlightedText, Qt.black) + darkPalette.setColor(QPalette.HighlightedText, Qt.GlobalColor.black) # # Disabled palette # @@ -125,11 +125,11 @@ def make_dark_palette(darkPalette: QPalette) -> QPalette: darkPalette.setColor(QPalette.Disabled, QPalette.Button, QColor(53, 53, 53, 128)) darkPalette.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(255, 255, 255, 128)) darkPalette.setColor(QPalette.Disabled, QPalette.Highlight, QColor(151, 151, 151, 192)) - darkPalette.setColor(QPalette.Disabled, QPalette.HighlightedText, Qt.black) + darkPalette.setColor(QPalette.Disabled, QPalette.HighlightedText, Qt.GlobalColor.black) # Tooltips darkPalette.setColor(QPalette.ToolTipBase, QColor(42, 130, 218)) - darkPalette.setColor(QPalette.ToolTipText, Qt.white) + darkPalette.setColor(QPalette.ToolTipText, Qt.GlobalColor.white) # Links darkPalette.setColor(QPalette.Link, QColor(85, 170, 255)) darkPalette.setColor(QPalette.LinkVisited, QColor(136, 85, 255)) diff --git a/src/classes/waveform.py b/src/classes/waveform.py index 436e1d333e..f85fbefbb1 100644 --- a/src/classes/waveform.py +++ b/src/classes/waveform.py @@ -83,7 +83,7 @@ def getAudioData(file, channel=-1, tid=None): return # Show waiting cursor - get_app().setOverrideCursor(QCursor(Qt.WaitCursor)) + get_app().setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor)) # Extract audio waveform data (for all channels) # Use max RMS (root mean squared) value for each sample diff --git a/src/launch.py b/src/launch.py index 6d4d3d7dc0..2144e97b78 100755 --- a/src/launch.py +++ b/src/launch.py @@ -57,7 +57,7 @@ try: # This apparently has to be done before loading QtQuick # (via QtWebEgine) AND before creating the QApplication instance - QApplication.setAttribute(Qt.AA_ShareOpenGLContexts) + QApplication.setAttribute(Qt.ApplicationAttribute.AA_ShareOpenGLContexts) from OpenGL import GL # noqa except (ImportError, AttributeError): pass @@ -78,8 +78,8 @@ os.environ['QT_SCALE_FACTOR_ROUNDING_POLICY'] = "Round" # Enable High-DPI resolutions - QApplication.setAttribute(Qt.AA_EnableHighDpiScaling) - QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps) + QApplication.setAttribute(Qt.ApplicationAttribute.AA_EnableHighDpiScaling) + QApplication.setAttribute(Qt.ApplicationAttribute.AA_UseHighDpiPixmaps) except AttributeError: pass # Quietly fail for older Qt5 versions diff --git a/src/themes/base.py b/src/themes/base.py index b814594fe5..252aedd185 100755 --- a/src/themes/base.py +++ b/src/themes/base.py @@ -50,7 +50,7 @@ def create_svg_icon(self, svg_path, size): """Create Dynamic High DPI icons""" renderer = QSvgRenderer(svg_path) image = QPixmap(size * self.app.devicePixelRatio()) - image.fill(Qt.transparent) + image.fill(Qt.GlobalColor.transparent) painter = QPainter(image) renderer.render(painter) painter.end() @@ -188,36 +188,36 @@ def apply_theme(self): self.set_dock_margins() # Move tabs to bottom - self.app.window.setTabPosition(Qt.TopDockWidgetArea, QTabWidget.South) + self.app.window.setTabPosition(Qt.DockWidgetArea.TopDockWidgetArea, QTabWidget.South) # Main toolbar buttons toolbar_buttons = [ - {"action": self.app.window.actionNew, "style": Qt.ToolButtonIconOnly}, - {"action": self.app.window.actionOpen, "style": Qt.ToolButtonIconOnly}, - {"action": self.app.window.actionSave, "style": Qt.ToolButtonIconOnly}, + {"action": self.app.window.actionNew, "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, + {"action": self.app.window.actionOpen, "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, + {"action": self.app.window.actionSave, "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, {"divide": True}, - {"action": self.app.window.actionUndo, "style": Qt.ToolButtonIconOnly}, - {"action": self.app.window.actionRedo, "style": Qt.ToolButtonIconOnly}, + {"action": self.app.window.actionUndo, "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, + {"action": self.app.window.actionRedo, "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, {"divide": True}, - {"action": self.app.window.actionImportFiles, "style": Qt.ToolButtonIconOnly}, - {"action": self.app.window.actionProfile, "style": Qt.ToolButtonIconOnly}, - {"action": self.app.window.actionFullscreen, "style": Qt.ToolButtonIconOnly}, + {"action": self.app.window.actionImportFiles, "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, + {"action": self.app.window.actionProfile, "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, + {"action": self.app.window.actionFullscreen, "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, {"divide": True}, - {"action": self.app.window.actionExportVideo, "style": Qt.ToolButtonIconOnly}, + {"action": self.app.window.actionExportVideo, "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, ] self.set_toolbar_buttons(self.app.window.toolBar, icon_size=24, settings=toolbar_buttons) # Timeline toolbar buttons timeline_buttons = [ - {"action": self.app.window.actionAddTrack, "style": Qt.ToolButtonIconOnly}, + {"action": self.app.window.actionAddTrack, "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, {"divide": True}, - {"action": self.app.window.actionSnappingTool, "style": Qt.ToolButtonIconOnly, "icon": ":/icons/Humanity/actions/custom/snap.svg"}, - {"action": self.app.window.actionRazorTool, "style": Qt.ToolButtonIconOnly, "icon": ":/icons/Humanity/actions/16/edit-cut.svg"}, + {"action": self.app.window.actionSnappingTool, "style": Qt.ToolButtonStyle.ToolButtonIconOnly, "icon": ":/icons/Humanity/actions/custom/snap.svg"}, + {"action": self.app.window.actionRazorTool, "style": Qt.ToolButtonStyle.ToolButtonIconOnly, "icon": ":/icons/Humanity/actions/16/edit-cut.svg"}, {"divide": True}, - {"action": self.app.window.actionAddMarker, "style": Qt.ToolButtonIconOnly, "icon": ":/icons/actions/add_marker.svg"}, - {"action": self.app.window.actionPreviousMarker, "style": Qt.ToolButtonIconOnly}, - {"action": self.app.window.actionNextMarker, "style": Qt.ToolButtonIconOnly}, - {"action": self.app.window.actionCenterOnPlayhead, "style": Qt.ToolButtonIconOnly, "icon": ":/icons/Humanity/actions/custom/center-on-playhead.svg"}, + {"action": self.app.window.actionAddMarker, "style": Qt.ToolButtonStyle.ToolButtonIconOnly, "icon": ":/icons/actions/add_marker.svg"}, + {"action": self.app.window.actionPreviousMarker, "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, + {"action": self.app.window.actionNextMarker, "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, + {"action": self.app.window.actionCenterOnPlayhead, "style": Qt.ToolButtonStyle.ToolButtonIconOnly, "icon": ":/icons/Humanity/actions/custom/center-on-playhead.svg"}, {"divide": True}, {"widget": self.app.window.sliderZoomWidget} ] @@ -226,11 +226,11 @@ def apply_theme(self): # Video toolbar toolbar_buttons = [ {"expand": True}, - {"action": self.app.window.actionJumpStart, "style": Qt.ToolButtonIconOnly}, - {"action": self.app.window.actionRewind, "style": Qt.ToolButtonIconOnly}, - {"action": self.app.window.actionPlay, "style": Qt.ToolButtonIconOnly}, - {"action": self.app.window.actionFastForward, "style": Qt.ToolButtonIconOnly}, - {"action": self.app.window.actionJumpEnd, "style": Qt.ToolButtonIconOnly}, + {"action": self.app.window.actionJumpStart, "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, + {"action": self.app.window.actionRewind, "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, + {"action": self.app.window.actionPlay, "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, + {"action": self.app.window.actionFastForward, "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, + {"action": self.app.window.actionJumpEnd, "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, {"expand": True} ] self.set_toolbar_buttons(self.app.window.videoToolbar, icon_size=24, settings=toolbar_buttons) diff --git a/src/themes/cosmic/theme.py b/src/themes/cosmic/theme.py index a333435f70..a47e1cafa1 100644 --- a/src/themes/cosmic/theme.py +++ b/src/themes/cosmic/theme.py @@ -478,7 +478,7 @@ def apply_theme(self): self.app.setFont(font) # Move tabs to top - self.app.window.setTabPosition(Qt.TopDockWidgetArea, QTabWidget.North) + self.app.window.setTabPosition(Qt.DockWidgetArea.TopDockWidgetArea, QTabWidget.North) # Set dock widget content margins to 0 self.set_dock_margins([16, 0, 16, 0]) @@ -494,28 +494,28 @@ def apply_theme(self): # Main toolbar buttons toolbar_buttons = [ - {"action": self.app.window.actionNew, "icon": "themes/cosmic/images/tool-new-project.svg", "style": Qt.ToolButtonTextBesideIcon}, - {"action": self.app.window.actionOpen, "icon": "themes/cosmic/images/tool-open-project.svg", "style": Qt.ToolButtonTextBesideIcon}, - {"action": self.app.window.actionImportFiles, "icon": "themes/cosmic/images/tool-import-files.svg", "style": Qt.ToolButtonTextBesideIcon}, - {"action": self.app.window.actionProfile, "icon": "themes/cosmic/images/tool-profile.svg", "style": Qt.ToolButtonTextBesideIcon}, + {"action": self.app.window.actionNew, "icon": "themes/cosmic/images/tool-new-project.svg", "style": Qt.ToolButtonStyle.ToolButtonTextBesideIcon}, + {"action": self.app.window.actionOpen, "icon": "themes/cosmic/images/tool-open-project.svg", "style": Qt.ToolButtonStyle.ToolButtonTextBesideIcon}, + {"action": self.app.window.actionImportFiles, "icon": "themes/cosmic/images/tool-import-files.svg", "style": Qt.ToolButtonStyle.ToolButtonTextBesideIcon}, + {"action": self.app.window.actionProfile, "icon": "themes/cosmic/images/tool-profile.svg", "style": Qt.ToolButtonStyle.ToolButtonTextBesideIcon}, {"expand": True}, - {"action": self.app.window.actionSave, "icon": "themes/cosmic/images/tool-save-project.svg", "style": Qt.ToolButtonTextBesideIcon}, - {"action": self.app.window.actionExportVideo, "icon": "themes/cosmic/images/tool-export.svg", "style": Qt.ToolButtonTextBesideIcon, "stylesheet": "QToolButton { background-color: #0078FF; color: #FFFFFF; }"}, - {"action": self.app.window.actionUpdate, "icon": "themes/cosmic/images/warning.svg", "visible": False, "style": Qt.ToolButtonTextBesideIcon, "stylesheet": "QToolButton { background-color: #141923; color: #FABE0A; }"} + {"action": self.app.window.actionSave, "icon": "themes/cosmic/images/tool-save-project.svg", "style": Qt.ToolButtonStyle.ToolButtonTextBesideIcon}, + {"action": self.app.window.actionExportVideo, "icon": "themes/cosmic/images/tool-export.svg", "style": Qt.ToolButtonStyle.ToolButtonTextBesideIcon, "stylesheet": "QToolButton { background-color: #0078FF; color: #FFFFFF; }"}, + {"action": self.app.window.actionUpdate, "icon": "themes/cosmic/images/warning.svg", "visible": False, "style": Qt.ToolButtonStyle.ToolButtonTextBesideIcon, "stylesheet": "QToolButton { background-color: #141923; color: #FABE0A; }"} ] self.set_toolbar_buttons(self.app.window.toolBar, icon_size=20, settings=toolbar_buttons) # Timeline toolbar buttons timeline_buttons = [ - {"action": self.app.window.actionAddTrack, "icon": "themes/cosmic/images/tool-add-track.svg", "style": Qt.ToolButtonTextBesideIcon, "stylesheet": "QToolButton { margin-left: 15px; }"}, - {"action": self.app.window.actionUndo, "icon": "themes/cosmic/images/tool-undo.svg", "style": Qt.ToolButtonIconOnly, "stylesheet": "QToolButton { margin-right: 0px; border-bottom-right-radius: 0px; border-top-right-radius: 0px; }"}, - {"action": self.app.window.actionRedo, "icon": "themes/cosmic/images/tool-redo.svg", "style": Qt.ToolButtonIconOnly, "stylesheet": "QToolButton { margin-left: 0px; border-bottom-left-radius: 0px; border-top-left-radius: 0px; }"}, - {"action": self.app.window.actionSnappingTool, "icon": "themes/cosmic/images/tool-snapping.svg", "style": Qt.ToolButtonIconOnly, "stylesheet": "QToolButton { margin-right: 0px; border-bottom-right-radius: 0px; border-top-right-radius: 0px; }"}, - {"action": self.app.window.actionRazorTool, "icon": "themes/cosmic/images/tool-razor.svg", "style": Qt.ToolButtonIconOnly, "stylesheet": "QToolButton { margin-left: 0px; border-bottom-left-radius: 0px; border-top-left-radius: 0px; }"}, - {"action": self.app.window.actionAddMarker, "icon": "themes/cosmic/images/tool-add-marker.svg", "style": Qt.ToolButtonTextBesideIcon, "stylesheet": "QToolButton { margin-right: 0px; border-bottom-right-radius: 0px; border-top-right-radius: 0px; }"}, - {"action": self.app.window.actionPreviousMarker, "icon": "themes/cosmic/images/tool-prev-marker.svg", "style": Qt.ToolButtonIconOnly, "stylesheet": "QToolButton { margin-left: 0px; border-bottom-left-radius: 0px; border-top-left-radius: 0px; margin-right: 0px; border-bottom-right-radius: 0px; border-top-right-radius: 0px; }"}, - {"action": self.app.window.actionNextMarker, "icon": "themes/cosmic/images/tool-next-marker.svg", "style": Qt.ToolButtonIconOnly, "stylesheet": "QToolButton { margin-left: 0px; border-bottom-left-radius: 0px; border-top-left-radius: 0px; }"}, - {"action": self.app.window.actionCenterOnPlayhead, "icon": "themes/cosmic/images/tool-center-playhead.svg", "style": Qt.ToolButtonIconOnly, "stylesheet": "QWidget { margin-right: 10px; }"}, + {"action": self.app.window.actionAddTrack, "icon": "themes/cosmic/images/tool-add-track.svg", "style": Qt.ToolButtonStyle.ToolButtonTextBesideIcon, "stylesheet": "QToolButton { margin-left: 15px; }"}, + {"action": self.app.window.actionUndo, "icon": "themes/cosmic/images/tool-undo.svg", "style": Qt.ToolButtonStyle.ToolButtonIconOnly, "stylesheet": "QToolButton { margin-right: 0px; border-bottom-right-radius: 0px; border-top-right-radius: 0px; }"}, + {"action": self.app.window.actionRedo, "icon": "themes/cosmic/images/tool-redo.svg", "style": Qt.ToolButtonStyle.ToolButtonIconOnly, "stylesheet": "QToolButton { margin-left: 0px; border-bottom-left-radius: 0px; border-top-left-radius: 0px; }"}, + {"action": self.app.window.actionSnappingTool, "icon": "themes/cosmic/images/tool-snapping.svg", "style": Qt.ToolButtonStyle.ToolButtonIconOnly, "stylesheet": "QToolButton { margin-right: 0px; border-bottom-right-radius: 0px; border-top-right-radius: 0px; }"}, + {"action": self.app.window.actionRazorTool, "icon": "themes/cosmic/images/tool-razor.svg", "style": Qt.ToolButtonStyle.ToolButtonIconOnly, "stylesheet": "QToolButton { margin-left: 0px; border-bottom-left-radius: 0px; border-top-left-radius: 0px; }"}, + {"action": self.app.window.actionAddMarker, "icon": "themes/cosmic/images/tool-add-marker.svg", "style": Qt.ToolButtonStyle.ToolButtonTextBesideIcon, "stylesheet": "QToolButton { margin-right: 0px; border-bottom-right-radius: 0px; border-top-right-radius: 0px; }"}, + {"action": self.app.window.actionPreviousMarker, "icon": "themes/cosmic/images/tool-prev-marker.svg", "style": Qt.ToolButtonStyle.ToolButtonIconOnly, "stylesheet": "QToolButton { margin-left: 0px; border-bottom-left-radius: 0px; border-top-left-radius: 0px; margin-right: 0px; border-bottom-right-radius: 0px; border-top-right-radius: 0px; }"}, + {"action": self.app.window.actionNextMarker, "icon": "themes/cosmic/images/tool-next-marker.svg", "style": Qt.ToolButtonStyle.ToolButtonIconOnly, "stylesheet": "QToolButton { margin-left: 0px; border-bottom-left-radius: 0px; border-top-left-radius: 0px; }"}, + {"action": self.app.window.actionCenterOnPlayhead, "icon": "themes/cosmic/images/tool-center-playhead.svg", "style": Qt.ToolButtonStyle.ToolButtonIconOnly, "stylesheet": "QWidget { margin-right: 10px; }"}, {"widget": self.app.window.sliderZoomWidget}, {"widget": spacer} ] @@ -524,11 +524,11 @@ def apply_theme(self): # Video toolbar toolbar_buttons = [ {"expand": True}, - {"action": self.app.window.actionJumpStart, "icon": "themes/cosmic/images/tool-media-skip-back.svg", "style": Qt.ToolButtonIconOnly}, - {"action": self.app.window.actionRewind, "icon": "themes/cosmic/images/tool-media-rewind.svg", "style": Qt.ToolButtonIconOnly}, - {"action": self.app.window.actionPlay, "icon": "themes/cosmic/images/tool-media-play.svg", "style": Qt.ToolButtonIconOnly}, - {"action": self.app.window.actionFastForward, "icon": "themes/cosmic/images/tool-media-forward.svg", "style": Qt.ToolButtonIconOnly}, - {"action": self.app.window.actionJumpEnd, "icon": "themes/cosmic/images/tool-media-skip-forward.svg", "style": Qt.ToolButtonIconOnly}, + {"action": self.app.window.actionJumpStart, "icon": "themes/cosmic/images/tool-media-skip-back.svg", "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, + {"action": self.app.window.actionRewind, "icon": "themes/cosmic/images/tool-media-rewind.svg", "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, + {"action": self.app.window.actionPlay, "icon": "themes/cosmic/images/tool-media-play.svg", "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, + {"action": self.app.window.actionFastForward, "icon": "themes/cosmic/images/tool-media-forward.svg", "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, + {"action": self.app.window.actionJumpEnd, "icon": "themes/cosmic/images/tool-media-skip-forward.svg", "style": Qt.ToolButtonStyle.ToolButtonIconOnly}, {"expand": True} ] self.set_toolbar_buttons(self.app.window.videoToolbar, icon_size=32, settings=toolbar_buttons) diff --git a/src/windows/about.py b/src/windows/about.py index a6fdc81677..8cab0a16ab 100644 --- a/src/windows/about.py +++ b/src/windows/about.py @@ -170,7 +170,7 @@ def __init__(self): def display_release(self, version_text): self.txtversion.setText(version_text) - self.txtversion.setAlignment(Qt.AlignCenter) + self.txtversion.setAlignment(Qt.AlignmentFlag.AlignCenter) def get_current_release(self): """Get the current version """ diff --git a/src/windows/color_picker.py b/src/windows/color_picker.py index e33e4aa1b9..4aa71e21c4 100644 --- a/src/windows/color_picker.py +++ b/src/windows/color_picker.py @@ -134,7 +134,7 @@ def build_pattern(self) -> QPixmap: n = self.checkerboard_size pat = QPixmap(2 * n, 2 * n) p = QPainter(pat) - p.setPen(Qt.NoPen) + p.setPen(Qt.PenStyle.NoPen) # Paint a checkerboard pattern for the color to be overlaid on self.bg0 = QColor("#aaa") self.bg1 = QColor("#ccc") @@ -148,7 +148,7 @@ def paintEvent(self, event): """Show the current color, with checkerboard alpha""" event.accept() p = QPainter(self) - p.setPen(Qt.NoPen) + p.setPen(Qt.PenStyle.NoPen) if self.color.alphaF() < 1.0: # Draw a checkerboard pattern under the color p.drawTiledPixmap(event.rect(), self.pattern, QPoint(4,4)) diff --git a/src/windows/cutting.py b/src/windows/cutting.py index a805b8418e..c75585fdf8 100644 --- a/src/windows/cutting.py +++ b/src/windows/cutting.py @@ -194,18 +194,18 @@ def __init__(self, file=None, preview=False): def eventFilter(self, obj, event): if event.type() == event.KeyPress and obj is self.txtName: # Handle ENTER key to create new clip - if event.key() == Qt.Key_Return or event.key() == Qt.Key_Enter: + if event.key() == Qt.Key.Key_Return or event.key() == Qt.Key.Key_Enter: if self.btnAddClip.isEnabled(): self.btnAddClip_clicked() return True if event.type() == QEvent.MouseButtonPress and isinstance(obj, QSlider): # Handle QSlider click, jump to cursor position - if event.button() == Qt.LeftButton: + if event.button() == Qt.MouseButton.LeftButton: min_val = obj.minimum() max_val = obj.maximum() - click_position = event.pos().x() if obj.orientation() == Qt.Horizontal else event.pos().y() - slider_length = obj.width() if obj.orientation() == Qt.Horizontal else obj.height() + click_position = event.pos().x() if obj.orientation() == Qt.Orientation.Horizontal else event.pos().y() + slider_length = obj.width() if obj.orientation() == Qt.Orientation.Horizontal else obj.height() new_value = min_val + ((max_val - min_val) * click_position) / slider_length obj.setValue(int(new_value)) diff --git a/src/windows/export.py b/src/windows/export.py index 833c2c4e06..f59c24cd14 100644 --- a/src/windows/export.py +++ b/src/windows/export.py @@ -1116,7 +1116,7 @@ def titlestring(sec, fps, mess): # Make progress bar green (to indicate we are done) from PyQt5.QtGui import QPalette p = QPalette() - p.setColor(QPalette.Highlight, Qt.green) + p.setColor(QPalette.Highlight, Qt.GlobalColor.green) self.progressExportVideo.setPalette(p) # Raise the window diff --git a/src/windows/export_clips.py b/src/windows/export_clips.py index 3a29c52f0b..1208c026d1 100644 --- a/src/windows/export_clips.py +++ b/src/windows/export_clips.py @@ -171,7 +171,7 @@ def _createWidgets(self): # Make progress bar look like the one in the export dialog from PyQt5.QtGui import QPalette p = QPalette() - p.setColor(QPalette.Highlight, Qt.green) + p.setColor(QPalette.Highlight, Qt.GlobalColor.green) self.progressExportVideo.setPalette(p) self.buttonBox.addButton(self.cancel_button, QDialogButtonBox.ActionRole) diff --git a/src/windows/main_window.py b/src/windows/main_window.py index b62cd9ac30..39797444eb 100644 --- a/src/windows/main_window.py +++ b/src/windows/main_window.py @@ -525,7 +525,7 @@ def open_project(self, file_path, clear_thumbnails=True): return # Set cursor to waiting - app.setOverrideCursor(QCursor(Qt.WaitCursor)) + app.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor)) try: if os.path.exists(file_path): @@ -777,7 +777,7 @@ def actionImportFiles_trigger(self): )[0] # Set cursor to waiting - app.setOverrideCursor(QCursor(Qt.WaitCursor)) + app.setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor)) try: # Switch to Files dock @@ -903,7 +903,7 @@ def actionPreferences_trigger(self, checked=True): self.PauseSignal.emit() # Set cursor to waiting - get_app().setOverrideCursor(QCursor(Qt.WaitCursor)) + get_app().setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor)) # Show dialog from windows.preferences import Preferences @@ -1687,7 +1687,7 @@ def keyPressEvent(self, event): # Abort handling if the key sequence is invalid if (key_value <= 0 or key_value in - [Qt.Key_Shift, Qt.Key_Alt, Qt.Key_Control, Qt.Key_Meta]): + [Qt.Key.Key_Shift, Qt.Key.Key_Alt, Qt.Key.Key_Control, Qt.Key.Key_Meta]): return # A valid keysequence was detected @@ -2225,7 +2225,7 @@ def actionTimelineZoomOut_trigger(self): def actionFullscreen_trigger(self): # Toggle fullscreen state (current state mask XOR WindowFullScreen) - self.setWindowState(self.windowState() ^ Qt.WindowFullScreen) + self.setWindowState(self.windowState() ^ Qt.WindowState.WindowFullScreen) def actionFile_Properties_trigger(self): log.info("Show file properties") @@ -2322,7 +2322,7 @@ def getDocks(self): def removeDocks(self): """ Remove all dockable widgets on main screen """ for dock in self.getDocks(): - if self.dockWidgetArea(dock) != Qt.NoDockWidgetArea: + if self.dockWidgetArea(dock) != Qt.DockWidgetArea.NoDockWidgetArea: self.removeDockWidget(dock) def addDocks(self, docks, area): @@ -2333,19 +2333,19 @@ def addDocks(self, docks, area): def floatDocks(self, is_floating): """ Float or Un-Float all dockable widgets above main screen """ for dock in self.getDocks(): - if self.dockWidgetArea(dock) != Qt.NoDockWidgetArea: + if self.dockWidgetArea(dock) != Qt.DockWidgetArea.NoDockWidgetArea: dock.setFloating(is_floating) def showDocks(self, docks): """ Show all dockable widgets on the main screen """ for dock in docks: - if self.dockWidgetArea(dock) != Qt.NoDockWidgetArea: + if self.dockWidgetArea(dock) != Qt.DockWidgetArea.NoDockWidgetArea: # Only show correctly docked widgets dock.show() def freezeDock(self, dock, frozen=True): """ Freeze/unfreeze a dock widget on the main screen.""" - if self.dockWidgetArea(dock) == Qt.NoDockWidgetArea: + if self.dockWidgetArea(dock) == Qt.DockWidgetArea.NoDockWidgetArea: # Don't freeze undockable widgets return if frozen: @@ -2396,7 +2396,7 @@ def actionSimple_View_trigger(self): self.dockEffects, self.dockEmojis, self.dockVideo, - ], Qt.TopDockWidgetArea) + ], Qt.DockWidgetArea.TopDockWidgetArea) self.floatDocks(False) self.tabifyDockWidget(self.dockFiles, self.dockTransitions) @@ -2422,13 +2422,13 @@ def actionAdvanced_View_trigger(self): self.removeDocks() # Add Docks - self.addDocks([self.dockFiles, self.dockVideo], Qt.TopDockWidgetArea) + self.addDocks([self.dockFiles, self.dockVideo], Qt.DockWidgetArea.TopDockWidgetArea) self.addDocks([ self.dockEffects, self.dockTransitions, self.dockEmojis, - ], Qt.RightDockWidgetArea) - self.addDocks([self.dockProperties], Qt.LeftDockWidgetArea) + ], Qt.DockWidgetArea.RightDockWidgetArea) + self.addDocks([self.dockProperties], Qt.DockWidgetArea.LeftDockWidgetArea) self.floatDocks(False) self.tabifyDockWidget(self.dockEmojis, self.dockEffects) @@ -3004,7 +3004,7 @@ def foundCurrentVersion(self, version): # Add update available button (with icon and text) updateButton = QToolButton(self) updateButton.setDefaultAction(self.actionUpdate) - updateButton.setToolButtonStyle(Qt.ToolButtonTextBesideIcon) + updateButton.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon) self.toolBar.addWidget(updateButton) else: log.warning("No ThemeManager loaded yet. Skip update available button.") @@ -3319,10 +3319,10 @@ def __init__(self, *args): self.frameWeb.layout().addWidget(self.timeline) # Configure the side docks to full-height - self.setCorner(Qt.TopLeftCorner, Qt.LeftDockWidgetArea) - self.setCorner(Qt.BottomLeftCorner, Qt.LeftDockWidgetArea) - self.setCorner(Qt.TopRightCorner, Qt.RightDockWidgetArea) - self.setCorner(Qt.BottomRightCorner, Qt.RightDockWidgetArea) + self.setCorner(Qt.Corner.TopLeftCorner, Qt.DockWidgetArea.LeftDockWidgetArea) + self.setCorner(Qt.Corner.BottomLeftCorner, Qt.DockWidgetArea.LeftDockWidgetArea) + self.setCorner(Qt.Corner.TopRightCorner, Qt.DockWidgetArea.RightDockWidgetArea) + self.setCorner(Qt.Corner.BottomRightCorner, Qt.DockWidgetArea.RightDockWidgetArea) self.initModels() @@ -3510,11 +3510,11 @@ def __init__(self, *args): # Use shortcuts to override keypress capturing for arrow keys # These keys are a bit special, and other approaches fail on certain # combinations of OS and Webview backend - QShortcut(app.window.getShortcutByName("seekPreviousFrame"), self, activated=self.seekPreviousFrame, context=Qt.WindowShortcut) - QShortcut(app.window.getShortcutByName("seekNextFrame"), self, activated=self.seekNextFrame, context=Qt.WindowShortcut) - QShortcut(app.window.getShortcutByName("playToggle"), self, activated=self.playToggle, context=Qt.WindowShortcut) - QShortcut(app.window.getShortcutByName("playToggle1"), self, activated=self.playToggle, context=Qt.WindowShortcut) - QShortcut(app.window.getShortcutByName("playToggle2"), self, activated=self.playToggle, context=Qt.WindowShortcut) - QShortcut(app.window.getShortcutByName("playToggle3"), self, activated=self.playToggle, context=Qt.WindowShortcut) - QShortcut(app.window.getShortcutByName("copyAll"), self, activated=self.copyAll, context=Qt.WindowShortcut) - QShortcut(app.window.getShortcutByName("pasteAll"), self, activated=self.pasteAll, context=Qt.WindowShortcut) + QShortcut(app.window.getShortcutByName("seekPreviousFrame"), self, activated=self.seekPreviousFrame, context=Qt.ShortcutContext.WindowShortcut) + QShortcut(app.window.getShortcutByName("seekNextFrame"), self, activated=self.seekNextFrame, context=Qt.ShortcutContext.WindowShortcut) + QShortcut(app.window.getShortcutByName("playToggle"), self, activated=self.playToggle, context=Qt.ShortcutContext.WindowShortcut) + QShortcut(app.window.getShortcutByName("playToggle1"), self, activated=self.playToggle, context=Qt.ShortcutContext.WindowShortcut) + QShortcut(app.window.getShortcutByName("playToggle2"), self, activated=self.playToggle, context=Qt.ShortcutContext.WindowShortcut) + QShortcut(app.window.getShortcutByName("playToggle3"), self, activated=self.playToggle, context=Qt.ShortcutContext.WindowShortcut) + QShortcut(app.window.getShortcutByName("copyAll"), self, activated=self.copyAll, context=Qt.ShortcutContext.WindowShortcut) + QShortcut(app.window.getShortcutByName("pasteAll"), self, activated=self.pasteAll, context=Qt.ShortcutContext.WindowShortcut) diff --git a/src/windows/models/add_to_timeline_model.py b/src/windows/models/add_to_timeline_model.py index f0ca012247..f842cf11d4 100644 --- a/src/windows/models/add_to_timeline_model.py +++ b/src/windows/models/add_to_timeline_model.py @@ -87,14 +87,14 @@ def update_model(self, files=[], clear=True): col = QStandardItem() col.setIcon(thumb_icon) col.setToolTip(filename) - col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable) + col.setFlags(Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsUserCheckable) row.append(col) # Append Name col = QStandardItem("Name") - col.setData(filename, Qt.DisplayRole) + col.setData(filename, Qt.ItemDataRole.DisplayRole) col.setText((name[:20] + '...') if len(name) > 15 else name) - col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable) + col.setFlags(Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsUserCheckable) row.append(col) # Add row diff --git a/src/windows/models/blender_model.py b/src/windows/models/blender_model.py index 950775def8..8c02d18404 100644 --- a/src/windows/models/blender_model.py +++ b/src/windows/models/blender_model.py @@ -118,7 +118,7 @@ def update_model(self, clear=True): icon.addFile(thumb_path) row = [] - flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable + flags = Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsUserCheckable # Append thumbnail col = QStandardItem(self.app._tr(title)) col.setIcon(icon) @@ -128,19 +128,19 @@ def update_model(self, clear=True): # Append Name col = QStandardItem(self.app._tr(title)) - col.setData(self.app._tr(title), Qt.DisplayRole) + col.setData(self.app._tr(title), Qt.ItemDataRole.DisplayRole) col.setFlags(flags) row.append(col) # Append Path col = QStandardItem(path) - col.setData(path, Qt.DisplayRole) + col.setData(path, Qt.ItemDataRole.DisplayRole) col.setFlags(flags) row.append(col) # Append Service col = QStandardItem(service) - col.setData(service, Qt.DisplayRole) + col.setData(service, Qt.ItemDataRole.DisplayRole) col.setFlags(flags) row.append(col) @@ -161,9 +161,9 @@ def __init__(self, *args): # Create proxy model (for sorting and filtering) self.proxy_model = BlenderFilterProxyModel() self.proxy_model.setDynamicSortFilter(True) - self.proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive) + self.proxy_model.setFilterCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive) self.proxy_model.setFilterKeyColumn(1) - self.proxy_model.setSortCaseSensitivity(Qt.CaseSensitive) + self.proxy_model.setSortCaseSensitivity(Qt.CaseSensitivity.CaseSensitive) self.proxy_model.setSourceModel(self.model) self.proxy_model.setSortLocaleAware(True) diff --git a/src/windows/models/changelog_model.py b/src/windows/models/changelog_model.py index 9bc6e19b8f..34fa1c7976 100644 --- a/src/windows/models/changelog_model.py +++ b/src/windows/models/changelog_model.py @@ -69,7 +69,7 @@ def update_model(self, filter=None, clear=True): continue row = [] - flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled + flags = Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled col = QStandardItem(hash_str) col.setToolTip(hash_str) diff --git a/src/windows/models/credits_model.py b/src/windows/models/credits_model.py index 432c7c9286..0e73161a49 100644 --- a/src/windows/models/credits_model.py +++ b/src/windows/models/credits_model.py @@ -74,7 +74,7 @@ def update_model(self, filter=None, clear=True): continue row = [] - flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled + flags = Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled # Append type icon (PayPal, Kickstarter, Bitcoin, or Patreon) item = QStandardItem() diff --git a/src/windows/models/effects_model.py b/src/windows/models/effects_model.py index ac290bbd43..0bc959f827 100644 --- a/src/windows/models/effects_model.py +++ b/src/windows/models/effects_model.py @@ -184,34 +184,34 @@ def update_model(self, clear=True): col.setIcon(icon) col.setText(self.app._tr(title)) col.setToolTip(self.app._tr(title)) - col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable | Qt.ItemIsDragEnabled) + col.setFlags(Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsUserCheckable | Qt.ItemFlag.ItemIsDragEnabled) row.append(col) # Append Name col = QStandardItem("Name") - col.setData(self.app._tr(title), Qt.DisplayRole) + col.setData(self.app._tr(title), Qt.ItemDataRole.DisplayRole) col.setText(self.app._tr(title)) - col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable | Qt.ItemIsDragEnabled) + col.setFlags(Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsUserCheckable | Qt.ItemFlag.ItemIsDragEnabled) row.append(col) # Append Description col = QStandardItem("Description") - col.setData(self.app._tr(description), Qt.DisplayRole) - col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable | Qt.ItemIsDragEnabled) + col.setData(self.app._tr(description), Qt.ItemDataRole.DisplayRole) + col.setFlags(Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsUserCheckable | Qt.ItemFlag.ItemIsDragEnabled) row.append(col) # Append Category col = QStandardItem("Category") - col.setData(category, Qt.DisplayRole) + col.setData(category, Qt.ItemDataRole.DisplayRole) col.setText(category) - col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable | Qt.ItemIsDragEnabled) + col.setFlags(Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsUserCheckable | Qt.ItemFlag.ItemIsDragEnabled) row.append(col) # Append Path col = QStandardItem("Effect") - col.setData(effect_name, Qt.DisplayRole) + col.setData(effect_name, Qt.ItemDataRole.DisplayRole) col.setText(effect_name) - col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable | Qt.ItemIsDragEnabled) + col.setFlags(Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsUserCheckable | Qt.ItemFlag.ItemIsDragEnabled) row.append(col) # Append ROW to MODEL (if does not already exist in model) @@ -235,8 +235,8 @@ def __init__(self, *args): # Create proxy model (for sorting and filtering) self.proxy_model = EffectsProxyModel() self.proxy_model.setDynamicSortFilter(False) - self.proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive) - self.proxy_model.setSortCaseSensitivity(Qt.CaseSensitive) + self.proxy_model.setFilterCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive) + self.proxy_model.setSortCaseSensitivity(Qt.CaseSensitivity.CaseSensitive) self.proxy_model.setSourceModel(self.model) self.proxy_model.setSortLocaleAware(True) diff --git a/src/windows/models/emoji_model.py b/src/windows/models/emoji_model.py index f6eb315a50..b2d6226f83 100644 --- a/src/windows/models/emoji_model.py +++ b/src/windows/models/emoji_model.py @@ -156,7 +156,7 @@ def update_model(self, clear=True): col.setText(emoji_name) col.setToolTip(emoji_name) col.setData(path) - col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable | Qt.ItemIsDragEnabled) + col.setFlags(Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsUserCheckable | Qt.ItemFlag.ItemIsDragEnabled) row.append(col) # Append filterable group name @@ -184,16 +184,16 @@ def __init__(self, *args): # Create proxy models (for grouping, sorting and filtering) self.group_model = QSortFilterProxyModel() self.group_model.setDynamicSortFilter(True) - self.group_model.setFilterCaseSensitivity(Qt.CaseInsensitive) - self.group_model.setSortCaseSensitivity(Qt.CaseSensitive) + self.group_model.setFilterCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive) + self.group_model.setSortCaseSensitivity(Qt.CaseSensitivity.CaseSensitive) self.group_model.setSourceModel(self.model) self.group_model.setSortLocaleAware(True) self.group_model.setFilterKeyColumn(1) self.proxy_model = QSortFilterProxyModel() self.proxy_model.setDynamicSortFilter(True) - self.proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive) - self.proxy_model.setSortCaseSensitivity(Qt.CaseSensitive) + self.proxy_model.setFilterCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive) + self.proxy_model.setSortCaseSensitivity(Qt.CaseSensitivity.CaseSensitive) self.proxy_model.setSourceModel(self.group_model) self.proxy_model.setSortLocaleAware(True) diff --git a/src/windows/models/files_model.py b/src/windows/models/files_model.py index 3dc44d868e..d709cdfd62 100644 --- a/src/windows/models/files_model.py +++ b/src/windows/models/files_model.py @@ -209,7 +209,7 @@ def update_model(self, clear=True, delete_file_id=None, update_file_id=None): thumb_icon = QIcon(os.path.join(info.PATH, "images", "AudioThumbnail.svg")) row = [] - flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsDragEnabled | Qt. ItemNeverHasChildren + flags = Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsDragEnabled | Qt.ItemFlag.ItemNeverHasChildren # Append thumbnail col = QStandardItem(thumb_icon, name) @@ -219,12 +219,12 @@ def update_model(self, clear=True, delete_file_id=None, update_file_id=None): # Append Filename col = QStandardItem(name) - col.setFlags(flags | Qt.ItemIsEditable) + col.setFlags(flags | Qt.ItemFlag.ItemIsEditable) row.append(col) # Append Tags col = QStandardItem(tags) - col.setFlags(flags | Qt.ItemIsEditable) + col.setFlags(flags | Qt.ItemFlag.ItemIsEditable) row.append(col) # Append Media Type @@ -239,7 +239,7 @@ def update_model(self, clear=True, delete_file_id=None, update_file_id=None): # Append ID col = QStandardItem(id) - col.setFlags(flags | Qt.ItemIsUserCheckable) + col.setFlags(flags | Qt.ItemFlag.ItemIsUserCheckable) row.append(col) # Append ROW to MODEL (if does not already exist in model) @@ -600,8 +600,8 @@ def __init__(self, *args): # Create proxy model (for sorting and filtering) self.proxy_model = FileFilterProxyModel(parent=self) self.proxy_model.setDynamicSortFilter(True) - self.proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive) - self.proxy_model.setSortCaseSensitivity(Qt.CaseSensitive) + self.proxy_model.setFilterCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive) + self.proxy_model.setSortCaseSensitivity(Qt.CaseSensitivity.CaseSensitive) self.proxy_model.setSourceModel(self.model) self.proxy_model.setSortLocaleAware(True) diff --git a/src/windows/models/profiles_model.py b/src/windows/models/profiles_model.py index 1b24dc41d4..3f7318c774 100644 --- a/src/windows/models/profiles_model.py +++ b/src/windows/models/profiles_model.py @@ -81,10 +81,10 @@ def update_model(self, filter=None, clear=True): continue row = [] - flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled + flags = Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled item = QStandardItem(f"{profile.Key()}") - item.setData(profile, Qt.UserRole) + item.setData(profile, Qt.ItemDataRole.UserRole) row.append(item) item = QStandardItem(f"{profile.info.description}") @@ -130,7 +130,7 @@ def __init__(self, profiles, *args): # Create proxy model (for sorting and filtering) self.proxy_model = ProfilesProxyModel() self.proxy_model.setDynamicSortFilter(False) - self.proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive) - self.proxy_model.setSortCaseSensitivity(Qt.CaseSensitive) + self.proxy_model.setFilterCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive) + self.proxy_model.setSortCaseSensitivity(Qt.CaseSensitivity.CaseSensitive) self.proxy_model.setSourceModel(self.model) self.proxy_model.setSortLocaleAware(True) diff --git a/src/windows/models/properties_model.py b/src/windows/models/properties_model.py index 99b0db5ddc..fe86d3d200 100644 --- a/src/windows/models/properties_model.py +++ b/src/windows/models/properties_model.py @@ -727,9 +727,9 @@ def set_property(self, property, filter, c, item_type, object_id=None): elif points > 1: col.setBackground(QColor(42, 130, 218)) # Highlight interpolated value background if readonly or type in ["color", "font", "caption"] or choices or label == "Track": - col.setFlags(Qt.ItemIsEnabled) + col.setFlags(Qt.ItemFlag.ItemIsEnabled) else: - col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable) + col.setFlags(Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsUserCheckable) row.append(col) # Append Value @@ -783,7 +783,7 @@ def set_property(self, property, filter, c, item_type, object_id=None): if points > 1: # Apply icon to cell my_icon = QPixmap(":/curves/keyframe-%s.png" % interpolation) - col.setData(my_icon, Qt.DecorationRole) + col.setData(my_icon, Qt.ItemDataRole.DecorationRole) # Set the background color of the cell if keyframe: @@ -799,13 +799,13 @@ def set_property(self, property, filter, c, item_type, object_id=None): col.setBackground(QColor(red, green, blue)) if readonly or type in ["color", "font", "caption"] or choices or label == "Track": - col.setFlags(Qt.ItemIsEnabled) + col.setFlags(Qt.ItemFlag.ItemIsEnabled) else: col.setFlags( - Qt.ItemIsSelectable - | Qt.ItemIsEnabled - | Qt.ItemIsUserCheckable - | Qt.ItemIsEditable) + Qt.ItemFlag.ItemIsSelectable + | Qt.ItemFlag.ItemIsEnabled + | Qt.ItemFlag.ItemIsUserCheckable + | Qt.ItemFlag.ItemIsEditable) row.append(col) # Append ROW to MODEL (if does not already exist in model) @@ -876,7 +876,7 @@ def set_property(self, property, filter, c, item_type, object_id=None): if points > 1: # Apply icon to cell my_icon = QPixmap(":/curves/keyframe-%s.png" % interpolation) - col.setData(my_icon, Qt.DecorationRole) + col.setData(my_icon, Qt.ItemDataRole.DecorationRole) # Set the background color of the cell if keyframe: @@ -890,7 +890,7 @@ def set_property(self, property, filter, c, item_type, object_id=None): # clear icon my_icon = QPixmap() - col.setData(my_icon, Qt.DecorationRole) + col.setData(my_icon, Qt.ItemDataRole.DecorationRole) if type == "color": # Update the color based on the color curves diff --git a/src/windows/models/titles_model.py b/src/windows/models/titles_model.py index 8405b56ddc..2964f0b0a5 100644 --- a/src/windows/models/titles_model.py +++ b/src/windows/models/titles_model.py @@ -73,7 +73,7 @@ def mimeData(self, indexes): class TitleRoles: - PathRole = Qt.UserRole + 11 + PathRole = Qt.ItemDataRole.UserRole + 11 class TitlesModel(QObject): @@ -162,7 +162,7 @@ def update_model(self, clear=True): icon.addFile(thumb_path) # Create item entry for model - flags = Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable | Qt.ItemIsDragEnabled + flags = Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsUserCheckable | Qt.ItemFlag.ItemIsDragEnabled item = QStandardItem(icon, title_name) item.setData(path, TitleRoles.PathRole) item.setToolTip(title_name) @@ -187,9 +187,9 @@ def __init__(self, *args, **kwargs): # Create proxy model (for sorting and filtering) self.proxy_model = TitleFilterProxyModel() self.proxy_model.setDynamicSortFilter(True) - self.proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive) + self.proxy_model.setFilterCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive) self.proxy_model.setFilterKeyColumn(1) - self.proxy_model.setSortCaseSensitivity(Qt.CaseSensitive) + self.proxy_model.setSortCaseSensitivity(Qt.CaseSensitivity.CaseSensitive) self.proxy_model.setSourceModel(self.model) self.proxy_model.setSortLocaleAware(True) diff --git a/src/windows/models/transition_model.py b/src/windows/models/transition_model.py index f27976b17c..72359b34c2 100644 --- a/src/windows/models/transition_model.py +++ b/src/windows/models/transition_model.py @@ -198,28 +198,28 @@ def update_model(self, clear=True): col.setText(trans_name) col.setToolTip(trans_name) col.setData(type) - col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable | Qt.ItemIsDragEnabled) + col.setFlags(Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsUserCheckable | Qt.ItemFlag.ItemIsDragEnabled) row.append(col) # Append Filename col = QStandardItem("Name") - col.setData(trans_name, Qt.DisplayRole) + col.setData(trans_name, Qt.ItemDataRole.DisplayRole) col.setText(trans_name) - col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable | Qt.ItemIsDragEnabled) + col.setFlags(Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsUserCheckable | Qt.ItemFlag.ItemIsDragEnabled) row.append(col) # Append Media Type col = QStandardItem("Type") - col.setData(type, Qt.DisplayRole) + col.setData(type, Qt.ItemDataRole.DisplayRole) col.setText(type) - col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable | Qt.ItemIsDragEnabled) + col.setFlags(Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsUserCheckable | Qt.ItemFlag.ItemIsDragEnabled) row.append(col) # Append Path col = QStandardItem("Path") - col.setData(path, Qt.DisplayRole) + col.setData(path, Qt.ItemDataRole.DisplayRole) col.setText(path) - col.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsUserCheckable | Qt.ItemIsDragEnabled) + col.setFlags(Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsUserCheckable | Qt.ItemFlag.ItemIsDragEnabled) row.append(col) # Append ROW to MODEL (if does not already exist in model) @@ -243,8 +243,8 @@ def __init__(self, *args): # Create proxy model (for sorting and filtering) self.proxy_model = TransitionFilterProxyModel() self.proxy_model.setDynamicSortFilter(True) - self.proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive) - self.proxy_model.setSortCaseSensitivity(Qt.CaseSensitive) + self.proxy_model.setFilterCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive) + self.proxy_model.setSortCaseSensitivity(Qt.CaseSensitivity.CaseSensitive) self.proxy_model.setSourceModel(self.model) self.proxy_model.setSortLocaleAware(True) diff --git a/src/windows/preferences.py b/src/windows/preferences.py index f5b9ec2b9b..64b8723a99 100644 --- a/src/windows/preferences.py +++ b/src/windows/preferences.py @@ -158,7 +158,7 @@ def Populate(self, filter=""): # Create scrollarea scroll_area = QScrollArea(self) scroll_area.setWidgetResizable(True) - scroll_area.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) + scroll_area.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAsNeeded) scroll_area.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) scroll_area.setMinimumSize(675, 100) @@ -247,9 +247,9 @@ def Populate(self, filter=""): # create spinner widget = QCheckBox() if param["value"] is True: - widget.setCheckState(Qt.Checked) + widget.setCheckState(Qt.CheckState.Checked) else: - widget.setCheckState(Qt.Unchecked) + widget.setCheckState(Qt.CheckState.Unchecked) widget.stateChanged.connect(functools.partial(self.bool_value_changed, widget, param)) elif param["type"] == "dropdown": @@ -465,7 +465,7 @@ def check_for_restart(self, param): def bool_value_changed(self, widget, param, state): # Save setting - if state == Qt.Checked: + if state == Qt.CheckState.Checked: self.s.set(param["setting"], True) else: self.s.set(param["setting"], False) @@ -473,15 +473,15 @@ def bool_value_changed(self, widget, param, state): # Trigger specific actions if param["setting"] == "debug-mode": # Update debug setting of timeline - log.info("Setting debug-mode to %s", state == Qt.Checked) - debug_enabled = (state == Qt.Checked) + log.info("Setting debug-mode to %s", state == Qt.CheckState.Checked) + debug_enabled = (state == Qt.CheckState.Checked) # Enable / Disable logger openshot.ZmqLogger.Instance().Enable(debug_enabled) elif param["setting"] == "enable-auto-save": # Toggle autosave - if (state == Qt.Checked): + if (state == Qt.CheckState.Checked): # Start/Restart autosave timer get_app().window.auto_save_timer.start() else: diff --git a/src/windows/process_effect.py b/src/windows/process_effect.py index 162c67f9a6..48e391fb02 100644 --- a/src/windows/process_effect.py +++ b/src/windows/process_effect.py @@ -56,7 +56,7 @@ def paintEvent(self, event): super().paintEvent(event) if self.qimage: painter = QPainter(self) - resized_qimage = self.qimage.scaled(self.size(), Qt.IgnoreAspectRatio, Qt.SmoothTransformation) + resized_qimage = self.qimage.scaled(self.size(), Qt.AspectRatioMode.IgnoreAspectRatio, Qt.TransformationMode.SmoothTransformation) painter.drawImage(0, 0, resized_qimage) else: super().paintEvent(event) # Draw the normal button @@ -125,7 +125,7 @@ def __init__(self, clip_id, effect_class, effect_params): if param["type"] == "link": # create a clickable link label.setText('%s' % (param["value"], _(param["title"]))) - label.setTextInteractionFlags(Qt.TextBrowserInteraction) + label.setTextInteractionFlags(Qt.TextInteractionFlag.TextBrowserInteraction) label.linkActivated.connect(functools.partial(self.link_activated, widget, param)) if param["type"] == "spinner": @@ -177,10 +177,10 @@ def __init__(self, clip_id, effect_class, effect_params): # create spinner widget = QCheckBox() if param["value"] == True: - widget.setCheckState(Qt.Checked) + widget.setCheckState(Qt.CheckState.Checked) self.context[param["setting"]] = True else: - widget.setCheckState(Qt.Unchecked) + widget.setCheckState(Qt.CheckState.Unchecked) self.context[param["setting"]] = False widget.stateChanged.connect(functools.partial(self.bool_value_changed, widget, param)) @@ -253,7 +253,7 @@ def spinner_value_changed(self, widget, param, value): def bool_value_changed(self, widget, param, state): """Boolean value change callback""" - if state == Qt.Checked: + if state == Qt.CheckState.Checked: self.context[param["setting"]] = True else: self.context[param["setting"]] = False @@ -310,7 +310,7 @@ def rect_select_clicked(self, widget, param): region_qimage = win.videoPreview.region_qimage # Resize QImage to match button size - resized_qimage = region_qimage.scaled(widget.size(), Qt.IgnoreAspectRatio, Qt.SmoothTransformation) + resized_qimage = region_qimage.scaled(widget.size(), Qt.AspectRatioMode.IgnoreAspectRatio, Qt.TransformationMode.SmoothTransformation) # Remove button text (so region QImage is more visible) widget.setImage(resized_qimage) diff --git a/src/windows/title_editor.py b/src/windows/title_editor.py index bdcdd195f5..4a206ed235 100644 --- a/src/windows/title_editor.py +++ b/src/windows/title_editor.py @@ -120,8 +120,8 @@ def __init__(self, *args, edit_file_path=None, duplicate=False, **kwargs): imp = minidom.getDOMImplementation() self.xmldoc = imp.createDocument(None, "any", None) - self.bg_color_code = QColor(Qt.black) - self.font_color_code = QColor(Qt.white) + self.bg_color_code = QColor(Qt.GlobalColor.black) + self.font_color_code = QColor(Qt.GlobalColor.white) self.bg_style_string = "" self.title_style_string = "" @@ -461,8 +461,8 @@ def best_contrast(bg: QColor) -> QColor: # Compute perceptive luminance of background color lum = (0.299 * colrgb[0] + 0.587 * colrgb[1] + 0.114 * colrgb[2]) if (lum < 0.5): - return QColor(Qt.white) - return QColor(Qt.black) + return QColor(Qt.GlobalColor.white) + return QColor(Qt.GlobalColor.black) def btnFontColor_clicked(self): app = get_app() diff --git a/src/windows/video_widget.py b/src/windows/video_widget.py index 83da93b48d..0bf2c2d319 100644 --- a/src/windows/video_widget.py +++ b/src/windows/video_widget.py @@ -340,12 +340,12 @@ def paintEvent(self, event, *args): # DRAW FRAME # Calculate new frame image size, maintaining aspect ratio pixSize = self.current_image.size() - pixSize.scale(event.rect().size(), Qt.KeepAspectRatio) + pixSize.scale(event.rect().size(), Qt.AspectRatioMode.KeepAspectRatio) self.curr_frame_size = pixSize # Scale image (take into account display scaling for High DPI monitors) scale = self.devicePixelRatioF() - scaledPix = self.current_image.scaled(pixSize * scale, Qt.KeepAspectRatio, Qt.SmoothTransformation) + scaledPix = self.current_image.scaled(pixSize * scale, Qt.AspectRatioMode.KeepAspectRatio, Qt.TransformationMode.SmoothTransformation) # Calculate center of QWidget and Draw image painter.drawImage(viewport_rect, scaledPix) @@ -388,13 +388,13 @@ def paintEvent(self, event, *args): scale = openshot.SCALE_STRETCH if scale == openshot.SCALE_FIT: - source_size.scale(player_width, player_height, Qt.KeepAspectRatio) + source_size.scale(player_width, player_height, Qt.AspectRatioMode.KeepAspectRatio) elif scale == openshot.SCALE_STRETCH: - source_size.scale(player_width, player_height, Qt.IgnoreAspectRatio) + source_size.scale(player_width, player_height, Qt.AspectRatioMode.IgnoreAspectRatio) elif scale == openshot.SCALE_CROP: - source_size.scale(player_width, player_height, Qt.KeepAspectRatioByExpanding) + source_size.scale(player_width, player_height, Qt.AspectRatioMode.KeepAspectRatioByExpanding) # Get new source width / height (after scaling mode applied) source_width = source_size.width() @@ -565,7 +565,7 @@ def centeredViewport(self, width, height): aspectRatio = self.aspect_ratio.ToFloat() * self.pixel_ratio.ToFloat() viewport_size = QSizeF(aspectRatio, 1).scaled( - window_size, Qt.KeepAspectRatio + window_size, Qt.AspectRatioMode.KeepAspectRatio ) * self.zoom viewport_rect = QRectF(QPointF(0, 0), viewport_size) viewport_rect.moveCenter(window_rect.center()) @@ -677,7 +677,7 @@ def rotateCursor(self, pixmap, rotation, shear_x, shear_y): """Rotate cursor based on the current transform""" rotated_pixmap = pixmap.transformed( QTransform().rotate(rotation).shear(shear_x, shear_y).scale(0.8, 0.8), - Qt.SmoothTransformation) + Qt.TransformationMode.SmoothTransformation) return QCursor(rotated_pixmap) def checkTransformMode(self, rotation, shear_x, shear_y, event): @@ -707,7 +707,7 @@ def checkTransformMode(self, rotation, shear_x, shear_y, event): and self.resize_button.isVisible() and self.resize_button.rect().contains(event.pos()) ): - self.setCursor(Qt.ArrowCursor) + self.setCursor(Qt.CursorShape.ArrowCursor) self.transform_mode = None return @@ -715,7 +715,7 @@ def checkTransformMode(self, rotation, shear_x, shear_y, event): for h in handle_uis: if self.transform.mapToPolygon( h["handle"].toRect() - ).containsPoint(event.pos(), Qt.OddEvenFill): + ).containsPoint(event.pos(), Qt.FillRule.OddEvenFill): # Handle contains cursor if self.transform_mode and self.transform_mode != h["mode"]: # We're in different xform mode, skip @@ -728,7 +728,7 @@ def checkTransformMode(self, rotation, shear_x, shear_y, event): # If not over any handles, determne inside/outside clip rectangle r = non_handle_uis.get("region") - if self.transform.mapToPolygon(r.toRect()).containsPoint(event.pos(), Qt.OddEvenFill): + if self.transform.mapToPolygon(r.toRect()).containsPoint(event.pos(), Qt.FillRule.OddEvenFill): nh = non_handle_uis.get("inside", {}) else: nh = non_handle_uis.get("outside", {}) @@ -945,7 +945,7 @@ def mouseMoveEvent(self, event): elif self.transform_mode == 'scale_right': scale_x += x_motion / half_w - if int(QCoreApplication.instance().keyboardModifiers() & Qt.ControlModifier) > 0: + if int(QCoreApplication.instance().keyboardModifiers() & Qt.KeyboardModifier.ControlModifier) > 0: # If CTRL key is pressed, fix the scale_y to the correct aspect ration if scale_x: scale_y = scale_x @@ -978,12 +978,12 @@ def mouseMoveEvent(self, event): and self.resize_button.rect().contains(event.pos()) ): # Mouse over resize button (and not currently dragging) - self.setCursor(Qt.ArrowCursor) + self.setCursor(Qt.CursorShape.ArrowCursor) elif ( self.region_transform and self.regionTopLeftHandle and self.region_transform.mapToPolygon( - self.regionTopLeftHandle.toRect()).containsPoint(event.pos(), Qt.OddEvenFill) + self.regionTopLeftHandle.toRect()).containsPoint(event.pos(), Qt.FillRule.OddEvenFill) ): if not self.region_mode or self.region_mode == 'scale_top_left': self.setCursor(self.rotateCursor(self.cursors.get('resize_fdiag'), 0, 0, 0)) @@ -994,7 +994,7 @@ def mouseMoveEvent(self, event): self.region_transform and self.regionBottomRightHandle and self.region_transform.mapToPolygon( - self.regionBottomRightHandle.toRect()).containsPoint(event.pos(), Qt.OddEvenFill) + self.regionBottomRightHandle.toRect()).containsPoint(event.pos(), Qt.FillRule.OddEvenFill) ): if not self.region_mode or self.region_mode == 'scale_bottom_right': self.setCursor(self.rotateCursor(self.cursors.get('resize_fdiag'), 0, 0, 0)) @@ -1002,7 +1002,7 @@ def mouseMoveEvent(self, event): if self.mouse_dragging and not self.region_mode: self.region_mode = 'scale_bottom_right' else: - self.setCursor(Qt.ArrowCursor) + self.setCursor(Qt.CursorShape.ArrowCursor) # Initialize new region coordinates at current event.pos() if self.mouse_dragging and not self.region_mode: @@ -1150,7 +1150,7 @@ def mouseMoveEvent(self, event): elif self.transform_mode == 'scale_right': scale_x += x_motion / half_w - if int(QCoreApplication.instance().keyboardModifiers() & Qt.ControlModifier) > 0: + if int(QCoreApplication.instance().keyboardModifiers() & Qt.KeyboardModifier.ControlModifier) > 0: # If CTRL key is pressed, fix the scale_y to the correct aspect ratio if scale_x: scale_y = scale_x @@ -1364,7 +1364,7 @@ def delayed_resize_callback(self): # Scale project size (with aspect ratio) to the delayed widget size project_size = QSize(get_app().project.get("width"), get_app().project.get("height")) - project_size.scale(self.delayed_size, Qt.KeepAspectRatio) + project_size.scale(self.delayed_size, Qt.AspectRatioMode.KeepAspectRatio) if project_size.height() > 0: # Ensure width and height are divisible by 2 @@ -1484,7 +1484,7 @@ def __init__(self, watch_project=True, *args): self.mutex = QMutex() # Init Qt widget's properties (background repainting, etc...) - super().setAttribute(Qt.WA_OpaquePaintEvent) + super().setAttribute(Qt.WidgetAttribute.WA_OpaquePaintEvent) super().setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) # Add self as listener to project data updates (used to update the timeline) @@ -1500,11 +1500,11 @@ def __init__(self, watch_project=True, *args): self.win = get_app().window # Update title whenever playback speed changes. - self.win.PlaySignal.connect(self.update_title, Qt.QueuedConnection) - self.win.PlaySignal.connect(self.update_title, Qt.QueuedConnection) - self.win.PauseSignal.connect(self.update_title, Qt.QueuedConnection) - self.win.SpeedSignal.connect(self.update_title, Qt.QueuedConnection) - self.win.StopSignal.connect(self.update_title, Qt.QueuedConnection) + self.win.PlaySignal.connect(self.update_title, Qt.ConnectionType.QueuedConnection) + self.win.PlaySignal.connect(self.update_title, Qt.ConnectionType.QueuedConnection) + self.win.PauseSignal.connect(self.update_title, Qt.ConnectionType.QueuedConnection) + self.win.SpeedSignal.connect(self.update_title, Qt.ConnectionType.QueuedConnection) + self.win.StopSignal.connect(self.update_title, Qt.ConnectionType.QueuedConnection) # Show Property timer # Timer to use a delay before sending MaxSizeChanged signals (so we don't spam libopenshot) diff --git a/src/windows/views/blender_listview.py b/src/windows/views/blender_listview.py index 27de59b71f..6ccaa20db6 100644 --- a/src/windows/views/blender_listview.py +++ b/src/windows/views/blender_listview.py @@ -275,7 +275,7 @@ def processing_mode(self, cursor=True): # Show 'Wait' cursor if cursor: - QApplication.setOverrideCursor(Qt.WaitCursor) + QApplication.setOverrideCursor(Qt.CursorShape.WaitCursor) @pyqtSlot() def end_processing(self): @@ -404,9 +404,9 @@ def get_animation_details(self): return {} # Get all selected rows items - animation_title = current.sibling(current.row(), 1).data(Qt.DisplayRole) - xml_path = current.sibling(current.row(), 2).data(Qt.DisplayRole) - service = current.sibling(current.row(), 3).data(Qt.DisplayRole) + animation_title = current.sibling(current.row(), 1).data(Qt.ItemDataRole.DisplayRole) + xml_path = current.sibling(current.row(), 2).data(Qt.ItemDataRole.DisplayRole) + service = current.sibling(current.row(), 3).data(Qt.ItemDataRole.DisplayRole) # load xml effect file xmldoc = xml.parse(xml_path) @@ -643,7 +643,7 @@ def Render(self, frame=None): # Cleanup signals all 'round self.worker.finished.connect(self.worker.deleteLater) - self.worker.finished.connect(self.background.quit, Qt.DirectConnection) + self.worker.finished.connect(self.background.quit, Qt.ConnectionType.DirectConnection) self.background.finished.connect(self.background.deleteLater) self.background.finished.connect(self.worker.deleteLater) @@ -704,7 +704,7 @@ def __init__(self, parent, *args): self.setResizeMode(QListView.Adjust) self.setUniformItemSizes(True) self.setWordWrap(True) - self.setTextElideMode(Qt.ElideRight) + self.setTextElideMode(Qt.TextElideMode.ElideRight) # Hook up controls self.win.btnRefresh.clicked.connect(self.preview_timer.start) diff --git a/src/windows/views/credits_treeview.py b/src/windows/views/credits_treeview.py index f3855095fd..4a94ed6bcf 100644 --- a/src/windows/views/credits_treeview.py +++ b/src/windows/views/credits_treeview.py @@ -54,7 +54,7 @@ def refresh_view(self, filter=None): self.setColumnWidth(2, 150) self.setColumnWidth(3, 150) self.setColumnWidth(4, 150) - self.sortByColumn(2, Qt.AscendingOrder) + self.sortByColumn(2, Qt.SortOrder.AscendingOrder) if "email" not in self.columns: self.setColumnHidden(3, True) diff --git a/src/windows/views/effects_listview.py b/src/windows/views/effects_listview.py index 31287c7f95..f5b0ead47b 100644 --- a/src/windows/views/effects_listview.py +++ b/src/windows/views/effects_listview.py @@ -66,7 +66,7 @@ def startDrag(self, event): return False # Get icon from column 0 on same row as current item - icon = current.sibling(current.row(), 0).data(Qt.DecorationRole) + icon = current.sibling(current.row(), 0).data(Qt.ItemDataRole.DecorationRole) # Start drag operation drag = QDrag(self) @@ -82,8 +82,8 @@ def refresh_view(self): """Filter transitions with proxy class""" filter_text = self.win.effectsFilter.text() self.model().setFilterRegExp(QRegExp(filter_text.replace(' ', '.*'))) - self.model().setFilterCaseSensitivity(Qt.CaseInsensitive) - self.model().sort(Qt.AscendingOrder) + self.model().setFilterCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive) + self.model().sort(Qt.SortOrder.AscendingOrder) def __init__(self, model): # Invoke parent init @@ -115,7 +115,7 @@ def __init__(self, model): self.setResizeMode(QListView.Adjust) self.setUniformItemSizes(True) self.setWordWrap(False) - self.setTextElideMode(Qt.ElideRight) + self.setTextElideMode(Qt.TextElideMode.ElideRight) self.setStyleSheet('QListView::item { padding-top: 2px; }') # setup filter events diff --git a/src/windows/views/effects_treeview.py b/src/windows/views/effects_treeview.py index 2cefe691a8..0785aed570 100644 --- a/src/windows/views/effects_treeview.py +++ b/src/windows/views/effects_treeview.py @@ -67,7 +67,7 @@ def startDrag(self, supportedActions): return False # Get icon from column 0 on same row as current item - icon = current.sibling(current.row(), 0).data(Qt.DecorationRole) + icon = current.sibling(current.row(), 0).data(Qt.ItemDataRole.DecorationRole) # Start drag operation drag = QDrag(self) @@ -83,7 +83,7 @@ def refresh_columns(self): self.hideColumn(3) self.hideColumn(4) self.setColumnWidth(0, 80) - self.sortByColumn(0, Qt.AscendingOrder) + self.sortByColumn(0, Qt.SortOrder.AscendingOrder) def __init__(self, model): # Invoke parent init diff --git a/src/windows/views/emojis_listview.py b/src/windows/views/emojis_listview.py index 3a944d2e20..142968f4a5 100644 --- a/src/windows/views/emojis_listview.py +++ b/src/windows/views/emojis_listview.py @@ -45,7 +45,7 @@ class EmojisListView(QListView): def dragEnterEvent(self, event): # If dragging urls onto widget, accept if event.mimeData().hasUrls(): - event.setDropAction(Qt.CopyAction) + event.setDropAction(Qt.DropAction.CopyAction) event.accept() def startDrag(self, event): @@ -57,7 +57,7 @@ def startDrag(self, event): # Start drag operation drag = QDrag(self) drag.setMimeData(self.model.mimeData(selected)) - icon = self.model.data(selected[0], Qt.DecorationRole) + icon = self.model.data(selected[0], Qt.ItemDataRole.DecorationRole) drag.setPixmap(icon.pixmap(self.drag_item_size)) drag.setHotSpot(self.drag_item_center) @@ -129,7 +129,7 @@ def group_changed(self, index=-1): def filter_changed(self, filter_text=None): """Filter emoji with proxy class""" - self.model.setFilterRegExp(QRegExp(filter_text, Qt.CaseInsensitive)) + self.model.setFilterRegExp(QRegExp(filter_text, Qt.CaseSensitivity.CaseInsensitive)) self.model.setFilterKeyColumn(0) self.refresh_view() diff --git a/src/windows/views/files_listview.py b/src/windows/views/files_listview.py index a1667f6ee1..bd5181bd52 100644 --- a/src/windows/views/files_listview.py +++ b/src/windows/views/files_listview.py @@ -63,7 +63,7 @@ def contextMenuEvent(self, event): # Look up file_id from 5th column of row id_index = index.sibling(index.row(), 5) - file_id = model.data(id_index, Qt.DisplayRole) + file_id = model.data(id_index, Qt.ItemDataRole.DisplayRole) # If a valid file selected, show file related options menu.addSeparator() @@ -95,7 +95,7 @@ def dragEnterEvent(self, event): event.ignore() return event.accept() - event.setDropAction(Qt.CopyAction) + event.setDropAction(Qt.DropAction.CopyAction) def startDrag(self, supportedActions): """ Override startDrag method to display custom icon """ @@ -113,7 +113,7 @@ def startDrag(self, supportedActions): return False # Get icon from column 0 on same row as current item - icon = current.sibling(current.row(), 0).data(Qt.DecorationRole) + icon = current.sibling(current.row(), 0).data(Qt.ItemDataRole.DecorationRole) # Start drag operation drag = QDrag(self) @@ -136,7 +136,7 @@ def dropEvent(self, event): # Use try/finally so we always reset the cursor try: # Set cursor to waiting - get_app().setOverrideCursor(QCursor(Qt.WaitCursor)) + get_app().setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor)) qurl_list = event.mimeData().urls() log.info("Processing drop event for {} urls".format(len(qurl_list))) @@ -156,7 +156,7 @@ def refresh_view(self): """Filter files with proxy class""" model = self.model() filter_text = self.win.filesFilter.text() - model.setFilterRegExp(QRegExp(filter_text.replace(' ', '.*'), Qt.CaseInsensitive)) + model.setFilterRegExp(QRegExp(filter_text.replace(' ', '.*'), Qt.CaseSensitivity.CaseInsensitive)) col = model.sortColumn() model.sort(col) @@ -196,7 +196,7 @@ def __init__(self, model, *args): self.setStyleSheet('QListView::item { padding-top: 2px; }') self.setWordWrap(False) - self.setTextElideMode(Qt.ElideRight) + self.setTextElideMode(Qt.TextElideMode.ElideRight) self.files_model.ModelRefreshed.connect(self.refresh_view) diff --git a/src/windows/views/files_treeview.py b/src/windows/views/files_treeview.py index 63ebd6a589..3ad2a367bb 100644 --- a/src/windows/views/files_treeview.py +++ b/src/windows/views/files_treeview.py @@ -66,7 +66,7 @@ def contextMenuEvent(self, event): # Look up file_id from 5th column of row id_index = index.sibling(index.row(), 5) - file_id = model.data(id_index, Qt.DisplayRole) + file_id = model.data(id_index, Qt.ItemDataRole.DisplayRole) # If a valid file selected, show file related options menu.addSeparator() @@ -95,7 +95,7 @@ def contextMenuEvent(self, event): def dragEnterEvent(self, event): # If dragging urls onto widget, accept if event.mimeData().hasUrls(): - event.setDropAction(Qt.CopyAction) + event.setDropAction(Qt.DropAction.CopyAction) event.accept() def startDrag(self, supportedActions): @@ -114,7 +114,7 @@ def startDrag(self, supportedActions): return False # Get icon from column 0 on same row as current item - icon = current.sibling(current.row(), 0).data(Qt.DecorationRole) + icon = current.sibling(current.row(), 0).data(Qt.ItemDataRole.DecorationRole) # Start drag operation drag = QDrag(self) @@ -137,7 +137,7 @@ def dropEvent(self, event): # Use try/finally so we always reset the cursor try: # Set cursor to waiting - get_app().setOverrideCursor(QCursor(Qt.WaitCursor)) + get_app().setOverrideCursor(QCursor(Qt.CursorShape.WaitCursor)) qurl_list = event.mimeData().urls() log.info("Processing drop event for {} urls".format(len(qurl_list))) @@ -228,7 +228,7 @@ def __init__(self, model, *args): self.setStyleSheet('QTreeView::item { padding-top: 2px; }') self.setWordWrap(False) - self.setTextElideMode(Qt.ElideRight) + self.setTextElideMode(Qt.TextElideMode.ElideRight) self.files_model.ModelRefreshed.connect(self.refresh_view) diff --git a/src/windows/views/menu.py b/src/windows/views/menu.py index b5a96a0b7d..b834d33ffe 100644 --- a/src/windows/views/menu.py +++ b/src/windows/views/menu.py @@ -80,6 +80,6 @@ def paintEvent(self, event): if self.border_radius: rect = QRectF(0, 0, self.width(), self.height()) - painter.drawRoundedRect(rect, self.border_radius.get('x'), self.border_radius.get('y'), Qt.AbsoluteSize) + painter.drawRoundedRect(rect, self.border_radius.get('x'), self.border_radius.get('y'), Qt.SizeMode.AbsoluteSize) painter.end() diff --git a/src/windows/views/profiles_treeview.py b/src/windows/views/profiles_treeview.py index 520b6d0fcd..6d851189f2 100644 --- a/src/windows/views/profiles_treeview.py +++ b/src/windows/views/profiles_treeview.py @@ -42,18 +42,18 @@ def selectionChanged(self, selected, deselected): self.selectionModel().clear() if not self.is_filter_running and selected and selected.first() and selected.first().indexes(): # Selection changed due to user selection or init of treeview - self.selected_profile_object = selected.first().indexes()[0].data(Qt.UserRole) + self.selected_profile_object = selected.first().indexes()[0].data(Qt.ItemDataRole.UserRole) super().selectionChanged(selected, deselected) def refresh_view(self, filter_text=""): """Filter transitions with proxy class""" self.is_filter_running = True - self.model().setFilterCaseSensitivity(Qt.CaseInsensitive) + self.model().setFilterCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive) self.model().setFilterRegExp(QRegExp(filter_text.lower())) - self.model().sort(Qt.DescendingOrder) + self.model().sort(Qt.SortOrder.DescendingOrder) # Format columns - self.sortByColumn(0, Qt.DescendingOrder) + self.sortByColumn(0, Qt.SortOrder.DescendingOrder) self.setColumnHidden(0, True) self.is_filter_running = False diff --git a/src/windows/views/properties_tableview.py b/src/windows/views/properties_tableview.py index 72551a8312..b7269ed16d 100644 --- a/src/windows/views/properties_tableview.py +++ b/src/windows/views/properties_tableview.py @@ -119,7 +119,7 @@ def paint(self, painter, option, index): log.warning("No ThemeManager loaded yet. Skip rendering properties widget.") # set background color - painter.setPen(QPen(Qt.NoPen)) + painter.setPen(QPen(Qt.PenStyle.NoPen)) if property_type == "color": # Color keyframe red = int(cur_property[1]["red"]["value"]) @@ -146,7 +146,7 @@ def paint(self, painter, option, index): painter.setBrush(QBrush(QColor("#000000"))) mask_rect = QRectF(option.rect) mask_rect.setWidth(option.rect.width() * value_percent) - painter.setClipRect(mask_rect, Qt.IntersectClip) + painter.setClipRect(mask_rect, Qt.ClipOperation.IntersectClip) # gradient for value box gradient = QLinearGradient(option.rect.topLeft(), option.rect.topRight()) @@ -170,11 +170,11 @@ def paint(self, painter, option, index): self.curve_pixmaps[interpolation]) # Set text color - painter.setPen(QPen(Qt.white)) + painter.setPen(QPen(Qt.GlobalColor.white)) - value = index.data(Qt.DisplayRole) + value = index.data(Qt.ItemDataRole.DisplayRole) if value: - painter.drawText(option.rect, Qt.AlignCenter, value) + painter.drawText(option.rect, Qt.AlignmentFlag.AlignCenter, value) painter.restore() @@ -520,7 +520,7 @@ def contextMenuEvent(self, event): file_row = self.files_model.index(file_index, 0) project_file_id = file_row.sibling(file_index, 5).data() if file_id == project_file_id: - clip_instance_icon = file_row.data(Qt.DecorationRole) + clip_instance_icon = file_row.data(Qt.ItemDataRole.DecorationRole) break effect_choices = [] @@ -607,7 +607,7 @@ def contextMenuEvent(self, event): file_row = self.files_model.index(file_index, 0) project_file_id = file_row.sibling(file_index, 5).data() if file_id == project_file_id: - clip_instance_icon = file_row.data(Qt.DecorationRole) + clip_instance_icon = file_row.data(Qt.ItemDataRole.DecorationRole) clip_choices.append({"name": clip.data["title"], "value": clip.id, "selected": False, @@ -655,7 +655,7 @@ def contextMenuEvent(self, event): idx = self.files_model.index(i, 0) if not idx.isValid(): continue - icon = idx.data(Qt.DecorationRole) + icon = idx.data(Qt.ItemDataRole.DecorationRole) name = idx.sibling(i, 1).data() path = os.path.join(idx.sibling(i, 4).data(), name) @@ -676,7 +676,7 @@ def contextMenuEvent(self, event): idx = self.transition_model.index(i, 0) if not idx.isValid(): continue - icon = idx.data(Qt.DecorationRole) + icon = idx.data(Qt.ItemDataRole.DecorationRole) name = idx.sibling(i, 1).data() path = idx.sibling(i, 3).data() @@ -1100,7 +1100,7 @@ def __init__(self, *args): self.btnSelectionName.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum) # Support rich text - self.lblSelection.setTextFormat(Qt.RichText) + self.lblSelection.setTextFormat(Qt.TextFormat.RichText) hbox = QHBoxLayout() hbox.setContentsMargins(0, 0, 0, 0) diff --git a/src/windows/views/timeline.py b/src/windows/views/timeline.py index 9a787e403b..195736e41d 100644 --- a/src/windows/views/timeline.py +++ b/src/windows/views/timeline.py @@ -2031,9 +2031,9 @@ def RazorSliceAtCursor(self, clip_id, trans_id, cursor_position): # Determine slice mode (keep both [default], keep left [shift], keep right [ctrl] slice_mode = MenuSlice.KEEP_BOTH - if int(QCoreApplication.instance().keyboardModifiers() & Qt.ControlModifier) > 0: + if int(QCoreApplication.instance().keyboardModifiers() & Qt.KeyboardModifier.ControlModifier) > 0: slice_mode = MenuSlice.KEEP_RIGHT - elif int(QCoreApplication.instance().keyboardModifiers() & Qt.ShiftModifier) > 0: + elif int(QCoreApplication.instance().keyboardModifiers() & Qt.KeyboardModifier.ShiftModifier) > 0: slice_mode = MenuSlice.KEEP_LEFT if clip_id: diff --git a/src/windows/views/timeline_backend/qwidget.py b/src/windows/views/timeline_backend/qwidget.py index c1af2f0bed..fdf02b0d4c 100644 --- a/src/windows/views/timeline_backend/qwidget.py +++ b/src/windows/views/timeline_backend/qwidget.py @@ -79,7 +79,7 @@ def __init__(self, parent=None): self.cursors[cursor_name] = QCursor(icon.pixmap(24, 24)) # Init Qt widget's properties (background repainting, etc...) - super().setAttribute(Qt.WA_OpaquePaintEvent) + super().setAttribute(Qt.WidgetAttribute.WA_OpaquePaintEvent) super().setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) # Add self as listener to project data updates (used to update the timeline) @@ -210,7 +210,7 @@ def paintEvent(self, event, *args): marker_pen = QPen(QBrush(marker_color), 1.0) marker_pen.setCosmetic(True) - playhead_color = QColor(Qt.red) + playhead_color = QColor(Qt.GlobalColor.red) playhead_color.setAlphaF(0.5) playhead_pen = QPen(QBrush(playhead_color), 2.0) playhead_pen.setCosmetic(True) @@ -407,7 +407,7 @@ def mouseMoveEvent(self, event): elif self.scroll_bar_rect.contains(event.pos()): self.setCursor(self.cursors.get('move')) else: - self.setCursor(Qt.ArrowCursor) + self.setCursor(Qt.CursorShape.ArrowCursor) # Detect dragging if self.mouse_pressed and not self.mouse_dragging: @@ -420,7 +420,7 @@ def mouseMoveEvent(self, event): elif self.scroll_bar_rect.contains(event.pos()): self.scroll_bar_dragging = True else: - self.setCursor(Qt.ArrowCursor) + self.setCursor(Qt.CursorShape.ArrowCursor) # Dragging handle if self.mouse_dragging: @@ -429,7 +429,7 @@ def mouseMoveEvent(self, event): delta = (self.mouse_position - mouse_pos) / self.width() new_left_pos = self.scrollbar_position_previous[0] - delta is_left = True - if int(QCoreApplication.instance().keyboardModifiers() & Qt.ShiftModifier) > 0: + if int(QCoreApplication.instance().keyboardModifiers() & Qt.KeyboardModifier.ShiftModifier) > 0: # SHIFT key pressed (move ) if (self.scrollbar_position_previous[1] + delta) - new_left_pos > self.min_distance: #both handles if we don't exceed min distance @@ -454,7 +454,7 @@ def mouseMoveEvent(self, event): delta = (self.mouse_position - mouse_pos) / self.width() is_left = False new_right_pos = self.scrollbar_position_previous[1] - delta - if int(QCoreApplication.instance().keyboardModifiers() & Qt.ShiftModifier) > 0: + if int(QCoreApplication.instance().keyboardModifiers() & Qt.KeyboardModifier.ShiftModifier) > 0: # SHIFT key pressed (move ) if new_right_pos - (self.scrollbar_position_previous[0] + delta) > self.min_distance: #both handles if we don't exceed min distance diff --git a/src/windows/views/timeline_backend/webengine.py b/src/windows/views/timeline_backend/webengine.py index f5d7430246..b1cb0b452d 100644 --- a/src/windows/views/timeline_backend/webengine.py +++ b/src/windows/views/timeline_backend/webengine.py @@ -71,7 +71,7 @@ def __init__(self): self.page().setBackgroundColor(QColor("#363636")) # Delete the webview when closed - self.setAttribute(Qt.WA_DeleteOnClose) + self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) # Enable smooth scrolling on timeline self.settings().setAttribute(self.settings().ScrollAnimatorEnabled, True) @@ -132,7 +132,7 @@ def get_html(self): def keyPressEvent(self, event): """ Keypress callback for timeline """ key_value = event.key() - if key_value in [Qt.Key_Shift, Qt.Key_Control]: + if key_value in [Qt.Key.Key_Shift, Qt.Key.Key_Control]: # Only pass a few keystrokes to the webview (CTRL and SHIFT) return QWebEngineView.keyPressEvent(self, event) # Ignore most keypresses diff --git a/src/windows/views/timeline_backend/webkit.py b/src/windows/views/timeline_backend/webkit.py index c4afc9691c..ef26471231 100644 --- a/src/windows/views/timeline_backend/webkit.py +++ b/src/windows/views/timeline_backend/webkit.py @@ -59,7 +59,7 @@ def __init__(self): self.html_path = os.path.join(info.PATH, 'timeline', 'index.html') # Delete the webview when closed - self.setAttribute(Qt.WA_DeleteOnClose) + self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose) # Connect logging web page (for console.log) self.new_page = LoggingWebKitPage(self) @@ -122,7 +122,7 @@ def get_html(self): def keyPressEvent(self, event): """ Keypress callback for timeline """ key_value = event.key() - if key_value in [Qt.Key_Shift, Qt.Key_Control]: + if key_value in [Qt.Key.Key_Shift, Qt.Key.Key_Control]: # Only pass a few keystrokes to the webview (CTRL and SHIFT) return QWebView.keyPressEvent(self, event) else: diff --git a/src/windows/views/titles_listview.py b/src/windows/views/titles_listview.py index 47c0e34e7a..650033d7a1 100644 --- a/src/windows/views/titles_listview.py +++ b/src/windows/views/titles_listview.py @@ -68,6 +68,6 @@ def __init__(self, *args, window=None, **kwargs): self.setResizeMode(QListView.Adjust) self.setUniformItemSizes(True) self.setWordWrap(True) - self.setTextElideMode(Qt.ElideRight) + self.setTextElideMode(Qt.TextElideMode.ElideRight) self.refresh_view() diff --git a/src/windows/views/transitions_listview.py b/src/windows/views/transitions_listview.py index 59fff02afe..e61264c51f 100644 --- a/src/windows/views/transitions_listview.py +++ b/src/windows/views/transitions_listview.py @@ -67,7 +67,7 @@ def startDrag(self, supportedActions): return False # Get icon from column 0 on same row as current item - icon = current.sibling(current.row(), 0).data(Qt.DecorationRole) + icon = current.sibling(current.row(), 0).data(Qt.ItemDataRole.DecorationRole) # Start drag operation drag = QDrag(self) @@ -83,8 +83,8 @@ def refresh_view(self): """Filter transitions with proxy class""" filter_text = self.win.transitionsFilter.text() self.model().setFilterRegExp(QRegExp(filter_text.replace(' ', '.*'))) - self.model().setFilterCaseSensitivity(Qt.CaseInsensitive) - self.model().sort(Qt.AscendingOrder) + self.model().setFilterCaseSensitivity(Qt.CaseSensitivity.CaseInsensitive) + self.model().sort(Qt.SortOrder.AscendingOrder) def __init__(self, model): # Invoke parent init @@ -116,7 +116,7 @@ def __init__(self, model): self.setResizeMode(QListView.Adjust) self.setUniformItemSizes(True) self.setWordWrap(False) - self.setTextElideMode(Qt.ElideRight) + self.setTextElideMode(Qt.TextElideMode.ElideRight) self.setStyleSheet('QListView::item { padding-top: 2px; }') # setup filter events diff --git a/src/windows/views/transitions_treeview.py b/src/windows/views/transitions_treeview.py index 3840d37be4..e54f8c7688 100644 --- a/src/windows/views/transitions_treeview.py +++ b/src/windows/views/transitions_treeview.py @@ -65,7 +65,7 @@ def startDrag(self, event): return False # Get icon from column 0 on same row as current item - icon = current.sibling(current.row(), 0).data(Qt.DecorationRole) + icon = current.sibling(current.row(), 0).data(Qt.ItemDataRole.DecorationRole) # Start drag operation drag = QDrag(self) @@ -81,7 +81,7 @@ def refresh_columns(self): self.hideColumn(2) self.hideColumn(3) self.setColumnWidth(0, 80) - self.sortByColumn(1, Qt.AscendingOrder) + self.sortByColumn(1, Qt.SortOrder.AscendingOrder) def __init__(self, model): # Invoke parent init diff --git a/src/windows/views/tutorial.py b/src/windows/views/tutorial.py index 50cffc5a39..b21f82168b 100644 --- a/src/windows/views/tutorial.py +++ b/src/windows/views/tutorial.py @@ -74,7 +74,7 @@ def paintEvent(self, event, *args): def checkbox_metrics_callback(self, state): """ Callback for error and anonymous usage checkbox""" s = get_app().get_settings() - if state == Qt.Checked: + if state == Qt.CheckState.Checked: # Enabling metrics sending s.set("send_metrics", True) sentry.init_tracing() @@ -115,10 +115,10 @@ def __init__(self, widget_id, text, arrow, manager, *args): # Add label self.label = QLabel(self) self.label.setText(text) - self.label.setTextFormat(Qt.RichText) + self.label.setTextFormat(Qt.TextFormat.RichText) self.label.setWordWrap(True) self.label.setStyleSheet("margin-left: 20px;") - self.label.setAttribute(Qt.WA_TransparentForMouseEvents) + self.label.setAttribute(Qt.WidgetAttribute.WA_TransparentForMouseEvents) vbox.addWidget(self.label) # Add error and anonymous metrics checkbox (for ID=0) tooltip @@ -133,9 +133,9 @@ def __init__(self, widget_id, text, arrow, manager, *args): checkbox_metrics.setText(_("Yes, I would like to improve OpenShot!")) checkbox_metrics.setStyleSheet("margin-left: 25px; margin-bottom: 5px;") if s.get("send_metrics"): - checkbox_metrics.setCheckState(Qt.Checked) + checkbox_metrics.setCheckState(Qt.CheckState.Checked) else: - checkbox_metrics.setCheckState(Qt.Unchecked) + checkbox_metrics.setCheckState(Qt.CheckState.Unchecked) checkbox_metrics.stateChanged.connect(functools.partial(self.checkbox_metrics_callback)) vbox.addWidget(checkbox_metrics) @@ -145,8 +145,8 @@ def __init__(self, widget_id, text, arrow, manager, *args): # Close action self.close_action = QAction(_("Hide Tutorial"), self) - self.close_action.setShortcut(QKeySequence(Qt.Key_Escape)) - self.close_action.setShortcutContext(Qt.ApplicationShortcut) + self.close_action.setShortcut(QKeySequence(Qt.Key.Key_Escape)) + self.close_action.setShortcutContext(Qt.ShortcutContext.ApplicationShortcut) # Create buttons self.btn_close_tips = QPushButton(self) @@ -163,15 +163,15 @@ def __init__(self, widget_id, text, arrow, manager, *args): # Set layout, cursor, and size self.setLayout(vbox) - self.setCursor(Qt.ArrowCursor) + self.setCursor(Qt.CursorShape.ArrowCursor) self.setMinimumWidth(350) self.setMinimumHeight(100) - self.setFocusPolicy(Qt.ClickFocus) + self.setFocusPolicy(Qt.FocusPolicy.ClickFocus) # Make transparent - self.setAttribute(Qt.WA_NoSystemBackground, True) - self.setAttribute(Qt.WA_TranslucentBackground, True) - self.setAttribute(Qt.WA_DeleteOnClose, True) + self.setAttribute(Qt.WidgetAttribute.WA_NoSystemBackground, True) + self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground, True) + self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose, True) # Connect close action signal self.close_action.triggered.connect( @@ -439,9 +439,9 @@ def __init__(self, win, *args): # Configure tutorial frame self.dock.setTitleBarWidget(QWidget()) # Prevents window decoration - self.dock.setAttribute(Qt.WA_NoSystemBackground, True) - self.dock.setAttribute(Qt.WA_TranslucentBackground, True) - self.dock.setWindowFlags(Qt.FramelessWindowHint) + self.dock.setAttribute(Qt.WidgetAttribute.WA_NoSystemBackground, True) + self.dock.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground, True) + self.dock.setWindowFlags(Qt.WindowType.FramelessWindowHint) self.dock.setFloating(True) # Timer for processing new tutorials diff --git a/src/windows/views/zoom_slider.py b/src/windows/views/zoom_slider.py index 28d5615adf..c4eefd3f17 100644 --- a/src/windows/views/zoom_slider.py +++ b/src/windows/views/zoom_slider.py @@ -289,7 +289,7 @@ def mouseMoveEvent(self, event): elif self.scroll_bar_rect.contains(event.pos()): self.setCursor(self.cursors.get('move')) else: - self.setCursor(Qt.ArrowCursor) + self.setCursor(Qt.CursorShape.ArrowCursor) # Detect dragging if self.mouse_pressed and not self.mouse_dragging: @@ -302,7 +302,7 @@ def mouseMoveEvent(self, event): elif self.scroll_bar_rect.contains(event.pos()): self.scroll_bar_dragging = True else: - self.setCursor(Qt.ArrowCursor) + self.setCursor(Qt.CursorShape.ArrowCursor) # Dragging handle if self.mouse_dragging: @@ -311,7 +311,7 @@ def mouseMoveEvent(self, event): delta = (self.mouse_position - mouse_pos) / self.width() new_left_pos = self.scrollbar_position_previous[0] - delta is_left = True - if int(QCoreApplication.instance().keyboardModifiers() & Qt.ShiftModifier) > 0: + if int(QCoreApplication.instance().keyboardModifiers() & Qt.KeyboardModifier.ShiftModifier) > 0: # SHIFT key pressed (move ) if (self.scrollbar_position_previous[1] + delta) - new_left_pos > self.min_distance: #both handles if we don't exceed min distance @@ -336,7 +336,7 @@ def mouseMoveEvent(self, event): delta = (self.mouse_position - mouse_pos) / self.width() is_left = False new_right_pos = self.scrollbar_position_previous[1] - delta - if int(QCoreApplication.instance().keyboardModifiers() & Qt.ShiftModifier) > 0: + if int(QCoreApplication.instance().keyboardModifiers() & Qt.KeyboardModifier.ShiftModifier) > 0: # SHIFT key pressed (move ) if new_right_pos - (self.scrollbar_position_previous[0] + delta) > self.min_distance: #both handles if we don't exceed min distance @@ -523,7 +523,7 @@ def __init__(self, *args): self.cursors[cursor_name] = QCursor(icon.pixmap(24, 24)) # Init Qt widget's properties (background repainting, etc...) - super().setAttribute(Qt.WA_OpaquePaintEvent) + super().setAttribute(Qt.WidgetAttribute.WA_OpaquePaintEvent) super().setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) # Add self as listener to project data updates (used to update the timeline)