Cannot scroll vertically after dynamically setting the size of a child of a QListWidget

  • Hi,

    I have a horizontal QListWidget that holds other vertical QListWidget as child elements. The heights of the children lists (the vertical ones) are set dynamically when the user appends to these lists. They are made so they don't scroll, their heights are the total size of all their children's heights, which are other widgets of no importance for this question. The way I do it is by making these children lists be of a class that sub-classes QListWidget, reimplementing the sizeHint() and minimumSizeHint() methods, which take care or the "resizing" of the list.

    The problem I am facing is the following: appending more children lists to the horizontal (parent) list makes the parent list scrollable horizontally, as is intended. However, when the user appends widgets to the children lists, these lists expand in height, but they do not make the parent list vertically scrollable, even thought they are in fact way "taller" than their containing, parent list.

    I hope this is clear enough, it's bit hard to describe.

    (Additionally, I noticed that if I resize the main window, which space is taken almost entirely by the parent list described above, the parent list does become vertically scrollable after reaching the size of the "minimum size" of the widgets which are children of the vertical lists, specified in the editor.)

    I get the sense that the list's "scrollability" isn't being refreshed propery. Is that right? Is there another way to force the parent list to be scrollable vertically after one of its child have been resized to a greater height?

    Thank you so much for your answers.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Not a direct answer but why not use a QScrollArea to contain your "list" of QListWidget ?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.