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. Spacing between the widgets on adding scroll bar

Spacing between the widgets on adding scroll bar

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 743 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.
  • S Offline
    S Offline
    Shines
    wrote on last edited by
    #1

    Hi,
    I have a gridlayout and it works fine. I am trying to add a vertical scroll bar to this gridlayout. On setting scroll->setMinimumHeight(DEFAULT_HEIGHT); the spacing between the widgets in the gridlayout is set to DEFAULT_HEIGHT. I have browse button next to each widget .Also I have set
    scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); if the DEFAULT_HEIGHT is set to say some value 50, then spacing between the widgets is proper, but the height of the scroll bar is just the height of the widget and paths added becomes invisible. If the DEFAULT_HEIGHT is increased to 100 or 150, the scroll bar height is proper but the spacing between the widgets is too much even when scroll bar is not needed/present. How do I maintain the spacing between the widgets as it was earlier to adding the scroll bar and increase the height(sayto 150) when scrollbar is in need?

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

      Hi
      it sounds like you are trying to invent a QScrollArea ?
      https://doc.qt.io/qt-5/qscrollarea.html

      1 Reply Last reply
      1
      • S Offline
        S Offline
        Shines
        wrote on last edited by
        #3
        This post is deleted!
        S 1 Reply Last reply
        1
        • S Shines

          This post is deleted!

          S Offline
          S Offline
          Shines
          wrote on last edited by
          #4

          Hi,
          For the above code the spacing between the widgets is the problem. Can somebody help me to solve the spacing between the widgets

          mrjjM 1 Reply Last reply
          0
          • S Shines

            Hi,
            For the above code the spacing between the widgets is the problem. Can somebody help me to solve the spacing between the widgets

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @Shines

            Hi
            I dont see your
            scrollArea->setWidget

            Im not sure what is the actual issue for you.
            The space between widgets is normally handled by the layout.

            alt text

            And it seems to stay with the Vertical Spacing no matter what i do.
            alt text

            So from the little code, you have shown.
            I cannot guess what could be the cause of it.
            But maybe some widgets compresses or expand more than you like or something.

            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