本页内容

快速提示:附加属性类型

qmllint 将此警告类别拼写为“[Quick.attached-property-type] ”。

附加属性必须附加到继承自特定类型的对象上

发生了什么?

您在类型不正确的对象中实例化了一个附加属性。

这有什么问题?

该附加属性将无法正常工作。

示例

import QtQuick

Item {
    QtObject {
        LayoutMirroring.enabled: true
    }
}

要解决此警告,请将包含该属性的类型修改为继承警告消息中提到的类型:

import QtQuick

Item {
    Item {
        LayoutMirroring.enabled: true
    }
}

© 2026 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.