このページについて

IDの重複

この警告カテゴリは、qmllint では「[syntax.duplicate-ids] 」と表記されます。

重複するIDが見つかりました

何が起きたのですか?

異なるID に同じ値を使用しました。

なぜ問題なのでしょうか?

QML 言語では ID の重複は許可されていません。同じ QML コンポーネント内では、すべての ID が一意である必要があります。

例

import QtQuick

Item {
    id: root
    Item {
        id: root
    }
}

この警告を解消するには、重複しているIDの名前を変更して一意にしてください:

import QtQuick

Item {
    id: root
    Item {
        id: notRoot
    }
}

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