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

No scrolling in scrollview



  • Hi,

    in my QML Window I use a ScrollView to display some boxes. If the window is smaller than the content of the ScrollView I can't scrolling.

    import QtQuick 2.12
    import QtQuick.Controls 2.12
    import GC 1.0
    import assets 1.0
    import components 1.0
    
    Item {
        property Cache selectedCache
    
        Rectangle {
            id: windowBox
            anchors.fill: parent
    
            Image {
                width: parent.width
                height: parent.height
                source: Style.imageBackground
            }
    
            ScrollView {
                id: scrollView
                anchors {
                    left: parent.left
                    right: parent.right
                    top: parent.top //headerBox.bottom
                    bottom: parent.bottom //commandBar.top
                    margins: Style.sizeScreenMargin
                }
                clip: true
    
                CacheBox {
                    id: cacheBox
                    cache: selectedCache
                    headerText: "Cache"
                    anchors.top: parent.top
                    anchors.topMargin: 15
                    anchors.left: parent.left
                    anchors.right: parent.right
                }
    
                TextBox_TinyMCE {
                    id: noteBox
                    textBoxContent: selectedCache.ui_note
                    headerText: "Notes"
                    anchors.top: cacheBox.bottom
                    anchors.topMargin: 15
                    anchors.left: parent.left
                    anchors.right: parent.right
                }
    
                AttributeBox {
                    id: attributeBox
                    cache: selectedCache
                    headerText: "Attribute"
                    anchors.top: noteBox.bottom
                    anchors.topMargin: 15
                    anchors.left: parent.left
                    anchors.right: parent.right
                }
            }
        }
    }
    
    

    I can't find any solution in google, so can you help me with my problem?
    Thank you for your help.
    BR
    martin



  • When multiple items added into ScrollView content size should be set manually. I'll recommend simply to put Column inside ScrollView with spacing set to 15 and put all elements into column without any anchors.



  • It works. Thank you


Log in to reply