Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
src_qmltest_qquicktest.cpp
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4//! [2]
5// src_qmltest_qquicktest.cpp
6#include <QtQuickTest>
7#include <QQmlEngine>
8#include <QQmlContext>
9#include <QGuiApplication>
10
11class Setup : public QObject
12{
14
15public:
16 Setup() {}
17
18public slots:
20 {
21 // Initialization that only requires the QGuiApplication object to be available
22 }
23
25 {
26 // Initialization requiring the QQmlEngine to be constructed
27 engine->rootContext()->setContextProperty("myContextProperty", QVariant(true));
28 }
29
31 {
32 // Implement custom resource cleanup
33 }
34};
35
36QUICK_TEST_MAIN_WITH_SETUP(mytest, Setup)
37
38#include "src_qmltest_qquicktest.moc"
39//! [2]