diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-19 04:08:20 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-04-19 04:08:20 (GMT) |
commit | 7aedb72dea904981969c0a4a9e5a6b721381c5a9 (patch) | |
tree | 820f58eace02ec8e0e001ba7faf28af23c58296e /src/declarative/util | |
parent | 118890afb8b0a56d702d0822891d6417665ab515 (diff) | |
download | Qt-7aedb72dea904981969c0a4a9e5a6b721381c5a9.zip Qt-7aedb72dea904981969c0a4a9e5a6b721381c5a9.tar.gz Qt-7aedb72dea904981969c0a4a9e5a6b721381c5a9.tar.bz2 |
Emit runtime warnings through QDeclarativeEngine
QTBUG-9726
Diffstat (limited to 'src/declarative/util')
6 files changed, 15 insertions, 15 deletions
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp index fd85d91..5f81b26 100644 --- a/src/declarative/util/qdeclarativeanimation.cpp +++ b/src/declarative/util/qdeclarativeanimation.cpp @@ -185,7 +185,7 @@ void QDeclarativeAbstractAnimation::setRunning(bool r) return; if (d->group || d->disableUserControl) { - qWarning("QDeclarativeAbstractAnimation: setRunning() cannot be used on non-root animation nodes"); + qmlInfo(this) << "setRunning() cannot be used on non-root animation nodes."; return; } @@ -245,7 +245,7 @@ void QDeclarativeAbstractAnimation::setPaused(bool p) return; if (d->group || d->disableUserControl) { - qWarning("QDeclarativeAbstractAnimation: setPaused() cannot be used on non-root animation nodes"); + qmlInfo(this) << "setPaused() cannot be used on non-root animation nodes."; return; } @@ -781,8 +781,8 @@ void QDeclarativeScriptActionPrivate::execute() if (ddata && ddata->outerContext && !ddata->outerContext->url.isEmpty()) expr.setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber); expr.value(); - if (expr.hasError()) - qWarning() << expr.error(); + if (expr.hasError()) + qmlInfo(q) << expr.error(); } } diff --git a/src/declarative/util/qdeclarativefontloader.cpp b/src/declarative/util/qdeclarativefontloader.cpp index 41740a8..4115193 100644 --- a/src/declarative/util/qdeclarativefontloader.cpp +++ b/src/declarative/util/qdeclarativefontloader.cpp @@ -53,6 +53,7 @@ #include <QFontDatabase> #include <private/qobject_p.h> +#include <qdeclarativeinfo.h> QT_BEGIN_NAMESPACE @@ -136,7 +137,7 @@ void QDeclarativeFontLoader::setSource(const QUrl &url) d->status = QDeclarativeFontLoader::Ready; } else { d->status = QDeclarativeFontLoader::Error; - qWarning() << "Cannot load font:" << url; + qmlInfo(this) << "Cannot load font: \"" << url.toString() << "\""; } emit statusChanged(); } else @@ -231,7 +232,7 @@ void QDeclarativeFontLoader::replyFinished() d->addFontToDatabase(ba); } else { d->status = Error; - qWarning() << "Cannot load font:" << d->reply->url(); + qmlInfo(this) << "Cannot load font: \"" << d->reply->url().toString() << "\""; emit statusChanged(); } d->reply->deleteLater(); @@ -250,7 +251,7 @@ void QDeclarativeFontLoaderPrivate::addFontToDatabase(const QByteArray &ba) status = QDeclarativeFontLoader::Ready; } else { status = QDeclarativeFontLoader::Error; - qWarning() << "Cannot load font:" << url; + qmlInfo(q) << "Cannot load font: \"" << url.toString() << "\""; } emit q->statusChanged(); } diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index 2616ccf..6e980d0 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -1187,10 +1187,9 @@ QScriptValue NestedListModel::get(int index) const if (!node) return 0; QDeclarativeEngine *eng = qmlEngine(m_listModel); - if (!eng) { - qWarning("Cannot call QDeclarativeListModel::get() without a QDeclarativeEngine"); + if (!eng) return 0; - } + return QDeclarativeEnginePrivate::qmlScriptObject(node->object(this), eng); } diff --git a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp index d91b107..534c923 100644 --- a/src/declarative/util/qdeclarativelistmodelworkeragent.cpp +++ b/src/declarative/util/qdeclarativelistmodelworkeragent.cpp @@ -202,10 +202,9 @@ bool QDeclarativeListModelWorkerAgent::event(QEvent *e) FlatListModel *orig = m_orig->m_flat; FlatListModel *copy = s->list->m_flat; - if (!orig || !copy) { - qWarning("QML ListModel worker: sync() failed"); + if (!orig || !copy) return QObject::event(e); - } + orig->m_roles = copy->m_roles; orig->m_strings = copy->m_strings; orig->m_values = copy->m_values; diff --git a/src/declarative/util/qdeclarativestategroup.cpp b/src/declarative/util/qdeclarativestategroup.cpp index ff78c60..81f4230 100644 --- a/src/declarative/util/qdeclarativestategroup.cpp +++ b/src/declarative/util/qdeclarativestategroup.cpp @@ -50,6 +50,7 @@ #include <QtCore/qdebug.h> #include <private/qobject_p.h> +#include <qdeclarativeinfo.h> QT_BEGIN_NAMESPACE @@ -381,7 +382,7 @@ void QDeclarativeStateGroupPrivate::setCurrentStateInternal(const QString &state } if (applyingState) { - qWarning() << "Can't apply a state change as part of a state definition."; + qmlInfo(q) << "Can't apply a state change as part of a state definition."; return; } diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp index 3854b10..eb6ac7b 100644 --- a/src/declarative/util/qdeclarativestateoperations.cpp +++ b/src/declarative/util/qdeclarativestateoperations.cpp @@ -577,7 +577,7 @@ void QDeclarativeStateChangeScript::execute() expr.setSourceLocation(ddata->outerContext->url.toString(), ddata->lineNumber); expr.value(); if (expr.hasError()) - qWarning() << expr.error(); + qmlInfo(this, expr.error()); } } |