aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKonstantin Ritt <ritt.ks@gmail.com>2016-06-10 06:09:45 +0400
committerKonstantin Ritt <ritt.ks@gmail.com>2016-06-16 12:44:21 +0000
commit99905cad78b51c2c13a23be8bb4e167479d88aa3 (patch)
tree95788145905d543168edc58a721713546c94fd6b /src
parentbbec66f60ce8d1828c4f08b8975a031212009beb (diff)
StackView: Fix warning when popping down to the current item
findElement() is unable to find currentItem cause the most top element has been popped just few lines above, leading to "pop: unknown argument: .." warning where it shouldn't really do. Change-Id: I90d4ea6acaf09b861af281d9c0e23bc42a6eb503 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quicktemplates2/qquickstackview.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/quicktemplates2/qquickstackview.cpp b/src/quicktemplates2/qquickstackview.cpp
index 9c9cd5c2..632879f5 100644
--- a/src/quicktemplates2/qquickstackview.cpp
+++ b/src/quicktemplates2/qquickstackview.cpp
@@ -525,10 +525,12 @@ void QQuickStackView::pop(QQmlV4Function *args)
QV4::ScopedValue value(scope, (*args)[0]);
if (value->isNull()) {
enter = d->elements.value(0);
- } else if (!value->isUndefined() && !value->isInt32()) {
- enter = d->findElement(value);
+ } else if (const QV4::QObjectWrapper *o = value->as<QV4::QObjectWrapper>()) {
+ QQuickItem *item = qobject_cast<QQuickItem *>(o->object());
+ enter = d->findElement(item);
if (!enter) {
- qmlInfo(this) << "pop: unknown argument: " << value->toQString(); // TODO: safe?
+ if (item != d->currentItem)
+ qmlInfo(this) << "pop: unknown argument: " << value->toQString(); // TODO: safe?
args->setReturnValue(QV4::Encode::null());
d->elements.push(exit); // restore
return;