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. Make QScrollArea fill available space
Forum Updated to NodeBB v4.3 + New Features

Make QScrollArea fill available space

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 854 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.
  • A Offline
    A Offline
    A1exander_Z
    wrote on last edited by aha_1980
    #1

    Here is a brief description of what I have:

    1. A vertical layout inside other layout in a complex form, not my code but I hope it does not matter.
    2. Three widgets inside vertical layout mentioned in 1, two of them have Preferred vertical size policy, no problems with them.
    3. One widget has a QScrollArea inside, everything else is inserted in runtime into the layout of the scroll area's contents widget.

    I would like the widget with the QScrollArea to fill all available vertical space. Generally, window height is not large enough to accommodate everything within this widget (hence the scroll area), but with it it is always smaller than available vertical space. So I have a window with all other widgets nicely resizing, two widgets in the vertical layout (mentioned in 1) having fixed size, and the widget with the QScrollArea also always has the same vertical size. I think I have tried everything, spending hours and hours to test various combinations. Tried setting vertical size policy of the widget itself, of the QScrollArea inside it, and of its contents widget to Expanding. Tried setting stretch of the vertical layout (mentioned in 1). Tried calling resize() of the widget and of the QScrollArea manually. Nothing helps. The widget never resizes vertically and never fills available space.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You should provide a minimal compilable example that shows this behavior. It will make it easier to help you find what's going on.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • A Offline
        A Offline
        A1exander_Z
        wrote on last edited by
        #3

        I've made a minimal example and found it working as expected. After carefully inspecting and comparing the sources and commenting some sections of the original to localize the problem I've found than some code was overwriting the size policy and messing with the layout. Problem solved.

        1 Reply Last reply
        2

        • Login

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