aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/doc/codesnippets/examples/mainwindows
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6/doc/codesnippets/examples/mainwindows')
-rw-r--r--sources/pyside6/doc/codesnippets/examples/mainwindows/application/mainwindow.py4
-rw-r--r--sources/pyside6/doc/codesnippets/examples/mainwindows/mdi/mainwindow.py5
2 files changed, 5 insertions, 4 deletions
diff --git a/sources/pyside6/doc/codesnippets/examples/mainwindows/application/mainwindow.py b/sources/pyside6/doc/codesnippets/examples/mainwindows/application/mainwindow.py
index f9a93cfc8..fb58f05a8 100644
--- a/sources/pyside6/doc/codesnippets/examples/mainwindows/application/mainwindow.py
+++ b/sources/pyside6/doc/codesnippets/examples/mainwindows/application/mainwindow.py
@@ -281,7 +281,7 @@ def writeSettings(self):
//! [40]
def maybeSave(self):
//! [40] //! [41]
- if textEdit.document()->isModified():
+ if textEdit.document().isModified():
ret = QMessageBox.warning(self, tr("Application"),
tr("The document has been modified.\n"
"Do you want to save your changes?"),
@@ -299,7 +299,7 @@ def loadFile(self, fileName):
file = QFile(fileName)
if !file.open(QFile.ReadOnly | QFile.Text):
QMessageBox.warning(self, tr("Application"), tr("Cannot read file "
- "{}:\n{}.".format(fileName, file.errorString())))
+ f"{fileName}:\n{file.errorString()}."))
return
in = QTextStream(file)
diff --git a/sources/pyside6/doc/codesnippets/examples/mainwindows/mdi/mainwindow.py b/sources/pyside6/doc/codesnippets/examples/mainwindows/mdi/mainwindow.py
index 9d0572d9a..984210189 100644
--- a/sources/pyside6/doc/codesnippets/examples/mainwindows/mdi/mainwindow.py
+++ b/sources/pyside6/doc/codesnippets/examples/mainwindows/mdi/mainwindow.py
@@ -163,10 +163,11 @@ class QMdiSubWindow(QMainWindow):
child = windows.at(i).widget()
text = ""
+ child_file = child.userFriendlyCurrentFile()
if i < 9:
- text = "{} {}".format(i + 1, child.userFriendlyCurrentFile())
+ text = f"&{i + 1} {child_file}"
else:
- text = "{} {}".format(i + 1, child.userFriendlyCurrentFile())
+ text = f"{i + 1} {child_file}"
action = windowMenu.addAction(text)
action.setCheckable(True)