While it might be possible to keep a widget always on top, the proper solution would be to place it in the application window’s layout: a docking window (as it is done in NodeInfo module) or add a custom toolbar (as it is done in Sequences module). You can make both docking widgets and toolbars float over the GUI or dock any side of the application window.
Ok. I have a DockWidget working as you propose in NodeInfo module example and it´s really cool.
I have turn my ToolBar to a DockWidget in Qt Designer. How can i use it?
It throw me this error:
.setFeatures(qt.QDockWidget.DockWidgetClosable + qt.QDockWidget.DockWidgetMovable + qt.QDockWidget.DockWidgetFloatable)
AttributeError: QFrame has no attribute named ‘setFeatures’
The easiest way to change the base class of the top-level widget in Qt Designer is to create a new widget and copy-paste its content (see here). You may also be able to change the class by changing the .ui file in a text editor.
It’s great that you could make this work for you. Just one more recommendation: instead of using findChild for each button, you can automatically get all of them at once by calling slicer.util. childWidgetVariables.