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. qt quick emulation layer crashed line 1
Forum Updated to NodeBB v4.3 + New Features

qt quick emulation layer crashed line 1

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 5.2k Views 1 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.
  • H Offline
    H Offline
    HeMinzhang
    wrote on last edited by
    #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)
            }
        }
    }
    
    
    1 Reply Last reply
    0
    • sierdzioS sierdzio

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

      H Offline
      H Offline
      HeMinzhang
      wrote on last edited by HeMinzhang
      #3

      @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.

      1 Reply Last reply
      1
      • sierdzioS Online
        sierdzioS Online
        sierdzio
        Moderators
        wrote on last edited by
        #2

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

        (Z(:^

        H 1 Reply Last reply
        3
        • sierdzioS sierdzio

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

          H Offline
          H Offline
          HeMinzhang
          wrote on last edited by HeMinzhang
          #3

          @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.

          1 Reply Last reply
          1

          • Login

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