Merge commit '812238d1f5f706bd4050ce2ee925c56169673f54'

This commit is contained in:
favoritas37 2015-05-16 15:06:04 +03:00
commit d10cabd000
1 changed files with 17 additions and 1 deletions

View File

@ -4,6 +4,7 @@
#include <QPainter> #include <QPainter>
#include <QStyleOptionGraphicsItem> #include <QStyleOptionGraphicsItem>
#include <QDebug> #include <QDebug>
#include <private/qquickimage_p.h>
ImageHandler::ImageHandler(QObject *parent) : ImageHandler::ImageHandler(QObject *parent) :
QObject(parent) QObject(parent)
@ -16,7 +17,22 @@ QImage ImageHandler::extractQImage(QObject *imageObj,
{ {
QGraphicsObject *item = qobject_cast<QGraphicsObject*>(imageObj); QGraphicsObject *item = qobject_cast<QGraphicsObject*>(imageObj);
if (!item) { if (!item && (imageObj->metaObject()->className() == "QQuickImage")) {
QQuickImage *quickimage = static_cast<QQuickImage*>(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"; qDebug() << "Item is NULL";
return QImage(); return QImage();
} }