blob: 6b890e0ac0e991360d2333c89e7ce5b50a654af0 (
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
|
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#include "mainwindow.h"
#include <QApplication>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include <QUrl>
int main(int argc, char *argv[])
{
QCoreApplication::setApplicationName("Qt PDF Viewer");
QCoreApplication::setOrganizationName("QtProject");
QApplication a(argc, argv);
QCommandLineParser parser;
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("file", "The file to open.");
parser.process(a);
MainWindow w;
w.show();
if (!parser.positionalArguments().isEmpty())
w.open(QUrl::fromLocalFile(parser.positionalArguments().constFirst()));
return a.exec();
}
|