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. property alias causes crash in 5.9.1
Qt 6.11 is out! See what's new in the release blog

property alias causes crash in 5.9.1

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

    When calling createObject() on the component with property alias, crash happens.
    0_1505287892481_QQ图片20170913153102.png

    The code snipet is as follows.
    [main.qml]
    import QtQuick 2.7
    import QtQuick.Controls 2.0
    import QtQuick.Layouts 1.3

    ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    Item {
        id: root
        anchors.fill: parent
    
        Foo {
            id: foo
        }
    
        Timer {
            id: timer
    
            running: true
            repeat: true
            interval: 1000
    
            onTriggered: {
                foo.createObject(root, {"foo": 0.5, "foo2": 2, "foo3": true})
            }
        }
    }
    

    }

    [Foo.qml]
    Component {
    Item {
    property alias foo: bar.opacity
    property alias foo2: bar.scale
    property alias foo3: bar.visible

        id: foo
    
        x: 100
        y: 100
        width: 100
        height: 100
    
        Rectangle {
            id: bar
            anchors.fill: parent
            color: "green"
        }
    }
    

    }

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Surka
      wrote on last edited by
      #2

      Failed to attach screenshot.

      The assert dialog shows
      "properties.count == propertyIndexCache.count()" in file qml\qqmlpropertycache.cpp, line 1188.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        m.kuncevicius
        wrote on last edited by m.kuncevicius
        #3

        @Surka Hi. Property alias and the Item id has the same name foo - it can't be the same. I also don't think that Rectangle has property scale.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Surka
          wrote on last edited by
          #4

          @m-kuncevicius Yes, that's my typo. But it is irrelavant to the crash. The issue here is Qt reporting its internal assertion. btw, scale is property of Item.

          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