aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/controls/data/TestItem.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@gmail.com>2015-08-28 13:35:19 +0200
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-08-28 13:36:16 +0000
commitb9e1bb07a97877d074267470409d1e6b0dd3a330 (patch)
tree4355caf95b2fc19dde45315d0d4ebfb1065052c9 /tests/auto/controls/data/TestItem.qml
parent11f463fc11fe799f439a1a12ca0ea1d9b1cf2a96 (diff)
StackView: fix ownership issues
QTBUG-47317 revealed that dynamically created items remained visible after popping, so they were not only kept visible but also weren't properly destroyed. The visibility issue had to be fixed so that "indestructible" (not owned by StackView) were hid. This change tackles the destruction part, and marks pop-exit items for removal so they get destroyed when transitions are finished. Now that the transitionable items are actually destroyed, a new problem was releaved. We must not delete transitionable items until both enter & exit transitions have been finished. If we did that, the finished() callback would not get called for the pop-exit transition and tst_StackView::test_transitions() would fail (yay). Change-Id: Ie2eedf99d0366820260776591ad1f8b5b68e2ec3 Task-number: QTBUG-47317 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'tests/auto/controls/data/TestItem.qml')
-rw-r--r--tests/auto/controls/data/TestItem.qml49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/auto/controls/data/TestItem.qml b/tests/auto/controls/data/TestItem.qml
new file mode 100644
index 00000000..e018670f
--- /dev/null
+++ b/tests/auto/controls/data/TestItem.qml
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.5
+
+Item {
+ id: item
+ property var createdCallback
+ property var destroyedCallback
+ Component.onCompleted: if (createdCallback) createdCallback(item)
+ Component.onDestruction: if (destroyedCallback) destroyedCallback(item)
+}