From: Mitch Curtis Date: Mon, 8 Sep 2014 09:11:50 +0000 (+0200) Subject: Fix broken QJSEngine snippet in documentation. X-Git-Tag: v5.3.99+beta1~83 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4a9650233e8c01048f4058ed32999daec96c77fd;p=platform%2Fupstream%2Fqtdeclarative.git 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 --- diff --git a/src/qml/doc/snippets/code/src_script_qjsengine.cpp b/src/qml/doc/snippets/code/src_script_qjsengine.cpp index b836fab..7428ced 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]