diff --git a/source/imagehandler.cpp b/source/imagehandler.cpp index c939aaf..4315a84 100644 --- a/source/imagehandler.cpp +++ b/source/imagehandler.cpp @@ -4,6 +4,7 @@ #include #include #include +#include ImageHandler::ImageHandler(QObject *parent) : QObject(parent) @@ -16,7 +17,22 @@ QImage ImageHandler::extractQImage(QObject *imageObj, { QGraphicsObject *item = qobject_cast(imageObj); - if (!item) { + if (!item && (imageObj->metaObject()->className() == "QQuickImage")) { + QQuickImage *quickimage = static_cast(imageObj); + + if (!quickImage) { + qDebug() << "quickimage is NULL"; + return QImage(); + } + + QImage img(quickimage->image()); + if(offsetX == 0 && offsetY == 0 && width == 0 && height == 0) + return img; + else + { + return img.copy(offsetX, offsetY, width, height); + } + } else if (!item) { qDebug() << "Item is NULL"; return QImage(); }