diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2022-05-25 10:52:09 +0200 |
---|---|---|
committer | Andrei Golubev <andrei.golubev@qt.io> | 2022-06-03 08:46:10 +0200 |
commit | 6ced46e4222a10074b8ac544a992b040ee53ea35 (patch) | |
tree | 016cd16f2ec66496fab35b69cd5abfeb3dc29a02 /tests/auto/qml/qmltc/QmltcTests/cpptypes/deferredpropertytypes.h | |
parent | 7dba66ab707b74458fe8c9f3422c42d2ff733040 (diff) |
Rename tst_qmltc_{no}diskcache data folder to QmltcTests
Follow the policy of "good" QML modules where the module would reside
in a folder named the same way as the module URI
Somehow this is still not enough to remove an explicit
"-i <own qmldir>" workaround in qmltc compilation command
Change-Id: If1725ec03baf3690bb6cb8fc7876b082a155eaa2
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qmltc/QmltcTests/cpptypes/deferredpropertytypes.h')
-rw-r--r-- | tests/auto/qml/qmltc/QmltcTests/cpptypes/deferredpropertytypes.h | 136 |
1 files changed, 136 insertions, 0 deletions
diff --git a/tests/auto/qml/qmltc/QmltcTests/cpptypes/deferredpropertytypes.h b/tests/auto/qml/qmltc/QmltcTests/cpptypes/deferredpropertytypes.h new file mode 100644 index 0000000000..24d7d46aaa --- /dev/null +++ b/tests/auto/qml/qmltc/QmltcTests/cpptypes/deferredpropertytypes.h @@ -0,0 +1,136 @@ +/**************************************************************************** +** +** Copyright (C) 2022 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$ +** +****************************************************************************/ + +#ifndef DEFERREDPROPERTYTYPES_H +#define DEFERREDPROPERTYTYPES_H + +#include <QtCore/qobject.h> +#include <QtCore/qproperty.h> +#include <QtQml/qqmlregistration.h> +#include <QtQuick/qquickitem.h> + +#include "testgroupedtype.h" +#include "testattachedtype.h" + +// normal properties: + +class TypeWithDeferredProperty : public QObject +{ + Q_OBJECT + QML_ELEMENT + Q_CLASSINFO("DeferredPropertyNames", "deferredProperty") + + Q_PROPERTY(QQuickItem *deferredProperty READ deferredProperty WRITE setDeferredProperty BINDABLE + bindableDeferredProperty) + + QProperty<QQuickItem *> m_deferredProperty { nullptr }; + +public: + TypeWithDeferredProperty(QObject *parent = nullptr) : QObject(parent) { } + + QQuickItem *deferredProperty() const; + void setDeferredProperty(QQuickItem *); + QBindable<QQuickItem *> bindableDeferredProperty(); +}; + +// group properties: + +class TestTypeGroupedWithDeferred : public TestTypeGrouped +{ + Q_OBJECT + Q_PROPERTY(int deferred READ getDeferred WRITE setDeferred BINDABLE bindableDeferred) + QML_ANONYMOUS + Q_CLASSINFO("DeferredPropertyNames", "deferred") + + QProperty<int> m_deferred { 0 }; + +public: + int getDeferred() const { return m_deferred; } + void setDeferred(int v) { m_deferred = v; } + QBindable<int> bindableDeferred() const { return QBindable<int>(&m_deferred); } +}; + +class TypeWithDeferredGroup : public QObject +{ + Q_OBJECT + QML_ELEMENT + + Q_PROPERTY(TestTypeGroupedWithDeferred *group READ getGroup) + + TestTypeGroupedWithDeferred m_group; + +public: + TypeWithDeferredGroup(QObject *parent = nullptr) : QObject(parent) { } + + TestTypeGroupedWithDeferred *getGroup() { return &m_group; } +}; + +// attached properties: + +class TestTypeAttachedWithDeferred : public TestTypeAttached +{ + Q_OBJECT + Q_PROPERTY(int deferred READ getDeferred WRITE setDeferred BINDABLE bindableDeferred) + QML_ANONYMOUS + Q_CLASSINFO("DeferredPropertyNames", "deferred") + + QProperty<int> m_deferred { 0 }; + +public: + TestTypeAttachedWithDeferred(QObject *parent) : TestTypeAttached(parent) { } + + int getDeferred() const { return m_deferred; } + void setDeferred(int v) { m_deferred = v; } + QBindable<int> bindableDeferred() const { return QBindable<int>(&m_deferred); } +}; + +class DeferredAttached : public QObject +{ + Q_OBJECT + QML_ELEMENT + QML_ATTACHED(TestTypeAttachedWithDeferred) + +public: + DeferredAttached(QObject *parent = nullptr) : QObject(parent) { } + + static TestTypeAttachedWithDeferred *qmlAttachedProperties(QObject *); +}; + +// special: + +class TypeWithDeferredComplexProperties : public TypeWithDeferredGroup +{ + Q_OBJECT + QML_ELEMENT + Q_CLASSINFO("DeferredPropertyNames", "group,DeferredAttached") + +public: + TypeWithDeferredComplexProperties(QObject *parent = nullptr) : TypeWithDeferredGroup(parent) { } +}; + +#endif // DEFERREDPROPERTYTYPES_H |