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

Invalid alias target location unless I bind it

XMLWordPrintable

    • Linux/Wayland

      This fails with "Invalid alias target location: text":

          property alias monitorLabelText: monitorForm.monitorLabel.text
          header: MonitorForm {
              id: monitorForm
          }
      

      But adding this line makes it work:

          property alias monitorLabelText: monitorForm.monitorLabel.text
      
          header: MonitorForm {
              id: monitorForm
              monitorLabel.text: '' // added
          }
      

      And so does this (once I create the monitorLabelText alias in MonitorForm.qml):

          property alias monitorLabelText: monitorForm.monitorLabelText // <-
      
          header: MonitorForm {
              id: monitorForm
          }
      

      MWE:

      main.py
      from PySide6.QtGui import QGuiApplication
      from PySide6.QtQml import QQmlApplicationEngine
      
      app = QGuiApplication()
      engine = QQmlApplicationEngine()
      engine.load('test.qml')
      app.exec()
      
      test.qml
      import QtQuick.Controls
      
      ApplicationWindow {
          visible: true
          property alias monitorLabelText: monitorForm.monitorLabel.text
          MonitorForm {
              id: monitorForm
              monitorLabel.text: ''
          }
      }
      
      MonitorForm.qml
      import QtQuick.Controls
      import QtQuick.Layouts
      GridLayout {
          property alias monitorLabel: monitorLabel
          Label { id: monitorLabel }
      }
      

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

            qtqmlteam Qt Qml Team User
            glibg10b Waldo Lemmer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes