本页内容

名称重复

qmllint 将此警告类别拼写为[duplicated-name] 。

属性、信号或方法名称重复

发生了什么?

您为某个属性、信号或方法指定的名称在当前 QML 组件中已被占用。

这有什么问题?

QML Runtime 不会在运行时创建具有重复成员名的组件:这些成员名将被设为 null。

示例

import QtQuick

Item {
    property int helloWorld
    property int helloWorld // duplicate property
    signal helloWorld() // duplicate signal
}

要解决此警告,请删除或重命名重复的成员:

import QtQuick

Item {
    property int helloWorld
    signal helloWorldSignal()
}

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