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. [SOLVED] Keep layout content at the top?
Forum Update on Monday, May 27th 2025

[SOLVED] Keep layout content at the top?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.5k 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.
  • U Offline
    U Offline
    utcenter
    wrote on last edited by
    #1

    I have a "list" of widgets inside of a vertical layout inside of a scroll area, looking like this:

    !http://i46.tinypic.com/jzneo.jpg(normal)!

    The problem is when the window height is increased the list items do not keep aligned to the top of the windows:

    !http://i49.tinypic.com/ay96di.jpg(expanded)!

    Any suggestions how to pin the content of the layout to keep at the top?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      JulienMaille
      wrote on last edited by
      #2

      Did you tried adding a vertical spacer at the bottom? Or simply use a "QVBoxLayout":http://doc.qt.digia.com/qt/qvboxlayout.html

      1 Reply Last reply
      0
      • U Offline
        U Offline
        utcenter
        wrote on last edited by
        #3

        Never mind that, I had already set alignment to Qt::AlignTop, but ... on the wrong layout, setting it on the actual layout fixed the issue.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          BelenMuñoz
          wrote on last edited by
          #4

          One question, what happens when you make the window smaller? It looks like widgets have a fixed size.
          I used nested layouts (lots of them) to solve this problem.

          Me casé con un enano pa jartarme de reí.

          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