aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlmetatype/data/Components/App.qml
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-03-27 13:23:18 +0100
committerLars Knoll <lars.knoll@qt.io>2019-03-28 06:35:01 +0000
commit28a114cbf7a3c2c18948e8bd582e5b5463443cab (patch)
tree7887a9ec06760047325f9b742ec3e6b64007fe88 /tests/auto/qml/qqmlmetatype/data/Components/App.qml
parent3507c29e8d9ea42e63fd0c01e27ee9263d939256 (diff)
Allow enums in QQmlType to be set up in two separate passes
The baseMetaObject and the property cache can become available at different points in time. If we have initialized the enums before either of them is available we want to add the additional enums when the other one appears. Fixes: QTBUG-74677 Change-Id: I57276681a50b6c04181c6a29e736f2dc20632a0c Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlmetatype/data/Components/App.qml')
-rw-r--r--tests/auto/qml/qqmlmetatype/data/Components/App.qml57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlmetatype/data/Components/App.qml b/tests/auto/qml/qqmlmetatype/data/Components/App.qml
new file mode 100644
index 0000000000..3792ca665e
--- /dev/null
+++ b/tests/auto/qml/qqmlmetatype/data/Components/App.qml
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQml 2.0
+
+import Components 1.0
+
+QtObject {
+ id: mainRect
+
+ property int appState: App.AppState.Blue
+ property string color: "blue"
+
+ enum AppState {
+ Red,
+ Green,
+ Blue
+ }
+
+ onAppStateChanged: {
+ if (appState === App.AppState.Green)
+ mainRect.color = "green"
+ else if (appState === App.AppState.Red)
+ mainRect.color = "red"
+ }
+
+ property Timer timer: Timer {
+ onTriggered: appState = App.AppState.Green
+ running: true
+ interval: 100
+ }
+}