Hi,
I'm running into an issue integrating widgets, QSrollArea, and QSplitter in the main window. Using QTCreator I added a whole bunch of widgets. The widgets are placed as a grid. In other words I used the grid icon to automatically place the widgets in a nice orderly fashion. So far so good.
As part of that I decided to add a QScrollArea in the main window along with the other widgets. Also placed in the grid. In the QScrollArea I added a whole number of QCombo-boxes. The combo-boxes are placed in a grid in the scroll area. There are 10 rows of combo-boxes and each row contains 7 combo-boxes.
I also added a two buttons which hides and shows each row of combo-boxes to give the illusion that new rows are added or removed in the scroll area. As the user clicks the add or remove button, I simply set the visible flag to true or false for the combo-boxes for the row in question. That works fine. If I leave it as is when I run the application the first row of combo-boxes are displayed with no issue in the scroll area as I expected. As I click on the button to add a row (just makes the combo-boxes visible), eventually the scrollarea displays the vertical scroll so the user can navigate up and down the rows. The opposite is true when I remove rows. Also that is working as expected.
The problem is when I place a vertical splitter between the scroll area frame and a frame of widgets just beneath the scroll area frame. I want to do this so I can resize the scroll area in case users don't want to use the vertical scroll associated in the scroll area. As it turns out Qt allocates the full size of the scroll area as if all the combo-boxes are all showing instead of just providing enough space to show just one row of combo-boxes like it did before adding the splitter. So naturally there is no scroll since the scroll area is maximized. Also I can't resize using the splitter although the splitter icon is displayed. Just doesn't do anything.
Any idea how I can have the same behavior in the scroll area with the splitter the way it works without it?
Please see the attached project.
Click on the "Enabled Advance Filtering" button.
Now you will see a large scroll area. This should be much smaller.
Click on the "Add Row" button.
New rows are added to the scroll area but there is no scroll bar. If you go to the splitter right underneath the scroll area it does not move in any direction. I'd like the scroll area to have enough room for may be two rows and as I add rows, the scroll bar appears. The splitter should allow me to expand the scroll area to any size I need to display more or less rows. If I expand far enough the scroll bars should disappear. Standard for GUI apps.
If you remove the splitter, you will see that the scroll area works properly as I add rows but now no splitter to resize the scroll.
Thanks for your help.
Bookmarks