diff options
author | Sami Varanka <sami.varanka@qt.io> | 2021-05-12 13:03:07 +0300 |
---|---|---|
committer | Sami Varanka <sami.varanka@qt.io> | 2021-05-18 12:44:28 +0300 |
commit | c9768c1e2440e52976c3456a9a4d302edf49f56a (patch) | |
tree | a11032d74b493fc94da94a58ead7522fb681db0f /tests/manual/qmlgradient/main.cpp | |
parent | ddbed903550cbec68688a4bcd4cb2bdddc9a850c (diff) |
Fix Gradients don't show
Added pointer to graph in Abstract3DController.
Controller can use that pointer to check whether
the graph is ready when receiving
a themetypeChanged signal. Added manual test
for gradients.
Pick-to: 6.1
Fixes: QTBUG-93506
Change-Id: I13df962b807feb615e3267f580ef57dd62a0b058
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Diffstat (limited to 'tests/manual/qmlgradient/main.cpp')
-rw-r--r-- | tests/manual/qmlgradient/main.cpp | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/manual/qmlgradient/main.cpp b/tests/manual/qmlgradient/main.cpp new file mode 100644 index 00000000..48210ef2 --- /dev/null +++ b/tests/manual/qmlgradient/main.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2021 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Qt Data Visualization module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:GPL$ +** 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 or (at your option) any later version +** approved by the KDE Free Qt Foundation. The licenses are as published by +** the Free Software Foundation and appearing in the file LICENSE.GPL3 +** 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$ +** +****************************************************************************/ + +#include <QtGui/QGuiApplication> +#include <QtCore/QDir> +#include <QtQuick/QQuickView> +#include <QtQml/QQmlEngine> + +int main(int argc, char *argv[]) +{ + qputenv("QSG_RHI_BACKEND", "opengl"); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); +#endif + + QGuiApplication app(argc, argv); + + QQuickView viewer; + + const QUrl url(QStringLiteral("qrc:/qml/qmlgradient/main.qml")); + + // The following are needed to make examples run without having to install the module + // in desktop environments. +#ifdef Q_OS_WIN + QString extraImportPath(QStringLiteral("%1/../../../%2")); +#else + QString extraImportPath(QStringLiteral("%1/../../%2")); +#endif + + viewer.engine()->addImportPath(extraImportPath.arg(QGuiApplication::applicationDirPath(), + QString::fromLatin1("qml"))); + QObject::connect( viewer.engine(), &QQmlEngine::quit, &viewer, &QWindow::close); + viewer.setSource(url); + viewer.show(); + viewer.setResizeMode(QQuickView::SizeRootObjectToView); + return app.exec(); +} |