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
comma.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2025 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-comma.html
6
\ingroup qmllint-warnings-and-errors
7
8
\title Comma
9
\brief [comma] Do not use comma expressions.
10
11
\qmllintwarningcategory comma
12
13
\section1 Do not use comma expressions
14
15
\section2 What happened?
16
A JavaScript comma expression was used outside of a for loop.
17
18
\section2 Why is this bad?
19
Comma expressions reduce readability of the code and obscure side-effects.
20
21
\section2 Example
22
\qml
23
import QtQuick
24
25
Item {
26
Component.onCompleted: init(config, true), enableLogging(categories), run(1000) // millis
27
}
28
\endqml
29
To fix this warning, refactor the code to use distinct statements for each
30
operation. This way, each side effect is explicit instead of happening as part
31
of another unrelated operation:
32
\qml
33
import QtQuick
34
35
Item {
36
Component.onCompleted: {
37
init(config, true)
38
enableLogging(categories)
39
run(1000) // millis
40
}
41
}
42
\endqml
43
*/
qtdeclarative
src
qml
doc
src
qmllint
comma.qdoc
Generated on
for Qt by
1.14.0