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