How can I minimize my QMainWindow without also minimizing my QDockWidget that I have undocked and is floating? What I want to do, is take a small window of my GUI to monitor the rest of the MainWindow. The MainWindow does开发者_JS百科 not to be on the screen, all I want to see is the DockWidget while it is floating.
The floating window is almost certainly being minimized when your main window is minimized because the main window owns the child window. Or in other words, the floating window is a child of the main window. And a child window cannot be visible when its owner window is minimized.
The solution obviously is to break the ownership relationship between your floating window and the main window. That will probably also require that you change the type of window that your floating window represents. I'm guessing that a QDockWidget
class implements a floating tool palette or other form of pop-up window. In order to have a standalone window, you'll need to create an overlapped window.
Read more about the various types of windows here, at least assuming that you're using Windows.
I imagine that it's a similar state of affairs for the other target operating systems.
On Windows in particular, someone might suggest that you make the floating window a child of the desktop window, but let me take this opportunity to strongly advise you against doing that. For a more nuanced discussion, see Raymond Chen's blog post on the subject.
A floating QDockWidget is automatically minimized when its parent QMainWindow is minimized. There is nothing you can do about that. You may have to change your QDockWidget into a QDialog (or some other QWidget) with parent = 0.
精彩评论