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
Forum Updated to NodeBB v4.3 + New Features

Spacing between the widgets on adding scroll bar

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 2 Posters 750 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.
  • S Offline
    S Offline
    Shines
    wrote on 21 Jun 2021, 11:22 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
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 21 Jun 2021, 16:11 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 21 Jun 2021, 17:22 last edited by
        #3
        This post is deleted!
        S 1 Reply Last reply 23 Jun 2021, 06:34
        1
        • S Shines
          21 Jun 2021, 17:22

          This post is deleted!

          S Offline
          S Offline
          Shines
          wrote on 23 Jun 2021, 06:34 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

          M 1 Reply Last reply 23 Jun 2021, 07:21
          0
          • S Shines
            23 Jun 2021, 06:34

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

            M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 23 Jun 2021, 07:21 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

            4/5

            23 Jun 2021, 06:34

            • Login

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