summaryrefslogtreecommitdiffstats
path: root/examples/pdf/multipage/main.cpp
blob: f5b246ac480703dc267e5e44b07265b62cedb7d5 (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
// Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

#include <QGuiApplication>
#include <QQmlApplicationEngine>

int main(int argc, char* argv[])
{
    QCoreApplication::setApplicationName("Qt Quick Multi-page PDF Viewer Example");
    QCoreApplication::setOrganizationName("QtProject");
    QCoreApplication::setApplicationVersion(QT_VERSION_STR);
    QGuiApplication app(argc, argv);

    QQmlApplicationEngine engine;
    engine.load(QUrl(QStringLiteral("qrc:///pdfviewer/viewer.qml")));
    if (app.arguments().count() > 1) {
        QUrl toLoad = QUrl::fromUserInput(app.arguments().at(1));
        engine.rootObjects().first()->setProperty("source", toLoad);
    } else {
        engine.rootObjects().first()->setProperty("source", QStringLiteral("resources/test.pdf"));
    }


    return app.exec();
}