En esta página

Cadenas multilínea

qmllint denomina esta categoría de advertencia « [multiline-strings] ».

La cadena contiene un terminador de línea sin escapar, lo cual está obsoleto

¿Qué ha pasado?

Una cadena se extiende a lo largo de varias líneas.

¿Por qué es un problema?

Las cadenas que abarcan varias líneas son una extensión no estándar de ECMAScript y están obsoletas en QML. Utiliza literales de plantilla en su lugar.

Ejemplo

import QtQuick

Item {
    property string multiLine: "first
second
third"

    property string multiLine2: 'first
second
third'
}

Para solucionar esta advertencia, utiliza literales de plantilla o, como alternativa, sustituye los saltos de línea por «\n »:

import QtQuick

Item {
    property string multiLine: `first
second
third`
    property string multiLine2: `first
second
third`

    property string alternative: "first\nsecond\nthird"
    property string alternative2: "first\n" +
"second\n" +
"third"
}

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