How to resize the QDockWidgets of a QMainWindow in a different proportion?



  • Hello,
    I have a QMainWindow consisting of 4 QDockwidget in a grid manner (2*2). My requirement is that QDockWidget at (0,0) position has to remain big and other 3 dockwidget to remain small even when the main window is resized. How to do it?
    I dont want to make the QSizePolicy of other 3 dock widgets "fixed" because i want to enable the resizing of individual QDockwidgets for the user. Also i'm not using the central widget of QMainWindow.

    Any idea???



  • Why don't you just override the resizeEvent?



  • Do you mean overriding resizeEvent of QMainWindow? The function parameter provides the size with respect to main-window. How can I possibly calculate the new size of QDockWidgets proportinate to its old width and heights with the new size of QMainWindow?

    Overriding resizeEvent of QDockWidgets also has a problem. Because i have to resize other dockwidgets also, if a particular dockwidget is resized.

    Do you have any example code with similar kind of solution?



  • From the event you get the old size and the new size. You have to write a function f(winsize) which can calculate the size of your dock widgets which can be resized by using their resize method.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.