aboutsummaryrefslogtreecommitdiffstats
path: root/examples/widgets/itemviews/address_book/address_book.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/itemviews/address_book/address_book.py')
-rw-r--r--examples/widgets/itemviews/address_book/address_book.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/examples/widgets/itemviews/address_book/address_book.py b/examples/widgets/itemviews/address_book/address_book.py
index 2121f2783..af0cf3dee 100644
--- a/examples/widgets/itemviews/address_book/address_book.py
+++ b/examples/widgets/itemviews/address_book/address_book.py
@@ -2,6 +2,7 @@
# Copyright (C) 2022 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+from PySide6.QtCore import Slot
from PySide6.QtGui import QAction
from PySide6.QtWidgets import (QMainWindow, QFileDialog, QApplication)
@@ -24,16 +25,19 @@ class MainWindow(QMainWindow):
tool_menu = self.menuBar().addMenu("&Tools")
# Populate the File menu
- open_action = self.create_action("&Open...", file_menu, self.open_file)
- save_action = self.create_action("&Save As...", file_menu, self.save_file)
+ self.open_action = self.create_action("&Open...", file_menu, self.open_file)
+ self.save_action = self.create_action("&Save As...", file_menu, self.save_file)
file_menu.addSeparator()
- exit_action = self.create_action("E&xit", file_menu, self.close)
+ self.exit_action = self.create_action("E&xit", file_menu, self.close)
# Populate the Tools menu
- add_action = self.create_action("&Add Entry...", tool_menu, self._address_widget.add_entry)
- self._edit_action = self.create_action("&Edit Entry...", tool_menu, self._address_widget.edit_entry)
+ self.add_action = self.create_action(
+ "&Add Entry...", tool_menu, self._address_widget.add_entry)
+ self._edit_action = self.create_action(
+ "&Edit Entry...", tool_menu, self._address_widget.edit_entry)
tool_menu.addSeparator()
- self._remove_action = self.create_action("&Remove Entry", tool_menu, self._address_widget.remove_entry)
+ self._remove_action = self.create_action(
+ "&Remove Entry", tool_menu, self._address_widget.remove_entry)
# Disable the edit and remove menu items initially, as there are
# no items yet.
@@ -60,11 +64,13 @@ class MainWindow(QMainWindow):
#
# In PySide6, these functions return a tuple: (filename, filter)
+ @Slot()
def open_file(self):
filename, _ = QFileDialog.getOpenFileName(self)
if filename:
self._address_widget.read_from_file(filename)
+ @Slot()
def save_file(self):
filename, _ = QFileDialog.getSaveFileName(self)
if filename: