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

qt quick emulation layer crashed line 1



  • Qt Creator:4.6.1

    qml code:

    import QtQuick 2.2
    import QtQuick.Window 2.2
    import QtQuick.Controls 2.2
    
    Window {
        visible: true
        width: 800
        height: 600
        title: qsTr("宙斯万岁!")
    
        SwipeView {
            id: swipeView
            width: 700
            height: 600
            currentIndex: 0
            Item {
                id: scannerItem
                visible: swipeView.currentIndex == 0
                Button {
                    id: button2
                    x: 338
                    y: 203
                    text: qsTr("Start")
                }
    
                Button {
                    id: button3
                    x: 458
                    y: 203
                    text: qsTr("Next")
                }
    
                ComboBox {
                    id: comboBox
                    x: 395
                    y: 110
                    editable: true
                    model: ListModel {
                        id: model
                        ListElement {
                            text: "Byte"
                        }
                        ListElement {
                            text: "2 Bytes"
                        }
                        ListElement {
                            text: "4 Bytes"
                        }
                        ListElement {
                            text: "8 Bytes"
                        }
                    }
                }
            }
            Item {
                id: mainItem
                visible: swipeView.currentIndex == 1
                Label {
                    id: label
                    x: 81
                    y: 54
                    width: 170
                    height: 50
                    color: "#da0aa0"
                    text: qsTr("China")
                    font.pointSize: 20
                }
            }
        }
        Button {
            id: button
            x: 0
            y: 0
            text: qsTr("Index")
            onClicked: {
                swipeView.setCurrentIndex(1)
            }
        }
    
        Button {
            id: button1
            x: 0
            y: 41
            text: qsTr("Button1")
            onClicked: {
                swipeView.setCurrentIndex(0)
            }
        }
    }
    
    


  • @sierdzio
    Thanks a million.
    But not the cause of this error,
    Because SwipeView child control "Item" didn't specify width and height properties or otherwise by such as anchors.fill: parent.
    Otherwise ad I found child control Item volume(width and height) must not greater than parent control volume.
    Hope I can help others.


  • Moderators

    Your swipe view has only a single page, so setting current index to 1 will crash it.



  • @sierdzio
    Thanks a million.
    But not the cause of this error,
    Because SwipeView child control "Item" didn't specify width and height properties or otherwise by such as anchors.fill: parent.
    Otherwise ad I found child control Item volume(width and height) must not greater than parent control volume.
    Hope I can help others.


Log in to reply