Ungelöster Alias
Diese Warnkategorie wird von qmllint mit [unresolved-alias]
geschrieben.
Ungelöster Alias
Was ist passiert?
Ein Eigenschaftsalias sollte einen Verweis auf eine andere Eigenschaft enthalten, siehe auch QML Object Attributes - Property Aliases. In diesem Fall enthält er einen Verweis auf eine Eigenschaft, die nicht gefunden wurde.
Warum ist das schlecht?
Instanzen von Komponenten mit ungelöstem Alias werden zur Laufzeit nicht erzeugt: sie sind stattdessen null.
Beispiel
import QtQuick Item { id: someId property int helloWorld property alias helloWorldAlias: helloWorld // not ok: aliases have to refer by id property alias helloWorldAlias2: someId.helloWorlddd // not ok: no helloWorlddd in someId property alias helloWorldAlias3: someIddd.helloWorld // not ok: someIddd does not exist }
Um diese Warnung zu beheben, stellen Sie sicher, dass die id und die Eigenschaft der Alias-Eigenschaft auch wirklich existieren:
import QtQuick Item { id: someId property int helloWorld property alias helloWorldAlias: someId.helloWorld // ok: alias refers by id property alias helloWorldAlias2: someId.helloWorld // ok: helloWorld does exist in someId property alias helloWorldAlias3: someId.helloWorld // ok: someId does exist }
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.