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

Is it possible to make a scrolling interface without the ListView



  • Hi!
    I make the interface scroll vertically. Tried to use ListView, but ListView is buggy.
    Is it possible to make a scrolling interface without the ListView?





  • If I use ScrollView , the screen does not scroll

     {
            anchors.right: parent.right
            anchors.rightMargin: 0
            anchors.left: parent.left
            anchors.leftMargin: 0
            anchors.bottom: parent.bottom
            anchors.bottomMargin: 0
            anchors.top: parent.top
            anchors.topMargin: 0
    
    
    
    
        Rectangle {
            id: rectangle
            height: 19
            color: "#e3ded3"
            anchors.right: parent.right
            anchors.rightMargin: 0
            anchors.left: parent.left
            anchors.leftMargin: 0
            anchors.top: parent.top
            anchors.topMargin: 0
    
            Text {
                id: element1
                x: 78
                y: 4
                width: 214
                height: 14
                text: qsTr("8 (800) 700 0002 - отдел продаж")
                anchors.horizontalCenter: parent.horizontalCenter
                anchors.verticalCenter: parent.verticalCenter
                font.pixelSize: 12
            }
        }
    
        Rectangle {
            id: rectangle1
            height: mainElement.height * 0.15
            color: "#ffffff"
            anchors.top: rectangle.bottom
            anchors.topMargin: 0
            anchors.right: parent.right
            anchors.rightMargin: 0
            anchors.left: parent.left
            anchors.leftMargin: 0
    
            Image {
                id: imageLabel
                width: parent.width * 0.75
                anchors.left: parent.left
                anchors.leftMargin: 0
                anchors.bottom: parent.bottom
                anchors.bottomMargin: 0
                anchors.top: parent.top
                anchors.topMargin: 0
                fillMode: Image.PreserveAspectFit
                source: "qrc:/Images/Images/Xwd9C1BM5QA.jpg"
            }
    
            Button {
                id: buttonMenu
    //            x: 314
    //            y: 37
                anchors.left: imageLabel.right
                anchors.right: parent.right
                width: parent.height * 0.5
                height: parent.height * 0.8
                text: qsTr("")
                anchors.rightMargin: parent.height * 0.2
                anchors.leftMargin: parent.height * 0.2
                anchors.verticalCenter: parent.verticalCenter
                background: Rectangle{
                    color: "white"
                }
    
    
                /*contentItem: Text {
                                   text: page0Button0.text
                                   font: page0Button0.font
                                   opacity: enabled ? 1.0 : 0.3
                                   color: page0Button0.pressed ? "black" : "black"
                                   horizontalAlignment: Text.AlignHCenter
                                   verticalAlignment: Text.AlignVCenter
                                   elide: Text.ElideRight
                               }
    
                               background: Rectangle {
                                   implicitWidth: 90
                                   implicitHeight: 30
                                   opacity: enabled ? 1 : 0.3
                                   border.color:  "black"
                                   color:  "white"
                                   border.width: 1
                                   radius: 0
                               }*/
    
                Image {
                    id: image1
                    anchors.fill: parent
                    fillMode: Image.PreserveAspectFit
                    source: "qrc:/Images/Images/menuRed.png"
                }
            }
        }
    
        Rectangle {
            id: rectangle2
            x: 141
            y: 143
            width: 99
            height: 26
            color: "#db4c4c"
            radius: height * 0.3
    
            MouseArea {
                id: mouseAreaRassrochka
                anchors.bottomMargin: 0
                anchors.fill: parent
    
                Text {
                    id: element2
                    x: 82
                    y: parent.height * 0.05
                    //width: 5
                    height: 7
                    text: qsTr("Продаем")
                    font.weight: Font.ExtraBold
                    font.capitalization: Font.MixedCase
                    font.family: "Times New Roman"
                    elide: Text.ElideLeft
                    color: "white"
                    anchors.horizontalCenter: parent.horizontalCenter
                    font.pixelSize: parent.height * 0.4
                }
    
                Text {
                    id: element3
                    x: 87
                    y: parent.height * 0.45
                    text: qsTr("в рассрочку!")
                    font.weight: Font.ExtraBold
                    font.family: "Times New Roman"
                    font.capitalization: Font.MixedCase
                    color: "white"
                    anchors.horizontalCenterOffset: 0
                    anchors.horizontalCenter: parent.horizontalCenter
                    font.pixelSize: parent.height * 0.4
                }
            }
        }
    
        Rectangle{
            color: "red"
            width: 200
            height: 200
            y: 650
        }
    
    
    
    
    }
    //    }
    //ListElement{
    
    //}
    
    
    }
    


  • @Mikeeeeee hi
    you can use flickable also


  • Moderators

    when using flickable, like @LeLev suggested,
    don't forget to set a size to contentWidth and/or height or it won't scroll either


  • Lifetime Qt Champion

    @Mikeeeeee said in Is it possible to make a scrolling interface without the ListView:

    If I use ScrollView

    where do you use it?



  • I just put the ScrollView in the body and put the rest of the code in the ScrollView.
    Flickable help me.


Log in to reply