summaryrefslogtreecommitdiffstats
path: root/tests/manual/rendercapture-qml/main.cpp
blob: 449c039e4dbbd32b5f899a4679591033ed2666ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
// Copyright (C) 2016 The Qt Company Ltd and/or its subsidiary(-ies).
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only

#include <QQuickItem>
#include <QQuickView>
#include <Qt3DQuick/QQmlAspectEngine>
#include <QGuiApplication>
#include <QQmlEngine>
#include <QQmlContext>
#include "rendercaptureprovider.h"


int main(int argc, char* argv[])
{
    QGuiApplication app(argc, argv);
    QQuickView view;
    RenderCaptureProvider *provider = new RenderCaptureProvider;
    qmlRegisterType<RenderCaptureProvider>("Extras", 1, 0, "RenderCaptureProvider");

    QSurfaceFormat format;
    format.setVersion(3, 2);
    format.setProfile(QSurfaceFormat::CoreProfile);
    format.setDepthBufferSize(24);
    view.setFormat(format);

    view.engine()->rootContext()->setContextProperty("_renderCaptureProvider", provider);
    view.engine()->addImageProvider("rendercapture", provider);

    view.setSource(QUrl("qrc:/main.qml"));
    view.show();

    return app.exec();
}