From 04b3ad0700de389e185d1ef71b41f0c564250ac5 Mon Sep 17 00:00:00 2001 From: hannes Date: Tue, 31 Jan 2023 23:56:17 +0000 Subject: [PATCH] add a pure qt standalone demo --- samples/qt_sample.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 samples/qt_sample.py diff --git a/samples/qt_sample.py b/samples/qt_sample.py new file mode 100644 index 0000000..d0b0de8 --- /dev/null +++ b/samples/qt_sample.py @@ -0,0 +1,37 @@ +""" +a pure qt demo +""" + +import unimenu.dccs.qt +from PySide2 import QtWidgets + +data = { + 'items': + [ + { + 'items': + [ + { + 'command': 'print("hello 1")', + 'label': 'tool1' + }, + { + 'command': 'print("hello 2")', + 'label': 'tool2' + } + ], + 'label': 'Tools' + } + ] +} + +# create placeholder qt window +app = QtWidgets.QApplication([]) +window = QtWidgets.QMainWindow() +menu = window.menuBar() + +# setup tools menu from config +unimenu.dccs.qt.QtMenuMaker.setup_menu(data, parent=menu) + +window.show() +app.exec_()