QScrollArea max-height



  • I’d like to set the max-height of a QScrollArea…

    <q-scroll-area style=“max-height: 400px;”>
    …a list of stuff…
    </q-scroll-area>

    …does not work. If “…a list of stuff…” is long the max-height of the scroll area would be 400px, if it’s only a few elements it would be less than 400px, sized to the content appropriately.

    Setting max-height for QInfiniteScroll components works as expected.

    Any ideas/workarounds would be appreciated.



  • Any hints on this?



  • Set the property on the inner element not on QScrollArea



  • @jeffatpf said in QScrollArea max-height:

    I’d like to set the max-height of a QScrollArea…

    <q-scroll-area style=“max-height: 400px;”>
    …a list of stuff…
    </q-scroll-area>

    …does not work. If “…a list of stuff…” is long the max-height of the scroll area would be 400px, if it’s only a few elements it would be less than 400px, sized to the content appropriately.

    Setting max-height for QInfiniteScroll components works as expected.

    Any ideas/workarounds would be appreciated.

    Did you ever find a solution to this.
    I have to set a height on the QScrollArea otherwise nothing is visible.

    I have an application with different contents height so I want the height of the scrollarea to be dynamic. I can’t find a way how to do this except to use a fixed height.



  • @gvorster you can calculate height, see css calc



  • Wrap the QScollArea in a div, that has the max-height
    QScrollArea uses “fit” css class


Log in to reply