本页

名称重复

此警告类别由 qmllint 拼写[duplicated-name]

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

发生了什么?

你给一个属性、信号或方法起了一个在当前 QML 组件中已在使用的名字。

为什么会这样?

QML Runtime 不会在运行时创建具有重复成员名称的组件:它们将被置为空。

示例

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.