diff options
Diffstat (limited to 'sources/pyside6/doc/codesnippets/examples')
3 files changed, 7 insertions, 6 deletions
diff --git a/sources/pyside6/doc/codesnippets/examples/dialogs/standarddialogs/dialog.cpp b/sources/pyside6/doc/codesnippets/examples/dialogs/standarddialogs/dialog.cpp index db11e22f8..3132bec55 100644 --- a/sources/pyside6/doc/codesnippets/examples/dialogs/standarddialogs/dialog.cpp +++ b/sources/pyside6/doc/codesnippets/examples/dialogs/standarddialogs/dialog.cpp @@ -52,14 +52,14 @@ i, ok = QInputDialog().getInteger(self, "QInputDialog().getInteger()", "Percentage:", 25, 0, 100, 1) if ok: - self.integerLabel.setText("{}%".format(i)) + self.integerLabel.setText(f"{i}%") //! [0] //! [1] d, ok = QInputDialog().getDouble(self, "QInputDialog().getDouble()", "Amount:", 37.56, -10000, 10000, 2) if ok: - doubleLabel.setText("${}".format()) + doubleLabel.setText(f"${d}") //! [1] //! [2] 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) |
