How forbid change of parameters?



  • 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?


  • Moderators

    @Trikrista Can you explain a little bit more precise ?



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


  • Moderators

    @Trikrista Do you mean something like exclude ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.