Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Solved No scrolling in scrollview

    QML and Qt Quick
    2
    3
    114
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      msauer75 last edited by

      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

      1 Reply Last reply Reply Quote 0
      • IntruderExcluder
        IntruderExcluder last edited by IntruderExcluder

        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.

        1 Reply Last reply Reply Quote 0
        • M
          msauer75 last edited by

          It works. Thank you

          1 Reply Last reply Reply Quote 0
          • First post
            Last post