aboutsummaryrefslogtreecommitdiffstats
path: root/examples/graphs/3d/widgetgraphgallery/main.py
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2024-05-22 15:45:56 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2024-05-22 16:34:44 +0200
commite14bae685a398f63ce5ea07c905b62ac7b74a395 (patch)
tree725ee7b73abe545fe7ad0644da9c3ba47292ec3a /examples/graphs/3d/widgetgraphgallery/main.py
parent9c9448277b2fba98eca14284e92a857541f76abd (diff)
Fix naming of the QtGraphs widget graph gallery example
Rename it to widgetgraphgallery, matching the name in the qtgraphs repo. Change-Id: I5e43b9d9c738860d6e5ede5687fec03b952188fe Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Diffstat (limited to 'examples/graphs/3d/widgetgraphgallery/main.py')
-rw-r--r--examples/graphs/3d/widgetgraphgallery/main.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/examples/graphs/3d/widgetgraphgallery/main.py b/examples/graphs/3d/widgetgraphgallery/main.py
new file mode 100644
index 000000000..7bb2238a7
--- /dev/null
+++ b/examples/graphs/3d/widgetgraphgallery/main.py
@@ -0,0 +1,41 @@
+# Copyright (C) 2023 The Qt Company Ltd.
+# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+"""PySide6 port of the Qt Graphs widgetgallery example from Qt v6.x"""
+
+import sys
+
+from PySide6.QtCore import QSize
+from PySide6.QtWidgets import QApplication, QTabWidget
+
+from bargraph import BarGraph
+from scattergraph import ScatterGraph
+from surfacegraph import SurfaceGraph
+
+
+if __name__ == "__main__":
+ app = QApplication(sys.argv)
+
+ # Create a tab widget for creating own tabs for Q3DBars, Q3DScatter, and Q3DSurface
+ tabWidget = QTabWidget()
+ tabWidget.setWindowTitle("Widget Gallery")
+
+ screen_size = tabWidget.screen().size()
+ minimum_graph_size = QSize(screen_size.width() / 2, screen_size.height() / 1.75)
+
+ # Create bar graph
+ bars = BarGraph(minimum_graph_size, screen_size)
+ # Create scatter graph
+ scatter = ScatterGraph(minimum_graph_size, screen_size)
+ # Create surface graph
+ surface = SurfaceGraph(minimum_graph_size, screen_size)
+
+ # Add bars widget
+ tabWidget.addTab(bars.barsWidget(), "Bar Graph")
+ # Add scatter widget
+ tabWidget.addTab(scatter.scatterWidget(), "Scatter Graph")
+ # Add surface widget
+ tabWidget.addTab(surface.surfaceWidget(), "Surface Graph")
+
+ tabWidget.show()
+ sys.exit(app.exec())