summaryrefslogtreecommitdiffstats
path: root/examples/pdfwidgets/pdfviewer/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/pdfwidgets/pdfviewer/main.cpp')
-rw-r--r--examples/pdfwidgets/pdfviewer/main.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/examples/pdfwidgets/pdfviewer/main.cpp b/examples/pdfwidgets/pdfviewer/main.cpp
new file mode 100644
index 000000000..6b890e0ac
--- /dev/null
+++ b/examples/pdfwidgets/pdfviewer/main.cpp
@@ -0,0 +1,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();
+}