aboutsummaryrefslogtreecommitdiffstats
path: root/examples/networkauth/redditclient/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/networkauth/redditclient/main.py')
-rw-r--r--examples/networkauth/redditclient/main.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/examples/networkauth/redditclient/main.py b/examples/networkauth/redditclient/main.py
new file mode 100644
index 000000000..e88e32cc5
--- /dev/null
+++ b/examples/networkauth/redditclient/main.py
@@ -0,0 +1,28 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+"""PySide6 port of the networkauth redditclient example from Qt v6.x"""
+
+from argparse import ArgumentParser, RawTextHelpFormatter
+import sys
+
+from PySide6.QtWidgets import QApplication, QListView
+
+from redditmodel import RedditModel
+
+
+if __name__ == '__main__':
+ parser = ArgumentParser(description='Qt Reddit client example',
+ formatter_class=RawTextHelpFormatter)
+ parser.add_argument('--client', '-i', type=str, help='Client id')
+ options = parser.parse_args()
+ if not options.client:
+ print('Specify a client id', file=sys.stderr)
+ sys.exit(-1)
+
+ app = QApplication(sys.argv)
+ view = QListView()
+ model = RedditModel(options.client)
+ view.setModel(model)
+ view.show()
+ sys.exit(app.exec())