iblqt.tools.run_as_qt_app
- iblqt.tools.run_as_qt_app(function)[source]
Run a function as a Qt application.
This decorator wraps a function that returns a QWidget (or subclass) to be used as the main widget of a Qt application. It ensures a QApplication instance is created (or retrieved if already existing), calls the function to get the widget, and then starts the Qt event loop.
- Parameters:
function (
Callable[...
,QWidget]
) – A function that returns a QWidget instance to be shown as the main widget of the Qt app.- Returns:
A wrapped function that runs the Qt application event loop and returns its exit code.
- Return type:
Callable[...
,int]