Results 1 to 2 of 2

Thread: Can't Resize QScrollArea with a QSplitter

  1. #1
    Join Date
    Dec 2019
    Posts
    13
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Can't Resize QScrollArea with a QSplitter

    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.
    Attached Files Attached Files

  2. #2
    Join Date
    Dec 2019
    Posts
    13
    Thanks
    1
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Can't Resize QScrollArea with a QSplitter

    No one able to help?

Similar Threads

  1. Resize QWidget if QSplitter is collapsed
    By amban in forum Qt Programming
    Replies: 1
    Last Post: 4th February 2015, 07:49
  2. QSplitter resize behavior
    By Alundra in forum Qt Programming
    Replies: 0
    Last Post: 5th June 2014, 21:25
  3. questions about qscrollarea in qsplitter
    By mcarter in forum Qt Programming
    Replies: 0
    Last Post: 4th April 2014, 18:18
  4. QSplitter only resize from user input?
    By winston2020 in forum Qt Programming
    Replies: 1
    Last Post: 30th January 2009, 15:50

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.