I've been using QZXing to decode QR code, my QML looks like this
Image{
width:300
height:300
id:imageToDecode
source:"qr.jpg"
cache: true
}
and when i pass it into C++ file, it has to be converted into a QImage type, in the code the original coder wrote like this
QGraphicsItem *item = qobject_cast<QGraphicsItem*>(imageObj);
and then use QGraphicsItem to construct a QImage,however this will always return 0 after conversion, since QGraphicsItem does not inherit QObject
straight conversion like
QImage*item = qobject_cast<QImage*>(imageToDecode);
will not work for same reason,ive been using
imageObj->inherits("objectName");
to test which one it can be converted to, but there is none i can find my point is to convert QML Image into QImage.
– user2703750 Aug 16 '14 at 05:36