Resize dialog with a scrollbar
-
wrote on 22 Jan 2019, 09:48 last edited by
Hi, I have a dialog with a vertical scroll bar, and some widgets that change their size according to the user actions.
If I don't add the scroll bar the dialog resizes automatically but I was asked to add a scrollbar, and now when some controls are hidden the dialog stays the same, and the vertical scrollbar is adjusted. I want the dialog to resize automatically to the height which does not require the scrollbar, and in addition allow the user to change the height as he/she pleases (thus I need the scrollbar).
I tried all kinds of solutions, the one that works best is a little ugly:- Remove the scrollbar from the layout
- Call adjustSize()
- Restore the scrollbar
problems with this solution:
- ugly
- doesn't adjust to the dialog's minimal size, only for exapnding
-
Hi,
What are these user actions ?
-
Hi, I have a dialog with a vertical scroll bar, and some widgets that change their size according to the user actions.
If I don't add the scroll bar the dialog resizes automatically but I was asked to add a scrollbar, and now when some controls are hidden the dialog stays the same, and the vertical scrollbar is adjusted. I want the dialog to resize automatically to the height which does not require the scrollbar, and in addition allow the user to change the height as he/she pleases (thus I need the scrollbar).
I tried all kinds of solutions, the one that works best is a little ugly:- Remove the scrollbar from the layout
- Call adjustSize()
- Restore the scrollbar
problems with this solution:
- ugly
- doesn't adjust to the dialog's minimal size, only for exapnding
wrote on 22 Jan 2019, 22:28 last edited by@nnzz
Sorry, I don't understand (that often seems to happen...).-
If you're going "to resize automatically to the height which does not require the scrollbar", why do you then want a scrollbar?
-
You also say "in addition allow the user to change the height as he/she pleases (thus I need the scrollbar)" The normal way to resize a dialog is to make it resizable so the user drags the edges to desired size. Why would you want a scrollbar for this?
:confused:
-
wrote on 23 Jan 2019, 07:31 last edited by
Sorry... my dialog has 3 checkboxes, each controls the visibility of a frame.
Thus, when a check box is activated the dialog height changes.
Before I added the scrollbar the automatic resizing was perfect, but when all frames are shown the dialog becomes rather tall so I added a vertical scrollbar.
now the dialog height stays fixed.
I would like the same behavior as before, which is to resize to full length,
with the addition that if the user drags the bottom to change the height a scroll bar appears.
What is the proper way to do that? -
Did you set the widgetResizable property to true ?
1/5