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. ScrollArea assuming shorter width

ScrollArea assuming shorter width

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 355 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.
  • P Offline
    P Offline
    Pedro O S
    wrote on last edited by
    #1

    Hello,

    I have a ScrollArea with a layout widget inside. I'm trying to set the ScrollArea to expand with the window size and, in case the window is narrower than the ScrollArea's contents, show the horizontal scroll bar.
    I have set the minimimWidth of the layout widget inside to determine the default width the ScrollArea outside should assume, the trouble is, the ScrollArea assumes a size lower than that, clipping its contents.
    If I set an equivalent minimumWidth to the ScrollArea, therefore showing it fully by default, then it doesn't show the scrollbar when the window is resized below its width.
    Any help?
    Thanks,

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

      Hi
      If understand you correctly, i think you should set a minimum size on the widgets you put in the layout
      else it will compress them and not show scrollbar. The Scroll area should just follow the layout on the window itself where its lives.
      See this with buttons that as a default fixed width.
      alt text

      P 1 Reply Last reply
      0
      • mrjjM mrjj

        Hi
        If understand you correctly, i think you should set a minimum size on the widgets you put in the layout
        else it will compress them and not show scrollbar. The Scroll area should just follow the layout on the window itself where its lives.
        See this with buttons that as a default fixed width.
        alt text

        P Offline
        P Offline
        Pedro O S
        wrote on last edited by
        #3

        @mrjj The layout widgets' minimum sizes are set (thanks for the explanation). The ScrollArea's calculated width differs from the sum of these.

        I could fix this issue by noticing that the ScrollArea in question was atop another widget but not inside a vertical box. By layout both in a vertical box the ScrollArea's width was calculated correctly and functions properly.

        1 Reply Last reply
        1

        • Login

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