Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to resize the QDockWidgets of a QMainWindow in a different proportion?
Forum Update on Monday, May 27th 2025

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

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 2.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Muraaley
    wrote on last edited by
    #1

    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???

    1 Reply Last reply
    0
    • B Offline
      B Offline
      butterface
      wrote on last edited by
      #2

      Why don't you just override the resizeEvent?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Muraaley
        wrote on last edited by
        #3

        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?

        1 Reply Last reply
        0
        • B Offline
          B Offline
          butterface
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved