From 91251b69edd966965bf7944aec642321c362af2a Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 20 May 2010 13:43:22 +1000 Subject: Fixes for docs, example code --- doc/src/declarative/examples.qdoc | 4 +- doc/src/declarative/integrating.qdoc | 2 +- doc/src/examples/qml-examples.qdoc | 190 ++++++++++++++++----- .../networkaccessmanagerfactory/main.cpp | 2 +- .../qgraphicslayouts/layoutItem/layoutItem.pro | 5 - .../qgraphicslayouts/layoutItem/layoutItem.qml | 12 +- .../qgraphicslayouts/layoutItem/main.cpp | 2 + .../graphicsitems/qdeclarativeflickable.cpp | 2 +- .../graphicsitems/qdeclarativelistview.cpp | 20 +-- 9 files changed, 168 insertions(+), 71 deletions(-) diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index 72c585b..a355f9f 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -75,7 +75,7 @@ For example, from your build directory, run: \list \o \l{declarative/animation/basics}{Basics} \o \l{declarative/animation/behaviors}{Behaviors} -\o \l{declarative/animation/easing}{Easing} +\o \l{declarative/animation/easing}{Easing types} \o \l{declarative/animation/states}{States} \endlist @@ -138,7 +138,7 @@ For example, from your build directory, run: \list \o \l{declarative-cppextensions-reference.html}{Reference examples} (discussed in \l {Extending QML in C++}) \o \l{declarative/cppextensions/plugins}{Plugins} -\o \l{declarative/cppextensions/qgraphicslayouts}{QGraphicsLayouts} +\o \l{declarative-cppextensions-qgraphicslayouts.html}{QGraphicsLayouts} \o \l{declarative/cppextensions/qwidgets}{QWidgets} \o \l{declarative/cppextensions/imageprovider}{Image provider} \o \l{declarative/cppextensions/networkaccessmanagerfactory}{Network access manager factory} diff --git a/doc/src/declarative/integrating.qdoc b/doc/src/declarative/integrating.qdoc index 83380a1..c6f754b 100644 --- a/doc/src/declarative/integrating.qdoc +++ b/doc/src/declarative/integrating.qdoc @@ -110,7 +110,7 @@ of QML UIs: \section2 Loading QGraphicsWidget objects in QML An alternative approach is to expose your existing QGraphicsWidget objects to -QML and construct your scene in QML instead. See the \l {declarative/cppextensions/qgraphicslayouts}{graphics layouts example} +QML and construct your scene in QML instead. See the \l {declarative-cppextensions-qgraphicslayouts.html}{graphics layouts example} which shows how to expose Qt's graphics layout classes to QML in order to use QGraphicsWidget with classes like QGraphicsLinearLayout and QGraphicsGridLayout. diff --git a/doc/src/examples/qml-examples.qdoc b/doc/src/examples/qml-examples.qdoc index fa17c6a..c2237d6 100644 --- a/doc/src/examples/qml-examples.qdoc +++ b/doc/src/examples/qml-examples.qdoc @@ -40,39 +40,43 @@ ****************************************************************************/ /*! - \title Animation basics + \title Animation: Basics \example declarative/animation/basics - This example shows how to use animations in QML. + This example shows how to create \l{QML Animation}{animations} in QML. */ /*! - \title Behaviors + \title Animation: Behaviors \example declarative/animation/behaviors + + This example shows how to use QML behaviors. */ /*! - \title Easing types + \title Animation: Easing types \example declarative/animation/easing - This example shows the different easing modes available for animations. + This example shows the different easing modes available for \l{QML Animation}{animations}. */ /*! - \title States + \title Animation: States \example declarative/animation/states + + This example shows how to use \l{States}{states} and \l{Transitions}{transitions}. */ /*! - \title Border Image + \title Image Elements: Border Image \example declarative/imageelements/borderimage - This example shows how to use a BorderImage in QML. + This example shows how to use the BorderImage element. */ /*! \page declarative-cppextensions-reference.html - \title C++ Extensions - Reference examples + \title C++ Extensions: Reference examples These examples show how QML can be extended from C++ in various ways. @@ -99,33 +103,67 @@ */ /*! - \title Plugins + \title C++ Extensions: Plugins \example declarative/cppextensions/plugins + + This example shows how to create a C++ plugin extension by subclassing QDeclarativeExtensionPlugin. +*/ + +/*! + \title Graphics Layouts + \example declarative/cppextensions/qgraphicslayouts/graphicsLayouts + + This example show how to integrate Qt \l{Graphics View Framework}{Graphics View} components + like QGraphicsLayoutItem, QGraphicsLinearLayout and QGraphicsGridLayout into QML. */ +/*! + \title Layout Item + \example declarative/cppextensions/qgraphicslayouts/layoutItem + This example show how to integrate QML into an existing + \l{Graphics View Framework}{Graphics View}-based application. +*/ /*! - \title QGraphicsLayouts - \example declarative/cppextensions/qgraphicslayouts + \page declarative-cppextensions-qgraphicslayouts.html + \title C++ Extensions: QGraphicsLayouts + + These examples show how to integrate \l{Graphics View Framework}{Graphics View} + layout components with QML: + + \list + \o \l{declarative/cppextensions/qgraphicslayouts/graphicsLayouts}{Graphics Layouts} + \o \l{declarative/cppextensions/qgraphicslayouts/layoutItem}{Layout Item} + \endlist */ /*! - \title QWidgets + \title C++ Extensions: QWidgets \example declarative/cppextensions/qwidgets + + This example shows how to embed QWidget-based objects into QML using QGraphicsProxyWidget. */ /*! - \title Image Provider + \title C++ Extensions: Image Provider \example declarative/cppextensions/imageprovider + + This examples shows how to use QDeclarativeImageProvider to serve images asynchronously + into a QML item. */ /*! - \title Network access manager + \title C++ Extensions: Network access manager \example declarative/cppextensions/networkaccessmanagerfactory + + This example shows how to use QDeclarativeNetworkAccessManagerFactory to create a QNetworkAccessManager + with a proxy. */ /*! \title Internationlization \example declarative/i18n + + This example shows how to enable text translation in QML. */ /*! @@ -137,7 +175,7 @@ */ /*! - \title Focus + \title Key Interaction: Focus \example declarative/keyinteraction/focus This example shows how to handle keys and focus in QML. @@ -146,144 +184,204 @@ */ /*! - \title GridView + \title Models and Views: GridView \example declarative/modelviews/gridview + + This example shows how to use the GridView element. */ /*! - \title ListView + \title Models and Views: ListView \example declarative/modelviews/listview + + This example shows how to use the ListView element. */ /*! - \title Object ListModel + \title Models and Views: Object ListModel \example declarative/modelviews/objectlistmodel + + This example shows how to create a C++ extension that exposes a + QList as a model in QML. */ /*! - \title Package + \title Models and Views: Package \example declarative/modelviews/package + + This example shows how to use the Package element. */ /*! - \title Parallax + \title Models and Views: Parallax \example declarative/modelviews/parallax + + This example shows how to combine and switch between views. */ /*! - \title String ListModel + \title Models and Views: String ListModel \example declarative/modelviews/stringlistmodel + + This example shows how to create a C++ extension that exposes a + QStringList as a model in QML. */ /*! - \title WebView + \title Models and Views: WebView \example declarative/modelviews/webview + + This example shows how to use the WebView element. */ /*! \title SQL Local Storage \example declarative/sqllocalstorage + + This example shows how to use the SQL Local Storage API in QML. */ /*! - \title Fonts + \title Text: Fonts \example declarative/text/fonts + + This example shows how to discover available fonts from QML and use + fonts in different ways. */ /*! - \title Threaded ListModel + \title Threading: Threaded ListModel \example declarative/threading/threadedlistmodel + + This example shows how to use a ListModel from multiple threads using + WorkerScript. */ /*! - \title WorkerScript + \title Threading: WorkerScript \example declarative/threading/workerscript + + This example shows how to use the WorkerScript element for threading in QML. */ /*! - \title Clocks + \title Toys: Clocks \example declarative/toys/clocks - This example shows how to create a Clock component and reuse it in a grid. + This example displays a set of clocks with different times for different cities. + Each clock is created by combining \l Image elements with \l Rotation transforms + and \l SpringFollow animations. */ /*! - \title Corkboards + \title Toys: Corkboards \example declarative/toys/corkboards + + This example presents a flickable set of interactive corkboards. It is created + through a combination of elements like \l ListModel, \l Repeater and \l TextEdit + together with rotation and scaling transforms, animation and mouse interaction. */ /*! - \title Dial + \title Toys: Dial \example declarative/toys/dial - This example shows how to implement a dial in QML. + This example presents an interactive speedometer-type dial by combining + \l Image elements with \l Rotation transforms and \l SpringFollow animations. */ /*! - \title Dynamic Scene + \title Toys: Dynamic Scene \example declarative/toys/dynamicscene - This example shows how to create dynamic objects QML. + This example presents an interactive drag-and-drop scene. It demonstrates + how to use QML's \l{Dynamic Object Creation} support to dynamically create and + destroy objects. */ /*! - \title Tic-Tac-Toe + \title Toys: Tic-Tac-Toe \example declarative/toys/tic-tac-toe + + This example presents a simple implementation of Tic Tac Toe. */ /*! - \title TV Tennis + \title Toys: TV Tennis \example declarative/toys/tvtennis + + This example shows how to use animation components such as \l SpringFollow, + \l SequentialAnimation and \l PropertyAction to create a game of TV tennis. */ /*! - \title Gestures + \title Touch Interaction: Gestures \example declarative/touchinteraction/gestures + + This example shows how to use the GestureArea element. */ /*! - \title Mouse Area + \title Touch Interaction: Mouse Area \example declarative/touchinteraction/mousearea + + This example shows how to use the MouseArea element. */ /*! - \title Flipable + \title UI Components: Flipable \example declarative/ui-components/flipable - This example shows how to use a Flipable element in QML. + This example shows how to use the Flipable element. */ /*! - \title Progress Bars + \title UI Components: Progress Bars \example declarative/ui-components/progressbar + + This example shows how to create a progress bar. */ /*! - \title Scrollbar + \title UI Components: Scroll Bar \example declarative/ui-components/scrollbar + + This example shows how to create scroll bars for a Flickable element + using the \l {Flickable::visibleArea.xPosition}{Flickable::visibleArea} + properties. */ /*! - \title Search Box + \title UI Components: Search Box \example declarative/ui-components/searchbox + + This example shows how to create a search box. */ /*! - \title Slide Switch + \title UI Components: Slide Switch \example declarative/ui-components/slideswitch + + This example shows how to create a slide switch. */ /*! - \title Spinner + \title UI Components: Spinner \example declarative/ui-components/spinner + + This example shows how to create a spinner-type component. */ /*! - \title Tab Widget + \title UI Components: Tab Widget \example declarative/ui-components/tabwidget + + This example shows how to create a tab widget. */ /*! - \title XMLHttpRequest + \title XML: XMLHttpRequest \example declarative/xml/xmlhttprequest + + This example shows how to use \l XmlHttpRequest in QML. */ diff --git a/examples/declarative/cppextensions/networkaccessmanagerfactory/main.cpp b/examples/declarative/cppextensions/networkaccessmanagerfactory/main.cpp index 4ecbb5c..fac36ff 100644 --- a/examples/declarative/cppextensions/networkaccessmanagerfactory/main.cpp +++ b/examples/declarative/cppextensions/networkaccessmanagerfactory/main.cpp @@ -49,7 +49,7 @@ /* - This example illustrates using a QNetworkAccessManagerFactory to + This example illustrates using a QDeclarativeNetworkAccessManagerFactory to create a QNetworkAccessManager with a proxy. Usage: diff --git a/examples/declarative/cppextensions/qgraphicslayouts/layoutItem/layoutItem.pro b/examples/declarative/cppextensions/qgraphicslayouts/layoutItem/layoutItem.pro index 4a3fc73..c85a400 100644 --- a/examples/declarative/cppextensions/qgraphicslayouts/layoutItem/layoutItem.pro +++ b/examples/declarative/cppextensions/qgraphicslayouts/layoutItem/layoutItem.pro @@ -1,13 +1,8 @@ -###################################################################### -# Automatically generated by qmake (2.01a) Tue May 4 13:36:26 2010 -###################################################################### - TEMPLATE = app TARGET = DEPENDPATH += . INCLUDEPATH += . QT += declarative -# Input SOURCES += main.cpp RESOURCES += layoutItem.qrc diff --git a/examples/declarative/cppextensions/qgraphicslayouts/layoutItem/layoutItem.qml b/examples/declarative/cppextensions/qgraphicslayouts/layoutItem/layoutItem.qml index 460c564..6f91dc9 100644 --- a/examples/declarative/cppextensions/qgraphicslayouts/layoutItem/layoutItem.qml +++ b/examples/declarative/cppextensions/qgraphicslayouts/layoutItem/layoutItem.qml @@ -1,15 +1,17 @@ import Qt 4.7 -LayoutItem {//Sized by the layout +LayoutItem { //Sized by the layout id: resizable + minimumSize: "100x100" maximumSize: "300x300" preferredSize: "100x100" + Rectangle { color: "yellow"; anchors.fill: parent } + Rectangle { - width: 100; height: 100; - anchors.top: parent.top; - anchors.right: parent.right; - color: "green"; + width: 100; height: 100 + anchors.top: parent.top; anchors.right: parent.right + color: "green" } } diff --git a/examples/declarative/cppextensions/qgraphicslayouts/layoutItem/main.cpp b/examples/declarative/cppextensions/qgraphicslayouts/layoutItem/main.cpp index a104251..47d3a23 100644 --- a/examples/declarative/cppextensions/qgraphicslayouts/layoutItem/main.cpp +++ b/examples/declarative/cppextensions/qgraphicslayouts/layoutItem/main.cpp @@ -53,6 +53,7 @@ int main(int argc, char* argv[]) { QApplication app(argc, argv); + //Set up a graphics scene with a QGraphicsWidget and Layout QGraphicsView view; QGraphicsScene scene; @@ -61,6 +62,7 @@ int main(int argc, char* argv[]) widget->setLayout(layout); scene.addItem(widget); view.setScene(&scene); + //Add the QML snippet into the layout QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl(":layoutItem.qml")); diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 3c0f5a2..560d586 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -415,7 +415,7 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd() These properties are typically used to draw a scrollbar. For example: \snippet doc/src/snippets/declarative/flickableScrollbar.qml 0 - \dots 4 + \dots 8 \snippet doc/src/snippets/declarative/flickableScrollbar.qml 1 \sa {declarative/ui-components/scrollbar}{scrollbar example} diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 23a6f63..61283df 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -1321,7 +1321,7 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m \snippet doc/src/snippets/declarative/listview/ContactModel.qml 0 - A ListView can display the data in the model, like this: + Another component can display this model data in a ListView, like this: \table \row @@ -1332,13 +1332,13 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m \endtable Here, the ListView creates a \c ContactModel component for its model, and a \l Text element - for its delegate. The view creates a new \l Text component for each item in the model. Note + for its delegate. The view will create a new \l Text component for each item in the model. Notice the delegate is able to access the model's \c name and \c number data directly. An improved list view is shown below. The delegate is visually improved and is moved into a separate \c contactDelegate component. Also, the currently selected item is highlighted with a blue \l Rectangle using the \l highlight property, and \c focus is set to \c true - to enable keyboard navigation for the list. + to enable keyboard navigation for the list view. \table \row @@ -1346,10 +1346,10 @@ void QDeclarativeListViewPrivate::flick(AxisData &data, qreal minExtent, qreal m \o \image listview-highlight.png \endtable - Delegates are instantiated as needed and may be destroyed at any time. + In a ListView, delegates are instantiated as needed and may be destroyed at any time. State should \e never be stored in a delegate. - \bold Note that views do not enable \e clip automatically. If the view + \note Views do not enable \e clip automatically. If the view is not clipped by another item or the screen, it will be necessary to set \e {clip: true} in order to have the out of view items clipped nicely. @@ -1693,9 +1693,9 @@ void QDeclarativeListView::setHighlightFollowsCurrentItem(bool autoHighlight) \qmlproperty real ListView::preferredHighlightEnd \qmlproperty enumeration ListView::highlightRangeMode - These properties set the preferred range of the highlight (current item) - within the view. The \c preferredHighlightEnd must be greater than or equal to - \c preferredHighlightBegin. + These properties define the preferred range of the highlight (for the current item) + within the view. The \c preferredHighlightBegin value must be less than the + \c preferredHighlightEnd value. These properties affect the position of the current item when the list is scrolled. For example, if the currently selected item should stay in the middle of the @@ -1794,8 +1794,8 @@ void QDeclarativeListView::setSpacing(qreal spacing) Possible values: \list - \o ListView.Horizontal - Items are laid out horizontally. - \o ListView.Vertical - Items are laid out vertically. This is the default value. + \o ListView.Horizontal - Items are laid out horizontally + \o ListView.Vertical (default) - Items are laid out vertically \endlist \table -- cgit v0.12 From 5732a44092e17829985a381400bafccc326a0d1f Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 20 May 2010 14:08:41 +1000 Subject: Rename Component::errorsString() -> errorString() (and also for QDeclarativeComponent) --- demos/declarative/samegame/SamegameCore/samegame.js | 4 ++-- demos/declarative/snake/content/snake.js | 4 ++-- doc/src/declarative/globalobject.qdoc | 2 +- doc/src/snippets/declarative/componentCreation.js | 4 ++-- examples/declarative/toys/dynamicscene/qml/itemCreation.js | 2 +- examples/declarative/tutorials/samegame/samegame2/samegame.js | 4 ++-- examples/declarative/tutorials/samegame/samegame3/samegame.js | 4 ++-- .../declarative/tutorials/samegame/samegame4/content/samegame.js | 4 ++-- src/declarative/QmlChanges.txt | 7 +++++-- src/declarative/qml/qdeclarativecomponent.cpp | 8 ++++---- src/declarative/qml/qdeclarativecomponent.h | 2 +- .../qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp | 1 - 12 files changed, 24 insertions(+), 22 deletions(-) diff --git a/demos/declarative/samegame/SamegameCore/samegame.js b/demos/declarative/samegame/SamegameCore/samegame.js index f9c6184..5c008a2 100755 --- a/demos/declarative/samegame/SamegameCore/samegame.js +++ b/demos/declarative/samegame/SamegameCore/samegame.js @@ -179,7 +179,7 @@ function createBlock(column,row){ var dynamicObject = component.createObject(gameCanvas); if(dynamicObject == null){ console.log("error creating block"); - console.log(component.errorsString()); + console.log(component.errorString()); return false; } dynamicObject.type = Math.floor(Math.random() * 3); @@ -192,7 +192,7 @@ function createBlock(column,row){ board[index(column,row)] = dynamicObject; }else{ console.log("error loading block component"); - console.log(component.errorsString()); + console.log(component.errorString()); return false; } return true; diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js index f5c231e..6f78b33 100644 --- a/demos/declarative/snake/content/snake.js +++ b/demos/declarative/snake/content/snake.js @@ -54,7 +54,7 @@ function startNewGame() } else { if(linkComponent.status != Component.Ready) { if(linkComponent.status == Component.Error) - console.log(linkComponent.errorsString()); + console.log(linkComponent.errorString()); else console.log("Still loading linkComponent"); continue;//TODO: Better error handling? @@ -294,7 +294,7 @@ function createCookie(value) { if(cookieComponent.status != Component.Ready) { if(cookieComponent.status == Component.Error) - console.log(cookieComponent.errorsString()); + console.log(cookieComponent.errorString()); else console.log("Still loading cookieComponent"); return;//TODO: Better error handling? diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index c29a796..bd0a9f5 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -258,7 +258,7 @@ If you are certain the files will be local, you could simplify to: The methods and properties of the Component element are defined in its own page, but when using it dynamically only two methods are usually used. \c Component.createObject() returns the created object or \c null if there is an error. -If there is an error, \l {Component::errorsString()}{Component.errorsString()} describes +If there is an error, \l {Component::errorString()}{Component.errorString()} describes the error that occurred. Note that createObject() takes exactly one argument, which is set to the parent of the created object. Graphical objects without a parent will not appear on the scene, but if you do not wish to parent the item at this point you can safely pass diff --git a/doc/src/snippets/declarative/componentCreation.js b/doc/src/snippets/declarative/componentCreation.js index f6fb379..25bc10c 100644 --- a/doc/src/snippets/declarative/componentCreation.js +++ b/doc/src/snippets/declarative/componentCreation.js @@ -14,7 +14,7 @@ function finishCreation() { } } else if (component.status == Component.Error) { // Error Handling - console.log("Error loading component:", component.errorsString()); + console.log("Error loading component:", component.errorString()); } } //![0] @@ -35,7 +35,7 @@ sprite = component.createObject(appWindow); if (sprite == null) { // Error Handling - console.log("Error loading component:", component.errorsString()); + console.log("Error loading component:", component.errorString()); } else { sprite.x = 100; sprite.y = 100; diff --git a/examples/declarative/toys/dynamicscene/qml/itemCreation.js b/examples/declarative/toys/dynamicscene/qml/itemCreation.js index 59750f3..f92dd15 100644 --- a/examples/declarative/toys/dynamicscene/qml/itemCreation.js +++ b/examples/declarative/toys/dynamicscene/qml/itemCreation.js @@ -36,7 +36,7 @@ function createItem() { } else if (itemComponent.status == Component.Error) { draggedItem = null; console.log("error creating component"); - console.log(component.errorsString()); + console.log(component.errorString()); } } diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.js b/examples/declarative/tutorials/samegame/samegame2/samegame.js index 0dbe6a6..c749dc1 100644 --- a/examples/declarative/tutorials/samegame/samegame2/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame2/samegame.js @@ -44,7 +44,7 @@ function createBlock(column, row) { var dynamicObject = component.createObject(background); if (dynamicObject == null) { console.log("error creating block"); - console.log(component.errorsString()); + console.log(component.errorString()); return false; } dynamicObject.x = column * blockSize; @@ -54,7 +54,7 @@ function createBlock(column, row) { board[index(column, row)] = dynamicObject; } else { console.log("error loading block component"); - console.log(component.errorsString()); + console.log(component.errorString()); return false; } return true; diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.js b/examples/declarative/tutorials/samegame/samegame3/samegame.js index 3e97264..df5bdfb 100644 --- a/examples/declarative/tutorials/samegame/samegame3/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame3/samegame.js @@ -41,7 +41,7 @@ function createBlock(column, row) { var dynamicObject = component.createObject(gameCanvas); if (dynamicObject == null) { console.log("error creating block"); - console.log(component.errorsString()); + console.log(component.errorString()); return false; } dynamicObject.type = Math.floor(Math.random() * 3); @@ -52,7 +52,7 @@ function createBlock(column, row) { board[index(column, row)] = dynamicObject; } else { console.log("error loading block component"); - console.log(component.errorsString()); + console.log(component.errorString()); return false; } return true; diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js index 0505b8d..930a3d8 100755 --- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js @@ -52,7 +52,7 @@ function createBlock(column, row) { var dynamicObject = component.createObject(gameCanvas); if (dynamicObject == null) { console.log("error creating block"); - console.log(component.errorsString()); + console.log(component.errorString()); return false; } dynamicObject.type = Math.floor(Math.random() * 3); @@ -65,7 +65,7 @@ function createBlock(column, row) { board[index(column, row)] = dynamicObject; } else { console.log("error loading block component"); - console.log(component.errorsString()); + console.log(component.errorString()); return false; } return true; diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index c121a2d..25c2417 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -6,8 +6,11 @@ Flickable: - flickingHorizontally and flickingVertically properties added - movingHorizontally and movingVertically properties added - flickDirection is renamed flickableDirection -Component: isReady, isLoading, isError and isNull properties removed, use - status property instead +Component: + - isReady, isLoading, isError and isNull properties removed, use + status property instead + - errorsString() renamed to errorString() + QList models no longer provide properties in model object. The properties are now updated when the object changes. An object's property "foo" may now be accessed as "foo", modelData.foo" or model.modelData.foo" diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index e757675..3f11425 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -246,7 +246,7 @@ QDeclarativeComponent::~QDeclarativeComponent() \o Component.Ready - the component has been loaded, and can be used to create instances. \o Component.Loading - the component is currently being loaded \o Component.Error - an error occurred while loading the component. - Calling errorsString() will provide a human-readable description of any errors. + Calling errorString() will provide a human-readable description of any errors. \endlist */ @@ -492,7 +492,7 @@ QList QDeclarativeComponent::errors() const } /*! - \qmlmethod string Component::errorsString() + \qmlmethod string Component::errorString() Returns a human-readable description of any errors. @@ -504,9 +504,9 @@ QList QDeclarativeComponent::errors() const /*! \internal - errorsString is only meant as a way to get the errors in script + errorString is only meant as a way to get the errors in script */ -QString QDeclarativeComponent::errorsString() const +QString QDeclarativeComponent::errorString() const { Q_D(const QDeclarativeComponent); QString ret; diff --git a/src/declarative/qml/qdeclarativecomponent.h b/src/declarative/qml/qdeclarativecomponent.h index 688e233..1d1fca7 100644 --- a/src/declarative/qml/qdeclarativecomponent.h +++ b/src/declarative/qml/qdeclarativecomponent.h @@ -86,7 +86,7 @@ public: bool isLoading() const; QList errors() const; - Q_INVOKABLE QString errorsString() const; + Q_INVOKABLE QString errorString() const; qreal progress() const; diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 9a88237..32d5da7 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -2427,7 +2427,6 @@ void tst_qdeclarativeecmascript::include() // Including file with ".pragma library" { QDeclarativeComponent component(&engine, TEST_FILE("include_pragma.qml")); - qDebug() << "errors:" << component.errorsString(); QObject *o = component.create(); QVERIFY(o != 0); QCOMPARE(o->property("test1").toInt(), 100); -- cgit v0.12