diff options
author | Robin Burchell <robin.burchell@crimson.no> | 2017-01-05 20:19:18 +0100 |
---|---|---|
committer | Robin Burchell <robin.burchell@crimson.no> | 2017-01-11 13:49:04 +0000 |
commit | 5a5f140e60a65ae9a976444c1e47e5a8c606ff21 (patch) | |
tree | 1f9c5674b61b1ba6d20357826bf0a39cac029050 /src/qml/qml/qqmlerror.cpp | |
parent | 971314dbb56c3761bb38abda8e257fd5f8502d00 (diff) |
QQmlInfo: Add qmlDebug & qmlWarning functions alongside qmlInfo
This way, we can correctly write to multiple levels of QDebug with QML context
information. A followup change will port all existing callers, and
subsequently change qmlInfo's message level to QtInfoMsg.
[ChangeLog][QtQml] Introduced qmlDebug & qmlWarning functions to qqmlinfo.h, in
addition to the pre-existing qmlInfo function. As a side effect, QQmlError has
also gained messageType() and setMessageType().
Change-Id: I04ced5952c5c3c58293a89a6767c7b545c03cc0a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlerror.cpp')
-rw-r--r-- | src/qml/qml/qqmlerror.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlerror.cpp b/src/qml/qml/qqmlerror.cpp index 0a6c7b4960..0cb82cdbd9 100644 --- a/src/qml/qml/qqmlerror.cpp +++ b/src/qml/qml/qqmlerror.cpp @@ -85,11 +85,12 @@ public: QString description; quint16 line; quint16 column; + QtMsgType messageType; QObject *object; }; QQmlErrorPrivate::QQmlErrorPrivate() -: line(0), column(0), object() +: line(0), column(0), messageType(QtMsgType::QtWarningMsg), object() { } @@ -125,6 +126,7 @@ QQmlError &QQmlError::operator=(const QQmlError &other) d->line = other.d->line; d->column = other.d->column; d->object = other.d->object; + d->messageType = other.d->messageType; } return *this; } @@ -239,6 +241,29 @@ void QQmlError::setObject(QObject *object) } /*! + \since 5.9 + + Returns the message type. + */ +QtMsgType QQmlError::messageType() const +{ + if (d) return d->messageType; + else return QtMsgType::QtWarningMsg; +} + +/*! + \since 5.9 + + Sets the \a messageType for this message. The message type determines which + QDebug handlers are responsible for recieving the message. + */ +void QQmlError::setMessageType(QtMsgType messageType) +{ + if (!d) d = new QQmlErrorPrivate; + d->messageType = messageType; +} + +/*! Returns the error as a human readable string. */ QString QQmlError::toString() const |