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

Fix documentation: initializing a property of aliased property won't actually cause an error

    XMLWordPrintable

Details

    • 284faaa6e (dev), 746ef8b80 (6.7), 969c62918 (6.6), 40b89e2e4 (tqtc/lts-6.5)

    Description

      in this documentation(https://doc.qt.io/qt-6/qtqml-syntax-objectattributes.html#considerations-for-property-aliases), there's a code snippet which supposed to cause an error. but the one pointed by a red arrow didn't.

       

      here's the code i used for the experiment.

       

      import QtQuick
      import QtQuick.Controls
      Window {
          id: relay
          width: 100; height: 100
          visible: true
          property alias widgetLabel: label    
          
          //will generate an error
          widgetLabel.text: "Initial text" //<-- won't generate an error    
          
          //will generate an error
          //    property alias widgetLabelText: widgetLabel.text //<-- does generate an error    
          Component.onCompleted: widgetLabel.text = "Alias completed Initialization"
          Label {
              id: label
          }
      }
       

       

       

       

      Attachments

        Issue Links

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

          Activity

            People

              ulherman Ulf Hermann
              mikio_hirai Mikio Hirai
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes