spacr.qt.widget_cleanup¶
Ownership-scoped cleanup for Qt objects libraries leave parentless.
Qt normally destroys a widget tree with its parent. pyqtgraph context menus
are an exception: PlotItem and ViewBox intentionally create them as
top-level windows and keep them through Python references. Closing a screen
therefore used to leave hundreds of live menu widgets behind, all of which a
later palette change had to visit.
The helper below walks only graphics scenes owned by the widget being closed.
It never sweeps QApplication and never invokes Python’s cycle collector,
so it cannot collect an unrelated live QThread wrapper.
Functions¶
|
Queue deletion of parentless pyqtgraph menus owned by |
Module Contents¶
Queue deletion of parentless pyqtgraph menus owned by
owner.- Returns:
number of distinct menu roots retired.
0also covers an environment without pyqtgraph or an owner whose C++ object is gone.