durden2.0
durden2.0

Reputation: 9542

Mimic main window addDockWidget layout behavior for QDialog

I like the default handling/layout that adding a dock widget to the main window with addDockWidget() provides. Specifically the following:

  1. Uses a QSplitter (I assume) which allows user to resize 2 dock widget and central widget.
  2. Cannot shrink the dock widget below it's minimum size hint.
  3. When dragging the size of the entire window the dock widget stays it's original size (i.e. it's different than dragging the splitter). Thus, the central widget grows when dragging the entire window instead of both dock and central widget growing.

I'd like to mimic this behavior, but on a QDialog since I can't just call addDockWidget(). I'm not really concerned about being able to drag the dock widget around and drop it on other corners, etc. I just want a QLayout setup that can do the above 3 things.

Upvotes: 1

Views: 670

Answers (1)

D K
D K

Reputation: 5760

You can use a QMainWindow instead of a QDialog in order to get dockwidget functionality for a dialog. You should not notice any difference in performace between QMainWindow and QDialog.

Upvotes: 0

Related Questions