2022-05-13 13:12:05 +00:00
|
|
|
// Copyright (C) 2017 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2014-06-06 14:53:33 +00:00
|
|
|
|
|
|
|
#include <QApplication>
|
2017-09-05 11:51:52 +00:00
|
|
|
#include <QCommandLineParser>
|
|
|
|
#include <QCommandLineOption>
|
2014-06-06 14:53:33 +00:00
|
|
|
|
|
|
|
#include "mainwindow.h"
|
|
|
|
|
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
QApplication app(argc, argv);
|
|
|
|
|
2020-04-30 15:37:27 +00:00
|
|
|
// this example and QQuickWidget are only functional when rendering with OpenGL
|
2022-02-09 14:20:57 +00:00
|
|
|
QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
|
2020-04-30 15:37:27 +00:00
|
|
|
|
2017-09-05 11:51:52 +00:00
|
|
|
QCoreApplication::setApplicationName("Qt QQuickView/QQuickWidget Comparison Example");
|
|
|
|
QCoreApplication::setOrganizationName("QtProject");
|
|
|
|
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
|
|
|
|
QCommandLineParser parser;
|
|
|
|
parser.setApplicationDescription(QCoreApplication::applicationName());
|
|
|
|
parser.addHelpOption();
|
|
|
|
parser.addVersionOption();
|
|
|
|
QCommandLineOption noRenderAlphaOption("no-render-alpha", "Do not render Alpha");
|
|
|
|
parser.addOption(noRenderAlphaOption);
|
|
|
|
QCommandLineOption transparentOption("transparent", "Transparent window");
|
|
|
|
parser.addOption(transparentOption);
|
|
|
|
|
|
|
|
parser.process(app);
|
|
|
|
|
|
|
|
const bool transparency = parser.isSet(transparentOption);
|
|
|
|
MainWindow widgetWindow(transparency, parser.isSet(noRenderAlphaOption));
|
2015-09-23 15:44:19 +00:00
|
|
|
if (transparency) {
|
|
|
|
widgetWindow.setAttribute(Qt::WA_TranslucentBackground);
|
|
|
|
widgetWindow.setAttribute(Qt::WA_NoSystemBackground, false);
|
|
|
|
}
|
|
|
|
|
2014-06-06 14:53:33 +00:00
|
|
|
widgetWindow.resize(1024, 768);
|
|
|
|
widgetWindow.show();
|
|
|
|
|
|
|
|
return app.exec();
|
|
|
|
}
|