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\page qmllint-warnings-and-errors-syntax.id-quotation.html
6\ingroup qmllint-warnings-and-errors
7
8\title Id quotation
9\brief [syntax.id-quotation] Id has quotation marks.
10
11\qmllintwarningcategory syntax.id-quotation
12
13\section1 Ids do not need quotation marks
14
15\section2 What happened?
16You surrounded an \l{qtqml-syntax-objectattributes.html#the-id-attribute}{id}
17with quotation marks.
18
19\section2 Why is this bad?
20This might lead to confusion between ids and strings.
21The QML language does not require quotation marks for ids and
22forbids more complex string expressions for ids.
23
24\section2 Example
25\qml
26import QtQuick
27
28Item {
29 id: "root"
30}
31
32\endqml
33To fix this warning, remove the quotation marks:
34\qml
35import QtQuick
36
37Item {
38 id: root
39}
40\endqml
41*/