aboutsummaryrefslogtreecommitdiffstats
path: root/sources
diff options
context:
space:
mode:
authorCristián Maureira-Fredes <cristian.maureira-fredes@qt.io>2019-08-14 15:19:41 +0200
committerCristián Maureira-Fredes <cristian.maureira-fredes@qt.io>2019-08-14 18:14:24 +0200
commit95d71006c3218dde732a6c231ade29460b13a0e7 (patch)
tree30ce94a8ec6d90c546c7ee1c3db76e249fe52e71 /sources
parent696e81fcf346daae5cb48f5a4cff742ad35f0f21 (diff)
Documentation: update QInputDialog snippets
Adapting the code, since we return a tuple (retval, ok) instead of the Qt/C++ approach of having the boolean ok as a parameter. Task-number: PYSIDE-1059 Change-Id: Ied9f99048b95c034850111135ba47ff3aad34917 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources')
-rw-r--r--sources/pyside2/doc/codesnippets/examples/dialogs/standarddialogs/dialog.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/sources/pyside2/doc/codesnippets/examples/dialogs/standarddialogs/dialog.cpp b/sources/pyside2/doc/codesnippets/examples/dialogs/standarddialogs/dialog.cpp
index d4dde36bc..db11e22f8 100644
--- a/sources/pyside2/doc/codesnippets/examples/dialogs/standarddialogs/dialog.cpp
+++ b/sources/pyside2/doc/codesnippets/examples/dialogs/standarddialogs/dialog.cpp
@@ -49,32 +49,32 @@
****************************************************************************/
//! [0]
- i = QInputDialog().getInteger(self, self.tr("QInputDialog().getInteger()"),
- self.tr("Percentage:"), 25, 0, 100, 1, ok)
+ i, ok = QInputDialog().getInteger(self, "QInputDialog().getInteger()",
+ "Percentage:", 25, 0, 100, 1)
if ok:
- self.integerLabel.setText(self.tr("%1%").arg(i))
+ self.integerLabel.setText("{}%".format(i))
//! [0]
//! [1]
- d = QInputDialog().getDouble(self, self.tr("QInputDialog().getDouble()"),
- self.tr("Amount:"), 37.56, -10000, 10000, 2, ok)
+ d, ok = QInputDialog().getDouble(self, "QInputDialog().getDouble()",
+ "Amount:", 37.56, -10000, 10000, 2)
if ok:
- doubleLabel.setText(QString("$%1").arg(d))
+ doubleLabel.setText("${}".format())
//! [1]
//! [2]
- items = [self.tr("Spring"), self.tr("Summer"), self.tr("Fall"), self.tr("Winter")]
+ items = ["Spring", "Summer", "Fall", "Winter"]
- item = QInputDialog().getItem(self, self.tr("QInputDialog().getItem()"),
- selftr("Season:"), items, 0, False, ok)
+ item, ok = QInputDialog().getItem(self, "QInputDialog().getItem()",
+ "Season:", items, 0, False)
if ok and not item.isEmpty():
itemLabel.setText(item)
//! [2]
//! [3]
- text = QInputDialog::getText(self, self.tr("QInputDialog().getText()"),
- self.tr("User name:"), QLineEdit.Normal,
- QDir().home().dirName(), ok)
+ text, ok = QInputDialog().getText(self, "QInputDialog().getText()",
+ "User name:", QLineEdit.Normal,
+ QDir().home().dirName())
if ok and text:
textLabel.setText(text)
//! [3]