Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
declarative-camera vs. widget based camera (QML to c++ breakout)
Flaming Moe last edited by Flaming Moe
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
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):
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)
LuGRU last edited by
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.