diff options
-rw-r--r-- | src/declarative/extra/qmlbehavior.cpp | 2 | ||||
-rw-r--r-- | src/declarative/extra/qmlxmllistmodel.cpp | 4 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsanchors.cpp | 34 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsflipable.cpp | 4 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicstextinput.cpp | 6 | ||||
-rw-r--r-- | src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp | 2 | ||||
-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 | ||||
-rw-r--r-- | src/declarative/util/qmlanimation.cpp | 8 | ||||
-rw-r--r-- | src/declarative/util/qmllistmodel.cpp | 14 | ||||
-rw-r--r-- | src/declarative/util/qmlpropertychanges.cpp | 4 | ||||
-rw-r--r-- | src/declarative/util/qmlstateoperations.cpp | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qmlinfo/tst_qmlinfo.cpp | 16 |
14 files changed, 97 insertions, 57 deletions
diff --git a/src/declarative/extra/qmlbehavior.cpp b/src/declarative/extra/qmlbehavior.cpp index e5d3d35..8364d8c 100644 --- a/src/declarative/extra/qmlbehavior.cpp +++ b/src/declarative/extra/qmlbehavior.cpp @@ -109,7 +109,7 @@ void QmlBehavior::setAnimation(QmlAbstractAnimation *animation) { Q_D(QmlBehavior); if (d->animation) { - qmlInfo(tr("Can't change the animation assigned to a Behavior."),this); + qmlInfo(this) << tr("Can't change the animation assigned to a Behavior."); return; } diff --git a/src/declarative/extra/qmlxmllistmodel.cpp b/src/declarative/extra/qmlxmllistmodel.cpp index 4243c45..4f213a8 100644 --- a/src/declarative/extra/qmlxmllistmodel.cpp +++ b/src/declarative/extra/qmlxmllistmodel.cpp @@ -109,7 +109,7 @@ public: void setQuery(const QString &query) { if (query.startsWith(QLatin1Char('/'))) { - qmlInfo(tr("An XmlRole query must not start with '/'"),this); + qmlInfo(this) << tr("An XmlRole query must not start with '/'"); return; } m_query = query; @@ -550,7 +550,7 @@ void QmlXmlListModel::setQuery(const QString &query) { Q_D(QmlXmlListModel); if (!query.startsWith(QLatin1Char('/'))) { - qmlInfo(tr("An XmlListModel query must start with '/' or \"//\""),this); + qmlInfo(this) << tr("An XmlListModel query must start with '/' or \"//\""); return; } diff --git a/src/declarative/graphicsitems/qmlgraphicsanchors.cpp b/src/declarative/graphicsitems/qmlgraphicsanchors.cpp index f6dc5fd..655e03d 100644 --- a/src/declarative/graphicsitems/qmlgraphicsanchors.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsanchors.cpp @@ -166,7 +166,7 @@ void QmlGraphicsAnchorsPrivate::fillChanged() --updatingFill; } else { // ### Make this certain :) - qmlInfo(QmlGraphicsAnchors::tr("Possible anchor loop detected on fill."), item); + qmlInfo(item) << QmlGraphicsAnchors::tr("Possible anchor loop detected on fill."); } } @@ -194,7 +194,7 @@ void QmlGraphicsAnchorsPrivate::centerInChanged() --updatingCenterIn; } else { // ### Make this certain :) - qmlInfo(QmlGraphicsAnchors::tr("Possible anchor loop detected on centerIn."), item); + qmlInfo(item) << QmlGraphicsAnchors::tr("Possible anchor loop detected on centerIn."); } } @@ -355,7 +355,7 @@ void QmlGraphicsAnchors::setFill(QmlGraphicsItem *f) return; } if (f != d->item->parentItem() && f->parentItem() != d->item->parentItem()){ - qmlInfo(tr("Can't anchor to an item that isn't a parent or sibling."), d->item); + qmlInfo(d->item) << tr("Can't anchor to an item that isn't a parent or sibling."); return; } d->remDepend(d->fill); @@ -380,7 +380,7 @@ void QmlGraphicsAnchors::setCenterIn(QmlGraphicsItem* c) return; } if (c != d->item->parentItem() && c->parentItem() != d->item->parentItem()){ - qmlInfo(tr("Can't anchor to an item that isn't a parent or sibling."), d->item); + qmlInfo(d->item) << tr("Can't anchor to an item that isn't a parent or sibling."); return; } @@ -481,7 +481,7 @@ void QmlGraphicsAnchorsPrivate::updateVerticalAnchors() --updatingVerticalAnchor; } else { // ### Make this certain :) - qmlInfo(QmlGraphicsAnchors::tr("Possible anchor loop detected on vertical anchor."), item); + qmlInfo(item) << QmlGraphicsAnchors::tr("Possible anchor loop detected on vertical anchor."); } } @@ -540,7 +540,7 @@ void QmlGraphicsAnchorsPrivate::updateHorizontalAnchors() --updatingHorizontalAnchor; } else { // ### Make this certain :) - qmlInfo(QmlGraphicsAnchors::tr("Possible anchor loop detected on horizontal anchor."), item); + qmlInfo(item) << QmlGraphicsAnchors::tr("Possible anchor loop detected on horizontal anchor."); } } @@ -912,7 +912,7 @@ bool QmlGraphicsAnchorsPrivate::checkHValid() const if (usedAnchors & QmlGraphicsAnchors::HasLeftAnchor && usedAnchors & QmlGraphicsAnchors::HasRightAnchor && usedAnchors & QmlGraphicsAnchors::HasHCenterAnchor) { - qmlInfo(QmlGraphicsAnchors::tr("Can't specify left, right, and hcenter anchors."), item); + qmlInfo(item) << QmlGraphicsAnchors::tr("Can't specify left, right, and hcenter anchors."); return false; } @@ -922,16 +922,16 @@ bool QmlGraphicsAnchorsPrivate::checkHValid() const bool QmlGraphicsAnchorsPrivate::checkHAnchorValid(QmlGraphicsAnchorLine anchor) const { if (!anchor.item) { - qmlInfo(QmlGraphicsAnchors::tr("Can't anchor to a null item."), item); + qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor to a null item."); return false; } else if (anchor.anchorLine & QmlGraphicsAnchorLine::Vertical_Mask) { - qmlInfo(QmlGraphicsAnchors::tr("Can't anchor a horizontal edge to a vertical edge."), item); + qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor a horizontal edge to a vertical edge."); return false; } else if (anchor.item != item->parentItem() && anchor.item->parentItem() != item->parentItem()){ - qmlInfo(QmlGraphicsAnchors::tr("Can't anchor to an item that isn't a parent or sibling."), item); + qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor to an item that isn't a parent or sibling."); return false; } else if (anchor.item == item) { - qmlInfo(QmlGraphicsAnchors::tr("Can't anchor item to self."), item); + qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor item to self."); return false; } @@ -943,13 +943,13 @@ bool QmlGraphicsAnchorsPrivate::checkVValid() const if (usedAnchors & QmlGraphicsAnchors::HasTopAnchor && usedAnchors & QmlGraphicsAnchors::HasBottomAnchor && usedAnchors & QmlGraphicsAnchors::HasVCenterAnchor) { - qmlInfo(QmlGraphicsAnchors::tr("Can't specify top, bottom, and vcenter anchors."), item); + qmlInfo(item) << QmlGraphicsAnchors::tr("Can't specify top, bottom, and vcenter anchors."); return false; } else if (usedAnchors & QmlGraphicsAnchors::HasBaselineAnchor && (usedAnchors & QmlGraphicsAnchors::HasTopAnchor || usedAnchors & QmlGraphicsAnchors::HasBottomAnchor || usedAnchors & QmlGraphicsAnchors::HasVCenterAnchor)) { - qmlInfo(QmlGraphicsAnchors::tr("Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors."), item); + qmlInfo(item) << QmlGraphicsAnchors::tr("Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors."); return false; } @@ -959,16 +959,16 @@ bool QmlGraphicsAnchorsPrivate::checkVValid() const bool QmlGraphicsAnchorsPrivate::checkVAnchorValid(QmlGraphicsAnchorLine anchor) const { if (!anchor.item) { - qmlInfo(QmlGraphicsAnchors::tr("Can't anchor to a null item."), item); + qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor to a null item."); return false; } else if (anchor.anchorLine & QmlGraphicsAnchorLine::Horizontal_Mask) { - qmlInfo(QmlGraphicsAnchors::tr("Can't anchor a vertical edge to a horizontal edge."), item); + qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor a vertical edge to a horizontal edge."); return false; } else if (anchor.item != item->parentItem() && anchor.item->parentItem() != item->parentItem()){ - qmlInfo(QmlGraphicsAnchors::tr("Can't anchor to an item that isn't a parent or sibling."), item); + qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor to an item that isn't a parent or sibling."); return false; } else if (anchor.item == item){ - qmlInfo(QmlGraphicsAnchors::tr("Can't anchor item to self."), item); + qmlInfo(item) << QmlGraphicsAnchors::tr("Can't anchor item to self."); return false; } diff --git a/src/declarative/graphicsitems/qmlgraphicsflipable.cpp b/src/declarative/graphicsitems/qmlgraphicsflipable.cpp index 862f414..c61f996 100644 --- a/src/declarative/graphicsitems/qmlgraphicsflipable.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsflipable.cpp @@ -133,7 +133,7 @@ void QmlGraphicsFlipable::setFront(QmlGraphicsItem *front) { Q_D(QmlGraphicsFlipable); if (d->front) { - qmlInfo(tr("front is a write-once property"),this); + qmlInfo(this) << tr("front is a write-once property"); return; } d->front = front; @@ -152,7 +152,7 @@ void QmlGraphicsFlipable::setBack(QmlGraphicsItem *back) { Q_D(QmlGraphicsFlipable); if (d->back) { - qmlInfo(tr("back is a write-once property"),this); + qmlInfo(this) << tr("back is a write-once property"); return; } d->back = back; diff --git a/src/declarative/graphicsitems/qmlgraphicstextinput.cpp b/src/declarative/graphicsitems/qmlgraphicstextinput.cpp index d7612aa..56f59d8 100644 --- a/src/declarative/graphicsitems/qmlgraphicstextinput.cpp +++ b/src/declarative/graphicsitems/qmlgraphicstextinput.cpp @@ -531,7 +531,7 @@ void QmlGraphicsTextInputPrivate::startCreatingCursor() q->connect(cursorComponent, SIGNAL(statusChanged(int)), q, SLOT(createCursor())); }else{//isError - qmlInfo(QmlGraphicsTextInput::tr("Could not load cursor delegate"), q); + qmlInfo(q) << QmlGraphicsTextInput::tr("Could not load cursor delegate"); qWarning() << cursorComponent->errors(); } } @@ -540,7 +540,7 @@ void QmlGraphicsTextInput::createCursor() { Q_D(QmlGraphicsTextInput); if(d->cursorComponent->isError()){ - qmlInfo(tr("Could not load cursor delegate"),this); + qmlInfo(this) << tr("Could not load cursor delegate"); qWarning() << d->cursorComponent->errors(); return; } @@ -552,7 +552,7 @@ void QmlGraphicsTextInput::createCursor() delete d->cursorItem; d->cursorItem = qobject_cast<QmlGraphicsItem*>(d->cursorComponent->create()); if(!d->cursorItem){ - qmlInfo(tr("Could not instantiate cursor delegate"),this); + qmlInfo(this) << tr("Could not instantiate cursor delegate"); //The failed instantiation should print its own error messages return; } diff --git a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp index 9964de9..cf5fc5e 100644 --- a/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsvisualitemmodel.cpp @@ -813,7 +813,7 @@ QmlGraphicsItem *QmlGraphicsVisualDataModel::item(int index, const QByteArray &v } if (!item) { d->m_cache.releaseItem(nobj); - qmlInfo(QmlGraphicsVisualDataModel::tr("Delegate component must be Item type."), d->m_delegate); + qmlInfo(d->m_delegate) << QmlGraphicsVisualDataModel::tr("Delegate component must be Item type."); } return item; 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 diff --git a/src/declarative/util/qmlanimation.cpp b/src/declarative/util/qmlanimation.cpp index 435ddae..62d1937 100644 --- a/src/declarative/util/qmlanimation.cpp +++ b/src/declarative/util/qmlanimation.cpp @@ -225,10 +225,10 @@ QmlMetaProperty QmlAbstractAnimationPrivate::createProperty(QObject *obj, const Q_Q(QmlAbstractAnimation); QmlMetaProperty prop = QmlMetaProperty::createProperty(obj, str); if (!prop.isValid()) { - qmlInfo(QmlAbstractAnimation::tr("Cannot animate non-existant property \"%1\"").arg(str), q); + qmlInfo(q) << QmlAbstractAnimation::tr("Cannot animate non-existant property \"%1\"").arg(str); return QmlMetaProperty(); } else if (!prop.isWritable()) { - qmlInfo(QmlAbstractAnimation::tr("Cannot animate read-only property \"%1\"").arg(str), q); + qmlInfo(q) << QmlAbstractAnimation::tr("Cannot animate read-only property \"%1\"").arg(str); return QmlMetaProperty(); } return prop; @@ -1021,7 +1021,7 @@ void QmlPropertyAction::transition(QmlStateActions &actions, bool hasTarget = !d->propertyName.isEmpty() || d->target; if (hasSelectors && hasTarget) { - qmlInfo(tr("matchTargets/matchProperties/exclude and target/property are mutually exclusive."), this); + qmlInfo(this) << tr("matchTargets/matchProperties/exclude and target/property are mutually exclusive."); return; } @@ -2017,7 +2017,7 @@ void QmlPropertyAnimation::transition(QmlStateActions &actions, bool hasTarget = !d->propertyName.isEmpty() || d->target; if (hasSelectors && hasTarget) { - qmlInfo(tr("matchTargets/matchProperties/exclude and target/property are mutually exclusive."), this); + qmlInfo(this) << tr("matchTargets/matchProperties/exclude and target/property are mutually exclusive."); return; } diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp index 748dca6..19282eb 100644 --- a/src/declarative/util/qmllistmodel.cpp +++ b/src/declarative/util/qmllistmodel.cpp @@ -454,7 +454,7 @@ void QmlListModel::clear() void QmlListModel::remove(int index) { if (!_root || index < 0 || index >= _root->values.count()) { - qmlInfo(tr("remove: index %1 out of range").arg(index),this); + qmlInfo(this) << tr("remove: index %1 out of range").arg(index); return; } @@ -489,7 +489,7 @@ void QmlListModel::insert(int index, const QScriptValue& valuemap) if (index == _root->values.count()) append(valuemap); else - qmlInfo(tr("insert: index %1 out of range").arg(index),this); + qmlInfo(this) << tr("insert: index %1 out of range").arg(index); return; } ModelNode *mn = new ModelNode; @@ -518,7 +518,7 @@ void QmlListModel::move(int from, int to, int n) if (n==0 || from==to) return; if (from+n > count() || to+n > count() || from < 0 || to < 0) - qmlInfo(tr("move: out of range"),this); + qmlInfo(this) << tr("move: out of range"); int origfrom=from; // preserve actual move, so any animations are correct int origto=to; int orign=n; @@ -565,7 +565,7 @@ void QmlListModel::move(int from, int to, int n) void QmlListModel::append(const QScriptValue& valuemap) { if (!valuemap.isObject()) { - qmlInfo(tr("append: value is not an object"),this); + qmlInfo(this) << tr("append: value is not an object"); return; } if (!_root) @@ -604,7 +604,7 @@ void QmlListModel::append(const QScriptValue& valuemap) QScriptValue QmlListModel::get(int index) const { if (index >= count()) { - qmlInfo(tr("get: index %1 out of range").arg(index),this); + qmlInfo(this) << tr("get: index %1 out of range").arg(index); return 0; } @@ -639,7 +639,7 @@ void QmlListModel::set(int index, const QScriptValue& valuemap) if (!_root) _root = new ModelNode; if ( index > _root->values.count()) { - qmlInfo(tr("set: index %1 out of range").arg(index),this); + qmlInfo(this) << tr("set: index %1 out of range").arg(index); return; } if (index == _root->values.count()) @@ -680,7 +680,7 @@ void QmlListModel::set(int index, const QString& property, const QVariant& value if (!_root) _root = new ModelNode; if ( index >= _root->values.count()) { - qmlInfo(tr("set: index %1 out of range").arg(index),this); + qmlInfo(this) << tr("set: index %1 out of range").arg(index); return; } ModelNode *node = qvariant_cast<ModelNode *>(_root->values.at(index)); diff --git a/src/declarative/util/qmlpropertychanges.cpp b/src/declarative/util/qmlpropertychanges.cpp index 3aa3678..75c9f80 100644 --- a/src/declarative/util/qmlpropertychanges.cpp +++ b/src/declarative/util/qmlpropertychanges.cpp @@ -305,10 +305,10 @@ QmlPropertyChangesPrivate::property(const QByteArray &property) Q_Q(QmlPropertyChanges); QmlMetaProperty prop = QmlMetaProperty::createProperty(object, QString::fromUtf8(property)); if (!prop.isValid()) { - qmlInfo(QmlPropertyChanges::tr("Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(property)), q); + qmlInfo(q) << QmlPropertyChanges::tr("Cannot assign to non-existant property \"%1\"").arg(QString::fromUtf8(property)); return QmlMetaProperty(); } else if (!(prop.type() & QmlMetaProperty::SignalProperty) && !prop.isWritable()) { - qmlInfo(QmlPropertyChanges::tr("Cannot assign to read-only property \"%1\"").arg(QString::fromUtf8(property)), q); + qmlInfo(q) << QmlPropertyChanges::tr("Cannot assign to read-only property \"%1\"").arg(QString::fromUtf8(property)); return QmlMetaProperty(); } return prop; diff --git a/src/declarative/util/qmlstateoperations.cpp b/src/declarative/util/qmlstateoperations.cpp index 2fca002..03337cb 100644 --- a/src/declarative/util/qmlstateoperations.cpp +++ b/src/declarative/util/qmlstateoperations.cpp @@ -75,7 +75,7 @@ void QmlParentChangePrivate::doChange(QmlGraphicsItem *targetParent, QmlGraphics bool ok; const QTransform &transform = target->itemTransform(targetParent, &ok); if (transform.type() >= QTransform::TxShear || !ok) { - qmlInfo(QObject::tr("Unable to preserve appearance under complex transform"), q); + qmlInfo(q) << QObject::tr("Unable to preserve appearance under complex transform"); } qreal scale = 1; @@ -84,21 +84,21 @@ void QmlParentChangePrivate::doChange(QmlGraphicsItem *targetParent, QmlGraphics if (transform.m11() == transform.m22()) scale = transform.m11(); else { - qmlInfo(QObject::tr("Unable to preserve appearance under non-uniform scale"), q); + qmlInfo(q) << QObject::tr("Unable to preserve appearance under non-uniform scale"); ok = false; } } else if (transform.type() == QTransform::TxRotate) { if (transform.m11() == transform.m22()) scale = qSqrt(transform.m11()*transform.m11() + transform.m12()*transform.m12()); else { - qmlInfo(QObject::tr("Unable to preserve appearance under non-uniform scale"), q); + qmlInfo(q) << QObject::tr("Unable to preserve appearance under non-uniform scale"); ok = false; } if (scale != 0) rotation = atan2(transform.m12()/scale, transform.m11()/scale) * 180/M_PI; else { - qmlInfo(QObject::tr("Unable to preserve appearance under scale of 0"), q); + qmlInfo(q) << QObject::tr("Unable to preserve appearance under scale of 0"); ok = false; } } diff --git a/tests/auto/declarative/qmlinfo/tst_qmlinfo.cpp b/tests/auto/declarative/qmlinfo/tst_qmlinfo.cpp index 8241045..22841e5 100644 --- a/tests/auto/declarative/qmlinfo/tst_qmlinfo.cpp +++ b/tests/auto/declarative/qmlinfo/tst_qmlinfo.cpp @@ -77,14 +77,14 @@ void tst_qmlinfo::qmlObject() QString message = "QML " + QString(object->metaObject()->className()) + " (" + component.url().toString() + ":3:1) Test Message"; QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); - qmlInfo("Test Message", object); + qmlInfo(object) << "Test Message"; QObject *nested = qvariant_cast<QObject *>(object->property("nested")); QVERIFY(nested != 0); message = "QML " + QString(nested->metaObject()->className()) + " (" + component.url().toString() + ":6:13) Second Test Message"; QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); - qmlInfo("Second Test Message", nested); + qmlInfo(nested) << "Second Test Message"; } void tst_qmlinfo::nestedQmlObject() @@ -101,28 +101,28 @@ void tst_qmlinfo::nestedQmlObject() QString message = "QML " + QString(nested->metaObject()->className()) + " (" + component.url().toString() + ":5:13) Outer Object"; QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); - qmlInfo("Outer Object", nested); + qmlInfo(nested) << "Outer Object"; message = "QML " + QString(nested2->metaObject()->className()) + " (" + TEST_FILE("NestedObject.qml").toString() + ":6:14) Inner Object"; QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); - qmlInfo("Inner Object", nested2); + qmlInfo(nested2) << "Inner Object"; } void tst_qmlinfo::nonQmlObject() { QObject object; QTest::ignoreMessage(QtWarningMsg, "QML QObject (unknown location) Test Message"); - qmlInfo("Test Message", &object); + qmlInfo(&object) << "Test Message"; QPushButton pbObject; QTest::ignoreMessage(QtWarningMsg, "QML QPushButton (unknown location) Test Message"); - qmlInfo("Test Message", &pbObject); + qmlInfo(&pbObject) << "Test Message"; } void tst_qmlinfo::nullObject() { QTest::ignoreMessage(QtWarningMsg, "QML (unknown location) Null Object Test Message"); - qmlInfo("Null Object Test Message", 0); + qmlInfo(0) << "Null Object Test Message"; } void tst_qmlinfo::nonQmlContextedObject() @@ -131,7 +131,7 @@ void tst_qmlinfo::nonQmlContextedObject() QmlContext context(&engine); QmlEngine::setContextForObject(&object, &context); QTest::ignoreMessage(QtWarningMsg, "QML QObject (unknown location) Test Message"); - qmlInfo("Test Message", &object); + qmlInfo(&object) << "Test Message"; } QTEST_MAIN(tst_qmlinfo) |