Fixed warning in ImageHandler::extractQImage() when QZXING_QML is not defined

This commit is contained in:
Alexander Stillich 2018-11-05 14:11:38 +01:00
parent 0d67ad245f
commit 83e1075792
1 changed files with 7 additions and 5 deletions

View File

@ -29,7 +29,7 @@ QImage ImageHandler::extractQImage(QObject *imageObj, int offsetX, int offsetY,
QQuickItem *item = qobject_cast<QQuickItem *>(imageObj); QQuickItem *item = qobject_cast<QQuickItem *>(imageObj);
if (!item || !item->window()->isVisible()) { if (!item || !item->window()->isVisible()) {
qDebug() << "Item is NULL"; qWarning() << "ImageHandler: item is NULL";
return QImage(); return QImage();
} }
@ -52,11 +52,11 @@ QImage ImageHandler::extractQImage(QObject *imageObj, int offsetX, int offsetY,
QThread::yieldCurrentThread(); QThread::yieldCurrentThread();
} }
img = result->image(); img = result->image();
#else #else // QT_VERSION >= 0x050000
QGraphicsObject *item = qobject_cast<QGraphicsObject*>(imageObj); QGraphicsObject *item = qobject_cast<QGraphicsObject*>(imageObj);
if (!item) { if (!item) {
qDebug() << "Item is NULL"; qWarning() << "ImageHandler: item is NULL";
return QImage(); return QImage();
} }
@ -65,8 +65,10 @@ QImage ImageHandler::extractQImage(QObject *imageObj, int offsetX, int offsetY,
QPainter painter(&img); QPainter painter(&img);
QStyleOptionGraphicsItem styleOption; QStyleOptionGraphicsItem styleOption;
item->paint(&painter, &styleOption); item->paint(&painter, &styleOption);
#endif #endif // QT_VERSION >= 0x050000
#endif //defined(QZXING_QML) #else // defined(QZXING_QML)
Q_UNUSED(imageObj);
#endif // defined(QZXING_QML)
if (offsetX < 0) if (offsetX < 0)
offsetX = 0; offsetX = 0;