Qt Forum

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

    Solved What properties does LiveView set to prevent sliding out of the boundary?

    QML and Qt Quick
    3
    6
    167
    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
      mirro last edited by mirro

      Test QT5.12.3. version

      Using boundsBehavior:ListView.DragAndOvershootBounds doesn't work

      aUjkAs.jpg

      import QtQuick.Window 2.2
      import QtQuick.Controls 2.2
      
      Window {
          visible: true
          width: 300
          height: 450
          title: qsTr("Hello World")
      
          ListView{
              id:listView
              anchors.fill: parent
              model: 10
              snapMode: ListView.SnapOneItem
              orientation:ListView.Horizontal
              clip:true
              boundsBehavior:ListView.DragAndOvershootBounds 
              delegate: Rectangle{
                    width: listView.width
                    height: listView.height
                    color: index%2 ? "red":"yellow"
                    Label{
                        anchors.centerIn: parent
                        font.pointSize: 100
                        text: index
                    }
              }
          }
      }
      
      GrecKo 1 Reply Last reply Reply Quote 0
      • GrecKo
        GrecKo Qt Champions 2018 @mirro last edited by

        Using boundsBehavior:ListView.DragAndOvershootBounds doesn't work

        Flickable.DragAndOvershootBounds (default) - the contents can be dragged beyond the boundary of the Flickable, and can overshoot the boundary when flicked.

        It does what the documentation says.
        I guess you need:

        Flickable.StopAtBounds - the contents can not be dragged beyond the boundary of the flickable, and flicks will not overshoot.

        M 1 Reply Last reply Reply Quote 1
        • M
          mirro @GrecKo last edited by mirro

          @GrecKo
          Not found DragAndOvershootBounds in the following address.
          How do I prevent LiveView from sliding out of the boundary?
          https://doc.qt.io/archives/qt-4.8/qml-listview.html

          jsulm 1 Reply Last reply Reply Quote 0
          • jsulm
            jsulm Lifetime Qt Champion @mirro last edited by jsulm

            @mirro said in What properties does LiveView set to prevent sliding out of the boundary?:

            https://doc.qt.io/archives/qt-4.8/qml-listview.html

            Do you use Qt4?!
            Above you wrote "Test QT5.12.3. version" - so why do you read Qt4 documentation?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            M 1 Reply Last reply Reply Quote 0
            • M
              mirro @jsulm last edited by

              @jsulm
              Not found DragAndOvershootBounds in the following address.
              https://doc.qt.io/archives/qt-5.13/qml-qtquick-listview.html

              How do I prevent LiveView from sliding out of the boundary?

              jsulm 1 Reply Last reply Reply Quote 0
              • jsulm
                jsulm Lifetime Qt Champion @mirro last edited by

                @mirro Didn't @GrecKo actually suggested to use Flickable.StopAtBounds?
                ListView is a Flickable...

                https://forum.qt.io/topic/113070/qt-code-of-conduct

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