summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdemos/declarative/samegame/SamegameCore/samegame.js2
-rw-r--r--demos/declarative/snake/content/snake.js8
-rw-r--r--doc/src/snippets/declarative/componentCreation.js6
-rw-r--r--examples/declarative/dynamic/qml/itemCreation.js6
-rw-r--r--examples/declarative/tutorials/samegame/samegame2/samegame.js8
-rw-r--r--examples/declarative/tutorials/samegame/samegame3/samegame.js8
-rwxr-xr-xexamples/declarative/tutorials/samegame/samegame4/content/samegame.js8
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp59
-rw-r--r--src/declarative/qml/qdeclarativecomponent.h5
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp1
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp2
11 files changed, 30 insertions, 83 deletions
diff --git a/demos/declarative/samegame/SamegameCore/samegame.js b/demos/declarative/samegame/SamegameCore/samegame.js
index bf99ca3..cc0a70d 100755
--- a/demos/declarative/samegame/SamegameCore/samegame.js
+++ b/demos/declarative/samegame/SamegameCore/samegame.js
@@ -175,7 +175,7 @@ function createBlock(column,row){
// only work if the block QML is a local file. Otherwise the component will
// not be ready immediately. There is a statusChanged signal on the
// component you could use if you want to wait to load remote files.
- if(component.isReady){
+ if(component.status == Component.Ready){
var dynamicObject = component.createObject();
if(dynamicObject == null){
console.log("error creating block");
diff --git a/demos/declarative/snake/content/snake.js b/demos/declarative/snake/content/snake.js
index 02f9757..102bd87 100644
--- a/demos/declarative/snake/content/snake.js
+++ b/demos/declarative/snake/content/snake.js
@@ -52,8 +52,8 @@ function startNewGame()
link.spawned = false;
link.dying = false;
} else {
- if(linkComponent.isReady == false){
- if(linkComponent.isError == true)
+ if(linkComponent.status != Component.Ready) {
+ if(linkComponent.status == Component.Error)
console.log(linkComponent.errorsString());
else
console.log("Still loading linkComponent");
@@ -293,8 +293,8 @@ function createCookie(value) {
}
}
- if(cookieComponent.isReady == false){
- if(cookieComponent.isError == true)
+ if(cookieComponent.status != Component.Ready) {
+ if(cookieComponent.status == Component.Error)
console.log(cookieComponent.errorsString());
else
console.log("Still loading cookieComponent");
diff --git a/doc/src/snippets/declarative/componentCreation.js b/doc/src/snippets/declarative/componentCreation.js
index be3e4d6..814545e 100644
--- a/doc/src/snippets/declarative/componentCreation.js
+++ b/doc/src/snippets/declarative/componentCreation.js
@@ -3,7 +3,7 @@ var component;
var sprite;
function finishCreation() {
- if (component.isReady) {
+ if (component.status == Component.Ready) {
sprite = component.createObject();
if (sprite == null) {
// Error Handling
@@ -13,7 +13,7 @@ function finishCreation() {
sprite.y = 100;
// ...
}
- } else if (component.isError()) {
+ } else if (component.status == Component.Error) {
// Error Handling
console.log("Error loading component:", component.errorsString());
}
@@ -26,7 +26,7 @@ function createSpriteObjects() {
//![2]
component = Qt.createComponent("Sprite.qml");
- if (component.isReady)
+ if (component.status == Component.Ready)
finishCreation();
else
component.statusChanged.connect(finishCreation);
diff --git a/examples/declarative/dynamic/qml/itemCreation.js b/examples/declarative/dynamic/qml/itemCreation.js
index 98d48a8..3c1b975 100644
--- a/examples/declarative/dynamic/qml/itemCreation.js
+++ b/examples/declarative/dynamic/qml/itemCreation.js
@@ -33,7 +33,7 @@ function loadComponent() {
itemComponent = Qt.createComponent(itemButton.file);
//console.log(itemButton.file)
- if(itemComponent.isLoading){
+ if(itemComponent.status == Component.Loading){
component.statusChanged.connect(finishCreation);
}else{//Depending on the content, it can be ready or error immediately
createItem();
@@ -41,7 +41,7 @@ function loadComponent() {
}
function createItem() {
- if (itemComponent.isReady && draggedItem == null) {
+ if (itemComponent.status == Component.Ready && draggedItem == null) {
draggedItem = itemComponent.createObject();
draggedItem.parent = window;
draggedItem.image = itemButton.image;
@@ -49,7 +49,7 @@ function createItem() {
draggedItem.y = yOffset;
startingZ = draggedItem.z;
draggedItem.z = 4;//On top
- } else if (itemComponent.isError) {
+ } else if (itemComponent.status == Component.Error) {
draggedItem = null;
console.log("error creating component");
console.log(component.errorsString());
diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.js b/examples/declarative/tutorials/samegame/samegame2/samegame.js
index e5c790d..bcfb5b6 100644
--- a/examples/declarative/tutorials/samegame/samegame2/samegame.js
+++ b/examples/declarative/tutorials/samegame/samegame2/samegame.js
@@ -37,10 +37,10 @@ function createBlock(column, row) {
if (component == null)
component = Qt.createComponent("Block.qml");
- // Note that if Block.qml was not a local file, component.isReady would be
- // false and we should wait for the component's statusChanged() signal to
- // know when the file is downloaded and fully loaded before calling createObject().
- if (component.isReady) {
+ // Note that if Block.qml was not a local file, component.status would be
+ // Loading and we should wait for the component's statusChanged() signal to
+ // know when the file is downloaded and ready before calling createObject().
+ if (component.status == Component.Ready) {
var dynamicObject = component.createObject();
if (dynamicObject == null) {
console.log("error creating block");
diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.js b/examples/declarative/tutorials/samegame/samegame3/samegame.js
index da0f76e..4256aee 100644
--- a/examples/declarative/tutorials/samegame/samegame3/samegame.js
+++ b/examples/declarative/tutorials/samegame/samegame3/samegame.js
@@ -34,10 +34,10 @@ function createBlock(column, row) {
if (component == null)
component = Qt.createComponent("Block.qml");
- // Note that if Block.qml was not a local file, component.isReady would be
- // false and we should wait for the component's statusChanged() signal to
- // know when the file is downloaded and fully loaded before calling createObject().
- if (component.isReady) {
+ // Note that if Block.qml was not a local file, component.status would be
+ // Loading and we should wait for the component's statusChanged() signal to
+ // know when the file is downloaded and ready before calling createObject().
+ if (component.status == Component.Ready) {
var dynamicObject = component.createObject();
if (dynamicObject == null) {
console.log("error creating block");
diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js
index 1454f0b..961cd66 100755
--- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js
+++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js
@@ -45,10 +45,10 @@ function createBlock(column, row) {
if (component == null)
component = Qt.createComponent("content/BoomBlock.qml");
- // Note that if Block.qml was not a local file, component.isReady would be
- // false and we should wait for the component's statusChanged() signal to
- // know when the file is downloaded and fully loaded before calling createObject().
- if (component.isReady) {
+ // Note that if Block.qml was not a local file, component.status would be
+ // Loading and we should wait for the component's statusChanged() signal to
+ // know when the file is downloaded and ready before calling createObject().
+ if (component.status == Component.Ready) {
var dynamicObject = component.createObject();
if (dynamicObject == null) {
console.log("error creating block");
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index a80f183..6ebf470 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -63,7 +63,6 @@
QT_BEGIN_NAMESPACE
class QByteArray;
-int statusId = qRegisterMetaType<QDeclarativeComponent::Status>("QDeclarativeComponent::Status");
/*!
\class QDeclarativeComponent
@@ -269,19 +268,7 @@ QDeclarativeComponent::Status QDeclarativeComponent::status() const
}
/*!
- \qmlproperty bool Component::isNull
-
- Is true if the component is in the Null state, false otherwise.
-
- Equivalent to status == Component.Null.
-*/
-
-/*!
- \property QDeclarativeComponent::isNull
-
- Is true if the component is in the Null state, false otherwise.
-
- Equivalent to status() == QDeclarativeComponent::Null.
+ Returns true if status() == QDeclarativeComponent::Null.
*/
bool QDeclarativeComponent::isNull() const
{
@@ -289,19 +276,7 @@ bool QDeclarativeComponent::isNull() const
}
/*!
- \qmlproperty bool Component::isReady
-
- Is true if the component is in the Ready state, false otherwise.
-
- Equivalent to status == Component.Ready.
-*/
-
-/*!
- \property QDeclarativeComponent::isReady
-
- Is true if the component is in the Ready state, false otherwise.
-
- Equivalent to status() == QDeclarativeComponent::Ready.
+ Returns true if status() == QDeclarativeComponent::Ready.
*/
bool QDeclarativeComponent::isReady() const
{
@@ -309,21 +284,7 @@ bool QDeclarativeComponent::isReady() const
}
/*!
- \qmlproperty bool Component::isError
-
- Is true if the component is in the Error state, false otherwise.
-
- Equivalent to status == Component.Error.
-
- Calling errorsString() will provide a human-readable description of any errors.
-*/
-
-/*!
- \property QDeclarativeComponent::isError
-
- Is true if the component is in the Error state, false otherwise.
-
- Equivalent to status() == QDeclarativeComponent::Error.
+ Returns true if status() == QDeclarativeComponent::Error.
*/
bool QDeclarativeComponent::isError() const
{
@@ -331,19 +292,7 @@ bool QDeclarativeComponent::isError() const
}
/*!
- \qmlproperty bool Component::isLoading
-
- Is true if the component is in the Loading state, false otherwise.
-
- Equivalent to status == Component::Loading.
-*/
-
-/*!
- \property QDeclarativeComponent::isLoading
-
- Is true if the component is in the Loading state, false otherwise.
-
- Equivalent to status() == QDeclarativeComponent::Loading.
+ Returns true if status() == QDeclarativeComponent::Loading.
*/
bool QDeclarativeComponent::isLoading() const
{
diff --git a/src/declarative/qml/qdeclarativecomponent.h b/src/declarative/qml/qdeclarativecomponent.h
index f3cfe3c..b078174 100644
--- a/src/declarative/qml/qdeclarativecomponent.h
+++ b/src/declarative/qml/qdeclarativecomponent.h
@@ -64,10 +64,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeComponent : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QDeclarativeComponent)
- Q_PROPERTY(bool isNull READ isNull NOTIFY statusChanged)
- Q_PROPERTY(bool isReady READ isReady NOTIFY statusChanged)
- Q_PROPERTY(bool isError READ isError NOTIFY statusChanged)
- Q_PROPERTY(bool isLoading READ isLoading NOTIFY statusChanged)
+
Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged)
Q_PROPERTY(Status status READ status NOTIFY statusChanged)
Q_PROPERTY(QUrl url READ url CONSTANT)
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index a22011a..19d4b57 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -347,6 +347,7 @@ void QDeclarativeEnginePrivate::init()
qRegisterMetaType<QVariant>("QVariant");
qRegisterMetaType<QDeclarativeScriptString>("QDeclarativeScriptString");
qRegisterMetaType<QScriptValue>("QScriptValue");
+ qRegisterMetaType<QDeclarativeComponent::Status>("QDeclarativeComponent::Status");
QDeclarativeData::init();
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index bb5c8b7..671a262 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -265,7 +265,7 @@ QDeclarativeObjectScriptClass::property(QObject *obj, const Identifier &name)
void *args[] = { &rv, 0 };
QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args);
return Value(scriptEngine, rv);
- } else if (lastData->propType == QMetaType::Int) {
+ } else if (lastData->propType == QMetaType::Int || lastData->flags & QDeclarativePropertyCache::Data::IsEnumType) {
int rv = 0;
void *args[] = { &rv, 0 };
QMetaObject::metacall(obj, QMetaObject::ReadProperty, lastData->coreIndex, args);