aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pdfwidgets/pdfviewer/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/pdfwidgets/pdfviewer/main.py')
-rw-r--r--examples/pdfwidgets/pdfviewer/main.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/examples/pdfwidgets/pdfviewer/main.py b/examples/pdfwidgets/pdfviewer/main.py
new file mode 100644
index 000000000..c4765fdda
--- /dev/null
+++ b/examples/pdfwidgets/pdfviewer/main.py
@@ -0,0 +1,27 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+import sys
+from argparse import ArgumentParser, RawTextHelpFormatter
+
+from PySide6.QtWidgets import QApplication
+from PySide6.QtCore import QCoreApplication, QUrl
+
+from mainwindow import MainWindow
+
+"""PySide6 port of the pdfwidgets/pdfviewer example from Qt v6.x"""
+
+
+if __name__ == "__main__":
+ argument_parser = ArgumentParser(description="PDF Viewer",
+ formatter_class=RawTextHelpFormatter)
+ argument_parser.add_argument("file", help="The file to open",
+ nargs='?', type=str)
+ options = argument_parser.parse_args()
+
+ a = QApplication(sys.argv)
+ w = MainWindow()
+ w.show()
+ if options.file:
+ w.open(QUrl.fromLocalFile(options.file))
+ sys.exit(QCoreApplication.exec())