aboutsummaryrefslogtreecommitdiffstats
path: root/examples/widgets/mainwindows/mdi/mdi.py
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-08-18 15:44:52 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2022-08-25 06:47:11 +0200
commit68088ecbfc1aee4096949ae365cc868c1dce1569 (patch)
tree371aeb093cf6ade7c9bf014996af8b0cb5cad133 /examples/widgets/mainwindows/mdi/mdi.py
parent4822f6a9b404e50340b86026047d0aea6ae703a2 (diff)
Examples: Add some missing slot decorators
As unearthed by the warnings added by the logging category. As a drive-by, fix some imports. Task-number: PYSIDE-2033 Change-Id: I3812c705b60eb7be744c3532fcfb0e4024763885 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit ebfaceedf7413ce70e6ae411c821e6c3e68aa37f) Reviewed-by: Simo Fält <simo.falt@qt.io>
Diffstat (limited to 'examples/widgets/mainwindows/mdi/mdi.py')
-rw-r--r--examples/widgets/mainwindows/mdi/mdi.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/examples/widgets/mainwindows/mdi/mdi.py b/examples/widgets/mainwindows/mdi/mdi.py
index e8ed8792f..a5afc18f3 100644
--- a/examples/widgets/mainwindows/mdi/mdi.py
+++ b/examples/widgets/mainwindows/mdi/mdi.py
@@ -47,7 +47,7 @@ from functools import partial
import sys
from PySide6.QtCore import (QByteArray, QFile, QFileInfo, QPoint, QSettings,
- QSaveFile, QSize, QTextStream, Qt)
+ QSaveFile, QSize, QTextStream, Qt, Slot)
from PySide6.QtGui import QAction, QIcon, QKeySequence
from PySide6.QtWidgets import (QApplication, QFileDialog, QMainWindow,
QMdiArea, QMessageBox, QTextEdit, QWidget)
@@ -194,11 +194,13 @@ class MainWindow(QMainWindow):
self.write_settings()
event.accept()
+ @Slot()
def new_file(self):
child = self.create_mdi_child()
child.new_file()
child.show()
+ @Slot()
def open(self):
file_name, _ = QFileDialog.getOpenFileName(self)
if file_name:
@@ -216,31 +218,38 @@ class MainWindow(QMainWindow):
else:
child.close()
+ @Slot()
def save(self):
if self.active_mdi_child() and self.active_mdi_child().save():
self.statusBar().showMessage("File saved", 2000)
+ @Slot()
def save_as(self):
if self.active_mdi_child() and self.active_mdi_child().save_as():
self.statusBar().showMessage("File saved", 2000)
+ @Slot()
def cut(self):
if self.active_mdi_child():
self.active_mdi_child().cut()
+ @Slot()
def copy(self):
if self.active_mdi_child():
self.active_mdi_child().copy()
+ @Slot()
def paste(self):
if self.active_mdi_child():
self.active_mdi_child().paste()
+ @Slot()
def about(self):
QMessageBox.about(self, "About MDI",
"The <b>MDI</b> example demonstrates how to write multiple "
"document interface applications using Qt.")
+ @Slot()
def update_menus(self):
has_mdi_child = (self.active_mdi_child() is not None)
self._save_act.setEnabled(has_mdi_child)
@@ -259,6 +268,7 @@ class MainWindow(QMainWindow):
self._cut_act.setEnabled(has_selection)
self._copy_act.setEnabled(has_selection)
+ @Slot()
def update_window_menu(self):
self._window_menu.clear()
self._window_menu.addAction(self._close_act)
@@ -440,6 +450,7 @@ class MainWindow(QMainWindow):
return window
return None
+ @Slot()
def switch_layout_direction(self):
if self.layoutDirection() == Qt.LeftToRight:
QApplication.setLayoutDirection(Qt.RightToLeft)