Qt5.2 cannot show the viewfinder on android screen
-
Qt is new to me. I followed their example Camera Example and QML Camera Example to build my own app. I am using pure C++ language instead of QML. The app is able to show the viewfinder on screen in Desktop version but it shows nothings in Android. Everything(OSX, NDK, Android SDK, QT) is in latest version
@//widget.h
#ifndef WIDGET_H
#define WIDGET_H#include <QVideoWidget>
#include <QCamera>
#include <QCameraViewfinder>namespace Ui {
class Widget;
}class Widget : public QVideoWidget
{
Q_OBJECTpublic:
explicit Widget(QWidget *parent = 0);
~Widget();private:
Ui::Widget *ui;
QCamera *camera;
};#endif // WIDGET_H@
@//widget.cpp
#include "widget.h"
#include "ui_widget.h"Widget::Widget(QWidget *parent) :
QVideoWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);camera = new QCamera(this);
camera->setCaptureMode(QCamera::CaptureStillImage);
camera->setViewfinder(this);
camera->start();
}Widget::~Widget()
{
delete ui;
}@@//camera.pro
QT += core gui widgets multimedia multimediawidgetsTARGET = opencv
TEMPLATE = appSOURCES += main.cpp
widget.cppHEADERS += widget.h
FORMS += widget.ui
CONFIG += mobility console
MOBILITY = @ -
The Qt Multimedia Widgets module is not supported on Android.