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

After deleting a list item in swipe view, swipe area doesn't change when using tabs



  • I have a list view inside swipe view. When I delete an item from the list view, clicking on the tab button doesn't move swipe area.

    After I mouse click on the swipe view area I can see the swipe area changing to the tab position. Can somebody please explain to me what's going on? Is this a bug or am I missing something ?

    Swipe area works if I drag. I can see both tab index and swipe index updating.

    import QtQuick 2.14
    import QtQuick.Controls 2.14
    import QtQuick.VirtualKeyboard 2.14
    
    ApplicationWindow {
        id: window
        visible: true
        width: 640
        height: 480
        title: qsTr("Tabs")
    
        SwipeView {
            id: swipeView
            anchors.fill: parent
            currentIndex: tabBar.currentIndex
    
            ListView {
                width: 200
                height: 200
                id: listView1
                Component.onCompleted: {
                    let modelContents = {
                        "name": "1"
                    }
                    model1.append(modelContents)
                    model1.append(modelContents)
                    model1.append(modelContents)
                }
    
                model: ListModel {
                    id: model1
                }
    
                delegate: Button {
                    text: name
                    onPressed: {
                        model1.remove(index)
                    }
                }
            }
    
            ListView {
                width: 200
                height: 200
                id: listView2
                Component.onCompleted: {
                    let modelContents = {
                        "name": "1"
                    }
                    model2.append(modelContents)
                    model2.append(modelContents)
                    model2.append(modelContents)
                }
    
                model: ListModel {
                    id: model2
                }
    
                delegate: Button {
                    text: name
                    onPressed: {
                        model2.remove(index)
                    }
                }
            }
        }
    
        footer: TabBar {
            id: tabBar
            currentIndex: swipeView.currentIndex
    
            TabButton {
                text: qsTr("Page 1")
            }
            TabButton {
                text: qsTr("Page 2")
            }
        }
    }
    

Log in to reply