Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
syntax.id-quotation.qdoc
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5\ingroup qmllint-warnings-and-errors
6
7\title Id quotation
8\brief [syntax.id-quotation] Id has quotation marks.
9
10\qmllintwarningcategory syntax.id-quotation
11
12\section1 Ids do not need quotation marks
13
14\section2 What happened?
15You surrounded an \l{qtqml-syntax-objectattributes.html#the-id-attribute}{id}
16with quotation marks.
17
18\section2 Why is this bad?
19This might lead to confusion between ids and strings.
20The QML language does not require quotation marks for ids and
21forbids more complex string expressions for ids.
22
23\section2 Example
24\qml
25import QtQuick
26
27Item {
28 id: "root"
29}
30
31\endqml
32To fix this warning, remove the quotation marks:
33\qml
34import QtQuick
35
36Item {
37 id: root
38}
39\endqml
40*/