IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QQmlInfo Class

The QQmlInfo class allows logging of QML-related messages.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

QQmlInfo Class

  • Header: QQmlInfo

  • CMake:

    find_package(Qt6 REQUIRED COMPONENTS Qml)

    target_link_libraries(mytarget PRIVATE Qt6::Qml)

  • qmake: QT += qml

  • Inherits: QDebug

Detailed Description

QQmlInfo is an opaque handle for QML-related diagnostic messages. You can use the << operator to add content to the message. When the QQmlInfo object is destroyed, it prints the resulting message along with information on the context.

See Also

Related Non-Members

 

QQmlInfo qmlDebug(const QObject *object)

Prints debug messages that include the file and line number for the specified QML object.

When QML types produce logging messages, it improves traceability if they include the QML file and line number on which the particular instance was instantiated.

To include the file and line number, an object must be passed. If the file and line number is not available for that instance (either it was not instantiated by the QML engine or location information is disabled), "unknown location" will be used instead. For example,

 
Sélectionnez
qmlDebug(object) &lt;&lt; "Internal state: 42";

prints

 
Sélectionnez
QML MyCustomType (unknown location): Internal state: 42
See Also

See also qmlInfo, qmlWarning

QQmlInfo qmlInfo(const QObject *object)

Prints informational messages that include the file and line number for the specified QML object.

When QML types produce logging messages, it improves traceability if they include the QML file and line number on which the particular instance was instantiated.

To include the file and line number, an object must be passed. If the file and line number is not available for that instance (either it was not instantiated by the QML engine or location information is disabled), "unknown location" will be used instead.

For example,

 
Sélectionnez
qmlInfo(object) &lt;&lt; tr("component property is a write-once property");

prints

 
Sélectionnez
QML MyCustomType (unknown location): component property is a write-once property

In versions prior to Qt 5.9, qmlInfo reported messages using a warning QtMsgType. For Qt 5.9 and above, qmlInfo uses an info QtMsgType. To send warnings, use qmlWarning.

See Also

See also qmlDebug, qmlWarning

QQmlInfo qmlWarning(const QObject *object)

Prints warning messages that include the file and line number for the specified QML object.

When QML types produce logging messages, it improves traceability if they include the QML file and line number on which the particular instance was instantiated.

To include the file and line number, an object must be passed. If the file and line number is not available for that instance (either it was not instantiated by the QML engine or location information is disabled), "unknown location" will be used instead.

For example,

 
Sélectionnez
qmlInfo(object) &lt;&lt; tr("property cannot be set to 0");

prints

 
Sélectionnez
QML MyCustomType (unknown location): property cannot be set to 0
See Also

See also qmlDebug, qmlInfo

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+