Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

ListView inside Column not scrolling



  • My aim is to create something like:

    1. Static text field
    2. Listview
    3. Static button

    I tried putting all this into Column/ColumnLayout, also anchors. But if I use smth else instead of anchors.fill : parent - ListView stops scrolling.

            ColumnLayout
            {
                anchors.fill: parent
                    TextField {
                            id: lab
                            width:parent.width
                            text: "some"
                        }
    
                  ListView {
                    id: lw
                    //anchors.fill: parent// scroll is working only if put here this - but that is incorect for me.
                    Layout.fillHeight: true;
                    model: comp
                    interactive : true;
                    delegate: contactDelegate
                    focus: true
                }
    
                Button {
                     id: but
                     text: "Add"
                     width: 40
                     height: 20
                     onClicked: {
                         comp.append({name: "Some long interesting text", number: comp.rowCount()});
                     }
             }
        }
    

    Also I tried using footers and headers - that was better, but they are overlapped with scrolling content (boundsBehavior: Flickable.StopAtBounds not working).

    Please give some advice on implementation, or smth.


Log in to reply