diff options
author | Robin Burchell <robin.burchell@crimson.no> | 2017-01-05 20:19:29 +0100 |
---|---|---|
committer | Robin Burchell <robin.burchell@crimson.no> | 2017-01-12 18:52:18 +0000 |
commit | c2e46b9d9140903f5b563f8835c11d4491452405 (patch) | |
tree | 749395b1450e28514a3fe5ba9f3508a133834e11 | |
parent | a16f2cc391c0be5614641e629267bcbf4d200951 (diff) |
QQuickItemGrabResult: Use qmlWarning instead of qWarning
This way we have information on the source location of the call instead of
flying blind and having to grep (possibly many) codebases to find the offender.
Change-Id: I86fb1b4a475ed2df7812890c7ee37246735d5a60
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
-rw-r--r-- | src/quick/items/qquickitemgrabresult.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/quick/items/qquickitemgrabresult.cpp b/src/quick/items/qquickitemgrabresult.cpp index c6355ceed2..07c2cb607c 100644 --- a/src/quick/items/qquickitemgrabresult.cpp +++ b/src/quick/items/qquickitemgrabresult.cpp @@ -47,6 +47,7 @@ #endif #include <QtQml/QQmlEngine> +#include <QtQml/QQmlInfo> #include <private/qquickpixmapcache_p.h> #include <private/qquickitem_p.h> @@ -279,17 +280,17 @@ QQuickItemGrabResult *QQuickItemGrabResultPrivate::create(QQuickItem *item, cons size = QSize(item->width(), item->height()); if (size.width() < 1 || size.height() < 1) { - qWarning("Item::grabToImage: item has invalid dimensions"); + qmlWarning(item) << "grabToImage: item has invalid dimensions"; return 0; } if (!item->window()) { - qWarning("Item::grabToImage: item is not attached to a window"); + qmlWarning(item) << "grabToImage: item is not attached to a window"; return 0; } if (!item->window()->isVisible()) { - qWarning("Item::grabToImage: item's window is not visible"); + qmlWarning(item) << "grabToImage: item's window is not visible"; return 0; } @@ -377,12 +378,12 @@ bool QQuickItem::grabToImage(const QJSValue &callback, const QSize &targetSize) { QQmlEngine *engine = qmlEngine(this); if (!engine) { - qWarning("Item::grabToImage: no QML Engine"); + qmlWarning(this) << "grabToImage: item has no QML engine"; return false; } if (!callback.isCallable()) { - qWarning("Item::grabToImage: 'callback' is not a function"); + qmlWarning(this) << "grabToImage: 'callback' is not a function"; return false; } @@ -391,12 +392,12 @@ bool QQuickItem::grabToImage(const QJSValue &callback, const QSize &targetSize) size = QSize(width(), height()); if (size.width() < 1 || size.height() < 1) { - qWarning("Item::grabToImage: item has invalid dimensions"); + qmlWarning(this) << "grabToImage: item has invalid dimensions"; return false; } if (!window()) { - qWarning("Item::grabToImage: item is not attached to a window"); + qmlWarning(this) << "grabToImage: item is not attached to a window"; return false; } |