diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-10 09:18:47 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-11-10 09:18:47 (GMT) |
commit | afac65bed729aa17b726521fd564f76c849ccab5 (patch) | |
tree | e102f7fa66e4f349fd82c8afdbf61b44c70761e0 /src/declarative/qml | |
parent | 0a276390bb1c7e27bdaebb6d4eb22ab992c88aad (diff) | |
parent | 7b42a443384c884ce12a9499a95455a188dcb02d (diff) | |
download | Qt-afac65bed729aa17b726521fd564f76c849ccab5.zip Qt-afac65bed729aa17b726521fd564f76c849ccab5.tar.gz Qt-afac65bed729aa17b726521fd564f76c849ccab5.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/qml')
-rw-r--r-- | src/declarative/qml/qmlbinding.cpp | 2 | ||||
-rw-r--r-- | src/declarative/qml/qmlinfo.cpp | 15 | ||||
-rw-r--r-- | src/declarative/qml/qmlinfo.h | 35 |
3 files changed, 46 insertions, 6 deletions
diff --git a/src/declarative/qml/qmlbinding.cpp b/src/declarative/qml/qmlbinding.cpp index 5f7330f..b0a4d6e 100644 --- a/src/declarative/qml/qmlbinding.cpp +++ b/src/declarative/qml/qmlbinding.cpp @@ -205,7 +205,7 @@ void QmlBinding::update(QmlMetaProperty::WriteFlags flags) data->updating = false; } else { - qmlInfo(tr("Binding loop detected for property \"%1\"").arg(data->property.name()), data->property.object()); + qmlInfo(data->property.object()) << tr("Binding loop detected for property \"%1\"").arg(data->property.name()); } data->release(); diff --git a/src/declarative/qml/qmlinfo.cpp b/src/declarative/qml/qmlinfo.cpp index 5ebcd8d..9a19b80 100644 --- a/src/declarative/qml/qmlinfo.cpp +++ b/src/declarative/qml/qmlinfo.cpp @@ -63,7 +63,7 @@ QT_BEGIN_NAMESPACE For example, \code - qmlInfo(tr("component property is a write-once property"), object); + qmlInfo(object) << tr("component property is a write-once property"); \endcode prints @@ -73,7 +73,8 @@ QT_BEGIN_NAMESPACE \endcode */ -void qmlInfo(const QString& msg, const QObject* object) +QmlInfo::QmlInfo(const QObject *object) +: QDebug(QtWarningMsg) { QString pos = QLatin1String("QML"); if (object) { @@ -95,8 +96,14 @@ void qmlInfo(const QString& msg, const QObject* object) } else { pos += qApp->translate("QmlInfo","unknown location"); } - pos += QLatin1String(") "); - qWarning((pos + msg).toLocal8Bit()); // XXX allow other processing? + pos += QLatin1String(")"); + *this << pos; + nospace(); } +QmlInfo::~QmlInfo() +{ +} + + QT_END_NAMESPACE diff --git a/src/declarative/qml/qmlinfo.h b/src/declarative/qml/qmlinfo.h index 1660aa2..fd56118 100644 --- a/src/declarative/qml/qmlinfo.h +++ b/src/declarative/qml/qmlinfo.h @@ -50,7 +50,40 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -Q_DECLARATIVE_EXPORT void qmlInfo(const QString& msg, const QObject *me=0); +class Q_DECLARATIVE_EXPORT QmlInfo : public QDebug +{ +public: + QmlInfo(const QObject *); + ~QmlInfo(); + + inline QmlInfo &operator<<(QChar t) { QDebug::operator<<(t); return *this; } + inline QmlInfo &operator<<(QBool t) { QDebug::operator<<(t); return *this; } + inline QmlInfo &operator<<(bool t) { QDebug::operator<<(t); return *this; } + inline QmlInfo &operator<<(char t) { QDebug::operator<<(t); return *this; } + inline QmlInfo &operator<<(signed short t) { QDebug::operator<<(t); return *this; } + inline QmlInfo &operator<<(unsigned short t) { QDebug::operator<<(t); return *this; } + inline QmlInfo &operator<<(signed int t) { QDebug::operator<<(t); return *this; } + inline QmlInfo &operator<<(unsigned int t) { QDebug::operator<<(t); return *this; } + inline QmlInfo &operator<<(signed long t) { QDebug::operator<<(t); return *this; } + inline QmlInfo &operator<<(unsigned long t) { QDebug::operator<<(t); return *this; } + inline QmlInfo &operator<<(qint64 t) { QDebug::operator<<(t); return *this; } + inline QmlInfo &operator<<(quint64 t) { QDebug::operator<<(t); return *this; } + inline QmlInfo &operator<<(float t) { QDebug::operator<<(t); return *this; } + inline QmlInfo &operator<<(double t) { QDebug::operator<<(t); return *this; } + inline QmlInfo &operator<<(const char* t) { QDebug::operator<<(t); return *this; } + inline QmlInfo &operator<<(const QString & t) { QDebug::operator<<(t.toLocal8Bit().constData()); return *this; } + inline QmlInfo &operator<<(const QStringRef & t) { return operator<<(t.toString()); } + inline QmlInfo &operator<<(const QLatin1String &t) { QDebug::operator<<(t.latin1()); return *this; } + inline QmlInfo &operator<<(const QByteArray & t) { QDebug::operator<<(t); return *this; } + inline QmlInfo &operator<<(const void * t) { QDebug::operator<<(t); return *this; } + inline QmlInfo &operator<<(QTextStreamFunction f) { QDebug::operator<<(f); return *this; } + inline QmlInfo &operator<<(QTextStreamManipulator m) { QDebug::operator<<(m); return *this; } +}; + +Q_DECLARATIVE_EXPORT inline QmlInfo qmlInfo(const QObject *me) +{ + return QmlInfo(me); +} QT_END_NAMESPACE |