I am working on a PyQt application. There is currently a status bar (defined as QWidget) that contains QHBoxLayout. This layout is often updated with help QPushButtoncreated by another part of the application.
Whenever the buttons that appear should change (which is pretty common), the update effect is called. Existing buttons are removed from the layout (by calling layout.removeWidget(button), then button.setParent(None)), and new buttons are added to the layout.
This usually works. But sometimes, when I call button.setParent(None)the button for deletion, it makes it jump out of the application and start swimming in its own frame.
How to remove a button from the layout and make sure that it does not start?
source
share