From 4a9650233e8c01048f4058ed32999daec96c77fd Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 8 Sep 2014 11:11:50 +0200 Subject: Fix broken QJSEngine snippet in documentation. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/qml/doc/snippets/code/src_script_qjsengine.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/qml/doc/snippets/code') 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] -- cgit v1.2.3