[SOLVED] Is there anyway to create a scrollable version of Layouts?



  • Putting a column/row/grid in a Flickable is fine since you can bind the flickable's contentHeight to the height of its child, thus enabling it to scroll.

    However we're using ColumnLayout to create automatically resizable versions of our layouts for some mobile apps at the moment. The issue is now we are unable to place these layouts into a Flickable due to the fact that ColumnLayout will never report its height. Therefore the Flickable's contentHeight never gets updated and the Flickable is unable to scroll.

    This seems like a ridiculously major flaw in the design of the Layouts functionality. Either that or I'm just unable to see another way to place a Layout in a scrollable container. Has anyone had any success doing it?

    Cheers


  • Qt Champions 2016

    you're writing mobile apps, so my question:
    have you allready tried qt.labs.controls with Qt 5.6 ?
    there's a new concept to add ScrollBars
    https://doc-snapshots.qt.io/qt5-5.6/qml-qt-labs-controls-scrollbar.html
    perhaps it will work for you



  • @ekkescorner Thanks for the reply but unfortunately this doesn't help.
    A ScrollBar is just an extra feature for a Flickable. My issue I'm having is that I can't have a dynamically sized ColumnLayout with flicking capabilities. Seems like someone at Qt really missed the mark with this one!

    Like I said I can always piece a regular Column together with my Components, but it completely bypasses the ability to dynamically resize things based on external parameters (ie screen dimensions) without having to do the calculations and all that myself.



  • The issue is now we are unable to place these layouts into a Flickable due to the fact that ColumnLayout will never report its height.

    Laying out its children into a column and calculating the total height is the sole purpose of ColumnLayout.

    Therefore the Flickable's contentHeight never gets updated and the Flickable is unable to scroll.

    You forgot to post a snippet that shows the contentHeight binding. Do you specify height or vertical/fill anchors for the column?



  • use implicitHeight instead of height



  • Hi, I faced a similar problem and a fix (with example code) can be found in this forum entry nested-repeater-in-listview-with-scrollview.

    Maybe that is of any use. This discussion certainly help me with the fix.

    Many thanks everybody!



  • @vladstelmahovsky Thanks. This solves the issue! Shame on me for not reading the documentation more thoroughly.



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