aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-03-23 11:35:18 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2017-03-24 13:27:36 +0000
commit9ccdc189c7e39b8d4f645f082daa3a5e3fedc5b7 (patch)
treeece45471868a6749942001eb32d894cc4ce088b4
parent7c7b58c732dd30f7e98c5a0894e341f112a3124c (diff)
StackView: improve the component creation errors
Previously it just dumped the error from the component, without telling that it was anyhow related to StackView. Now it uses the standard QML warning syntax and includes the name of the operation (push/replace). Task-number: QTBUG-59634 Change-Id: Iea8df51f587c243ca065627e59bb0e5b5b526664 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
-rw-r--r--src/quicktemplates2/qquickstackelement.cpp4
-rw-r--r--tests/auto/controls/data/tst_stackview.qml6
2 files changed, 6 insertions, 4 deletions
diff --git a/src/quicktemplates2/qquickstackelement.cpp b/src/quicktemplates2/qquickstackelement.cpp
index 2744c3e9..aace170b 100644
--- a/src/quicktemplates2/qquickstackelement.cpp
+++ b/src/quicktemplates2/qquickstackelement.cpp
@@ -152,7 +152,7 @@ bool QQuickStackElement::load(QQuickStackView *parent)
if (status == QQmlComponent::Ready)
load(view);
else if (status == QQmlComponent::Error)
- qWarning() << qPrintable(component->errorString().trimmed());
+ QQuickStackViewPrivate::get(view)->warn(component->errorString().trimmed());
});
return true;
}
@@ -166,7 +166,7 @@ bool QQuickStackElement::load(QQuickStackView *parent)
QQuickStackIncubator incubator(this);
component->create(incubator, context);
if (component->isError())
- qWarning() << qPrintable(component->errorString().trimmed());
+ QQuickStackViewPrivate::get(parent)->warn(component->errorString().trimmed());
} else {
initialize();
}
diff --git a/tests/auto/controls/data/tst_stackview.qml b/tests/auto/controls/data/tst_stackview.qml
index 5afd9687..dd56d4f0 100644
--- a/tests/auto/controls/data/tst_stackview.qml
+++ b/tests/auto/controls/data/tst_stackview.qml
@@ -907,12 +907,14 @@ TestCase {
var control = createTemporaryObject(stackView, testCase, {initialItem: component})
verify(control)
+ var error = Qt.resolvedUrl("non-existent.qml") + ":-1 No such file or directory"
+
ignoreWarning("QQmlComponent: Component is not ready")
- ignoreWarning(Qt.resolvedUrl("non-existent.qml") + ":-1 No such file or directory")
+ ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":69:9: QML StackView: push: " + error)
control.push(Qt.resolvedUrl("non-existent.qml"))
ignoreWarning("QQmlComponent: Component is not ready")
- ignoreWarning(Qt.resolvedUrl("non-existent.qml") + ":-1 No such file or directory")
+ ignoreWarning(Qt.resolvedUrl("tst_stackview.qml") + ":69:9: QML StackView: replace: " + error)
control.replace(Qt.resolvedUrl("non-existent.qml"))
control.pop()