Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

QZXingImageProvider.cpp Example File

appdemos/qtws/QZXing/QZXingImageProvider.cpp
 #include "QZXingImageProvider.h"

 QZXingImageProvider *QZXingImageProvider::singletonInstance_ptr_ = NULL;

 QZXingImageProvider::QZXingImageProvider() : QQuickImageProvider(QQuickImageProvider::Pixmap)
 {
 }

 QPixmap QZXingImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
 {
     if(id == "latestEncoded")
         return storedPixmap;
     else
         return QPixmap();
 }

 void QZXingImageProvider::storeImage(const QImage &providedImage)
 {
     storedPixmap = QPixmap::fromImage(providedImage);
 }

 QZXingImageProvider *QZXingImageProvider::getInstance()
 {
     if(!singletonInstance_ptr_)
         singletonInstance_ptr_ = new QZXingImageProvider();

     return singletonInstance_ptr_;
 }
Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded