My previous question was unanswered, so let me rephrase it:
Is it possible to make a QMainWindow
accept docking of a QDockWidget
regardless of the sizes of widget and the window?
Currently, if the window is too small to fit the minimal size of a QDockWidget
, it won't dock. It'd be ideal if the main window would grow to fit the widget.
Thanks in advance!
I had some ideas about your question last time but I thought that my solution was not ideal. So if you're still struggling I'll try to answer.
Actually there's no any problem with getting mouse enter event and resizing your main window. The problem is that when you're dragging your QDockWidget
from the outside of your main window, the latter one loses focus and can't process that event.
My idea was to install an event filter to your QDockWidget
. In its implementation you should track QDockWidget
moving and global cursor position (QCursor::pos()
). If the cursor is currently inside your main window and QDockWidget
is moving, it means that you have dragged the QDockWidget
onto the main window and it should be resized if its size is less than some minimum size.