Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How forbid change of parameters?
Qt 6.11 is out! See what's new in the release blog

How forbid change of parameters?

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 1.9k Views 2 Watching
  • 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.
  • T Offline
    T Offline
    Trikrista
    wrote on last edited by Trikrista
    #1

    There is a list:

        ListModel {
            id: modelWidget
    
            ListElement {
                widget: "Widget0.qml"
                type: 0
            }
    
            ListElement {
                widget: "Widget2.qml"
                type: 1
            }
    
            ListElement {
                widget: "Widget2.qml"
                type: 2
            }
    
            ListElement {
                widget: "Widget3.qml"
                type: 3
            }
        }
    
        Component {
            id: delegateWidget
    
            Item {
                id: item
    
                //...
                visible: (!listWidget.isMove || (listWidget.firstMoveItem == type || listWidget.lastMoveItem == type)) ? true : false
    
                Component.onCompleted: {
                    var component = Qt.createComponent(model.widget);
                    var childRec = component.createObject(item);
                    childRec.anchors.fill = item
                }
            }
        }
    
        ListView {
            id: listWidget
    
            property bool isMove: false
            property int firstMoveItem
            property int lastMoveItem
            //...
            snapMode: ListView.SnapOneItem
            orientation: ListView.Horizontal
    
            delegate: delegateWidget
            model: modelWidget
        }
    
        NumberAnimation {
            id: animationList
            target: listWidget
            property: "contentX"
            duration: 500
            easing.type: Easing.InExpo
            easing.amplitude: 20.0; easing.period: 1.5
    
            onStarted: {
                listWidget.isMove = true
            }
    
            onStopped: {
                listWidget.isMove = false
            }
        }
    

    so is the start animation when moving:

            function changedCurrentWidget(num) {
                animationList.running = false
                var pos = listWidget.contentX;
                listWidget.firstMoveItem = listWidget.indexAt(pos, 0)
                listWidget.lastMoveItem = num
                var destPos;
                listWidget.positionViewAtIndex(num, ListView.End);
                destPos = listWidget.contentX;
                animationList.from = pos;
                animationList.to = destPos;
                animationList.running = true;
            }
    

    During the animation change the size of widgets. How to fix it?
    And animations are laggy on Android. How to fix it?

    I'm sorry for my bad English

    p3c0P 1 Reply Last reply
    0
    • T Trikrista

      There is a list:

          ListModel {
              id: modelWidget
      
              ListElement {
                  widget: "Widget0.qml"
                  type: 0
              }
      
              ListElement {
                  widget: "Widget2.qml"
                  type: 1
              }
      
              ListElement {
                  widget: "Widget2.qml"
                  type: 2
              }
      
              ListElement {
                  widget: "Widget3.qml"
                  type: 3
              }
          }
      
          Component {
              id: delegateWidget
      
              Item {
                  id: item
      
                  //...
                  visible: (!listWidget.isMove || (listWidget.firstMoveItem == type || listWidget.lastMoveItem == type)) ? true : false
      
                  Component.onCompleted: {
                      var component = Qt.createComponent(model.widget);
                      var childRec = component.createObject(item);
                      childRec.anchors.fill = item
                  }
              }
          }
      
          ListView {
              id: listWidget
      
              property bool isMove: false
              property int firstMoveItem
              property int lastMoveItem
              //...
              snapMode: ListView.SnapOneItem
              orientation: ListView.Horizontal
      
              delegate: delegateWidget
              model: modelWidget
          }
      
          NumberAnimation {
              id: animationList
              target: listWidget
              property: "contentX"
              duration: 500
              easing.type: Easing.InExpo
              easing.amplitude: 20.0; easing.period: 1.5
      
              onStarted: {
                  listWidget.isMove = true
              }
      
              onStopped: {
                  listWidget.isMove = false
              }
          }
      

      so is the start animation when moving:

              function changedCurrentWidget(num) {
                  animationList.running = false
                  var pos = listWidget.contentX;
                  listWidget.firstMoveItem = listWidget.indexAt(pos, 0)
                  listWidget.lastMoveItem = num
                  var destPos;
                  listWidget.positionViewAtIndex(num, ListView.End);
                  destPos = listWidget.contentX;
                  animationList.from = pos;
                  animationList.to = destPos;
                  animationList.running = true;
              }
      

      During the animation change the size of widgets. How to fix it?
      And animations are laggy on Android. How to fix it?

      p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      @Trikrista Can you explain a little bit more precise ?

      157

      T 1 Reply Last reply
      0
      • p3c0P p3c0

        @Trikrista Can you explain a little bit more precise ?

        T Offline
        T Offline
        Trikrista
        wrote on last edited by
        #3

        @p3c0 If I flip a list that onHeightChanged writes that the height = 0

        I'm sorry for my bad English

        p3c0P 1 Reply Last reply
        0
        • T Trikrista

          @p3c0 If I flip a list that onHeightChanged writes that the height = 0

          p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          @Trikrista Do you mean something like exclude ?

          157

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved