declarative-camera vs. widget based camera (QML to c++ breakout)
-
Hello community,
since i have a Sony smartphone i have the same issue like many other to get the widget based camera example to run. I tried a lot around with permission setting in the manifest, but noting to do.
Instead the declarative example works fine, So i try to do a QML->C++ breakout like this
http://doc.qt.io/qt-5/qtqml-cppintegration-interactqmlfromcpp.html
at the "Invoking QML Methods" headline.
I allways get a component Error when calling "create".
Here is the snippt from the constructor (i made a widget project and instanciate the example from the widget, because when i tried that in the original project structure, the programm crashes somehow):view.setSource(QUrl("qrc:///declarative-camera.qml"));
view.resize(800, 480);
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.show();
QQmlEngine engine;
QQmlComponent component(&engine, "qrc:///declarative-camera.qml");
if(component.status() == QQmlComponent::Error)qDebug() << "Error";
if(component.status() == QQmlComponent::Ready)qDebug() << "Ready";
if(component.status() == QQmlComponent::Null)qDebug() << "Null";
object = component.create();Has someone a hint?
(except to do the App in QML, i´m not familiar with QML and i have a case where i need a fast solution, even it is not perfect or even good)best reg.
Moe -
You can try to do bring QML context into WIdget world. To do so use off-screen renderer class and then just retrieve QImage on update and paint it.
PROS: It will work even with rester widget engine (of course HW OGL support is required but Your app don't need to "use" OGL - it will but window will be not visible)
CONS: converting FBO to QImage is considered slow operation (said that I can easily achieve smooth playback - depending on Android device CPU and capture resolution - on Camera QML module)QCamera is broken, IIRC viewfinder do work - although I don't remember if this was for Android or iOS - probably for iOS. Other modes no.