Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-89822

Error with readonly alias property

    XMLWordPrintable

Details

    • Linux/X11

    Description

      Hello,

      here is a minimal example with which I get a segfault :

       

      // main.qml
      
      import QtQuick 2.14
      import QtQuick.Window 2.14
      
      Window {
          id: root
      
          readonly property alias initialWidth: root.privates.initialWidth
          readonly property alias initialHeight: root.privates.initialHeight
      
          readonly property QtObject privates: QtObject {
      
              property int initialWidth: 640
              property int initialHeight: 800
          }
      
          width: root.initialWidth
          height: root.initialHeight
      
          visible: true
          title: qsTr("Hello World")
      }
      

      In the main.qml, I'm just declaring two readonly alias properties in the purpose of exposing them outside outside of this component in a readonly manner. Yet I would like to allow the modifying of those properties inside this component via a private property, a non-existing concept in Qml but I try to mimic that with a property named "privates".

      If I'm modifying this code in one of this way, everything work :

      • Change "privates" from a property to a QtObject child of "root" with "privates" as id.
      • Change the readonly properties "initialWidth" and "initialHeight" types from alias to int.

      Is there something I'm doing wrong while using readonly aliases or is this an undefined bug/behavior ?

      Thanks in advance.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qtqmlteam Qt Qml Team User
            alaenix2 ad ad
            Votes:
            8 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes