diff options
author | Mitch Curtis <mitch.curtis@digia.com> | 2014-09-08 11:11:50 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@digia.com> | 2014-09-11 09:26:28 +0200 |
commit | 4a9650233e8c01048f4058ed32999daec96c77fd (patch) | |
tree | cd5a8ce9517cb7b4cd8524e60939550fe729151d /src/qml/doc/snippets/code/src_script_qjsengine.cpp | |
parent | 7ec11872a925a1087a2fe6891eb70045922b22c8 (diff) |
Fix broken QJSEngine snippet in documentation.
toBoolean() isn't even a function in that class, and declaring the
button on the stack causes crashes upon closing the application.
Change-Id: I063cac2bb144cfb9786f20bbc122d5af92a4c2c0
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
Diffstat (limited to 'src/qml/doc/snippets/code/src_script_qjsengine.cpp')
-rw-r--r-- | src/qml/doc/snippets/code/src_script_qjsengine.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/qml/doc/snippets/code/src_script_qjsengine.cpp b/src/qml/doc/snippets/code/src_script_qjsengine.cpp index b836fabf3d..7428cedcaf 100644 --- a/src/qml/doc/snippets/code/src_script_qjsengine.cpp +++ b/src/qml/doc/snippets/code/src_script_qjsengine.cpp @@ -79,12 +79,12 @@ if (result.isError()) //! [5] -QPushButton button; -QJSValue scriptButton = myEngine.newQObject(&button); +QPushButton *button = new QPushButton; +QJSValue scriptButton = myEngine.newQObject(button); myEngine.globalObject().setProperty("button", scriptButton); myEngine.evaluate("button.checkable = true"); -qDebug() << scriptButton.property("checkable").toBoolean(); +qDebug() << scriptButton.property("checkable").toBool(); scriptButton.property("show").call(); // call the show() slot //! [5] |