Ask / Submit

QML Camera onImageCaptured

asked 2014-03-28 00:08:43 +0300

yoktobit gravatar image

In my QR code scanner app, I use QMLs Camera element and QZXing. In my current version I use


with an imagePath to /{PicturesLocation}/tempqr.jpg

And then I call QZXing with that path.

This method includes a lot of I/O and it would be better to use onImageCaptured with an in-memory-Image. However, onImageCaptured is never called if I call capture(). Will future updates to Sailfish include improvements to the Camera QML item?

edit retag flag offensive close delete


I've been perplexed as to why the onImageCaptured signal is never called. It looks like the answer is in the gstreamer camerabin plugin. The post-previews property of the gstreamer object is set to TRUE in the mer project source, whereas in the Sailfish source it's set to FALSE. The equivalent line in the most recent Sailfish sources is the following:

g_object_set(G_OBJECT(m_camerabin), POST_PREVIEWS_PROPERTY, FALSE, NULL);

Unfortunately I don't see any way to change this easily through the API. Technically you can access m_camerabin like this:

QMediaControl *control = m_camera->service()->requestControl(QCameraImageCaptureControl_iid); CameraBinSession * session = qobject_cast<QCameraImageCaptureControl*>(control)->parent(); CameraBin * m_camerabin = session->cameraBin();

but none of the required header files are available.

flypig ( 2018-04-24 00:29:08 +0300 )edit

1 Answer

Sort by » oldest newest most voted

answered 2014-05-13 19:06:09 +0300

Marti Masa K gravatar image

updated 2014-05-15 15:01:54 +0300

Sorry to have no straight answer to your question! I'm wondering since I didn't find any alternative camera app in Warehouse or somewhere else, why there seems no big interest for additional camera apps? Perhaps Jolla's main camera app is so great. It got nice improvements and I really enjoy the amount of settings and tweakings. Still I would find additional camera apps useful. For example, a simple mirror app would be nice using the front camera. Also some augmented reality app would come handy or an magnifier lens, even a mobile microscope with THO would be great. I'm happy to contribute if I have time. In the past I've done some home-made camera apps in Harmattan (N9) but now I would like to continue with that in Sailfish. Just the starting point I'm missing to use it in current Sailfish-SDK/Qt-creator. -Marti.

edit flag offensive delete publish link more


I don't know which of the "Camera" properties are implemented, but I think it's usage is straight forward, but because of Qt 5 a bit different from Harmattan with QtMobility. You can find an example here:

yoktobit ( 2014-05-14 10:27:01 +0300 )edit

@Marti Masa K for the sake of conciseness, please consider to convert your answer to a comment (as it actually is not an answer to yoktobits question). Thanks :)

tokaru ( 2014-05-14 17:49:44 +0300 )edit

@yoktobit - Danke! Thanks for sharing an example! @tokaru I agree with you. I made a minor edit to address here all of us just as a comment!

Marti Masa K ( 2014-05-15 15:04:54 +0300 )edit
Login/Signup to Answer

Question tools

1 follower


Asked: 2014-03-28 00:08:43 +0300

Seen: 1,016 times

Last updated: May 15 '14