Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Limit the bottom dockwidget area size
Qt 6.12 LTS is out! See what's new in the release blog

Limit the bottom dockwidget area size

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 2.4k Views 1 Watching
  • 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.
  • R Offline
    R Offline
    Rory_1
    wrote on last edited by
    #1

    I'm building an image editor with the classic thumb view (in a QListView) in a QDockWidget (thumbDock). When the user drags the thumbDock to the bottom of the window I set QListView->wrapping to false and resize the thumbDock height to fit the thumbnail height.

    If the dock area is resized by the user grabbing the separator between the bottom dock and the central window I resize the thumbnails to fit as the dock is "stretched".
    When using the separator between the central widget and the thumbDock in the bottom dock widget area I do not want the dock resized larger than the maximum height of my thumbnails (160 pixels). I can monitor the resize via the eventFilter, filtering events for resize and thumbDock, and then for only the bottom dock area and height, but I do not know how to prevent resizing exceeding my maximum thumbnail height.

    I do not want to control the dock area dimensions in any of the other dock areas.

    Any suggestions would be greatly appreciated. Thanks in advance.

    DiracsbracketD 1 Reply Last reply
    0
    • R Rory_1

      I'm building an image editor with the classic thumb view (in a QListView) in a QDockWidget (thumbDock). When the user drags the thumbDock to the bottom of the window I set QListView->wrapping to false and resize the thumbDock height to fit the thumbnail height.

      If the dock area is resized by the user grabbing the separator between the bottom dock and the central window I resize the thumbnails to fit as the dock is "stretched".
      When using the separator between the central widget and the thumbDock in the bottom dock widget area I do not want the dock resized larger than the maximum height of my thumbnails (160 pixels). I can monitor the resize via the eventFilter, filtering events for resize and thumbDock, and then for only the bottom dock area and height, but I do not know how to prevent resizing exceeding my maximum thumbnail height.

      I do not want to control the dock area dimensions in any of the other dock areas.

      Any suggestions would be greatly appreciated. Thanks in advance.

      DiracsbracketD Offline
      DiracsbracketD Offline
      Diracsbracket
      wrote on last edited by Diracsbracket
      #2

      @Rory_1
      From this post, it seems that you need to set size hints on the contents of the DockWidget, not on the Dockwidget itself.

      Custom size hints, minimum and maximum sizes and size policies should be implemented in the child widget.
      QDockWidget will respect them, adjusting its own constraints to include the frame and title.
      Size constraints should not be set on the QDockWidget itself, because they change depending on whether it is docked
      

      So you could set the sizehints of the thumbnail differently when the dock is docked.

      R 1 Reply Last reply
      1
      • R Offline
        R Offline
        Rory_1
        wrote on last edited by
        #3

        Thanks. I'll work on that and mark this as resolved.

        1 Reply Last reply
        0
        • DiracsbracketD Diracsbracket

          @Rory_1
          From this post, it seems that you need to set size hints on the contents of the DockWidget, not on the Dockwidget itself.

          Custom size hints, minimum and maximum sizes and size policies should be implemented in the child widget.
          QDockWidget will respect them, adjusting its own constraints to include the frame and title.
          Size constraints should not be set on the QDockWidget itself, because they change depending on whether it is docked
          

          So you could set the sizehints of the thumbnail differently when the dock is docked.

          R Offline
          R Offline
          Rory_1
          wrote on last edited by Rory_1
          #4

          @Diracsbracket

          I really appreciate the help. My QListView is called thumbView. This worked:

           thumbView->setMaximumHeight(160);
          
          DiracsbracketD 1 Reply Last reply
          0
          • R Rory_1

            @Diracsbracket

            I really appreciate the help. My QListView is called thumbView. This worked:

             thumbView->setMaximumHeight(160);
            
            DiracsbracketD Offline
            DiracsbracketD Offline
            Diracsbracket
            wrote on last edited by
            #5

            @Rory_1
            Great! Thanks for the feedback! I'm also just discovering (and sometimes learning the hard way) the powerful Qt framework, and I'm glad I could help.

            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
            • Unsolved