Spacing between the widgets on adding scroll bar
-
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? -
Hi
it sounds like you are trying to invent a QScrollArea ?
https://doc.qt.io/qt-5/qscrollarea.html -
Hi,
For the above code the spacing between the widgets is the problem. Can somebody help me to solve the spacing between the widgetsHi
I dont see your
scrollArea->setWidgetIm not sure what is the actual issue for you.
The space between widgets is normally handled by the layout.And it seems to stay with the Vertical Spacing no matter what i do.
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.