0

I Use Qt 5.12.5 and I have qt quick controls 2 project that I run it on my Android Device.

Now I have a problem,the signal imageSaved of Camera Not trigger?

In below when I click button Camera should capture

Button{
    onClicked: {
        camera.imageCapture.capture();
    }
}

After Clicking the Button imageCaptured signal runs, the photoPrevew shows the captured image ,But onImageSaved Not running and I don't see any captured image in my Gallery!

Camera {
    id: camera
    position: Camera.BackFace
    imageProcessing.whiteBalanceMode: CameraImageProcessing.WhiteBalanceFlash

    flash.mode: Camera.FlashRedEyeReduction
    imageCapture {
        onImageCaptured: {                  ///this runs after capturing
            camera.stop();
            console.log("preview="+preview); ///  preview=image://camera/preview_1
            photoPreview.source = preview    ///photoPreview shows the capthed Image
            var imgPath = camera.imageCapture.capturedImagePath
            console.log("image Path=>"+imgPath); /// path is null
        }
        onCaptureFailed: {
            console.log("onCaptureFailed");
            console.log(message);
        }
        onImageSaved: {                             ///This not running
            console.log("*** onImageSaved ***");
            console.log("path=> "+path);
            up.loadImageFromFile("file://"+ path,imageOrientation);//this class upload Image to server
        }
    }
    focus {
        focusMode: Camera.FocusContinuous
        focusPointMode: Camera.FocusPointCenter
    }
}

Application Output

D ViewRootImpl: ViewPostImeInputStage processPointer 0
D ViewRootImpl: ViewPostImeInputStage processPointer 1
D SensorManager: registerListener :: 0, BMC150 Acceleration Sensor, 200000, 0,
E libGLESv1: HWUI Protection: wrong call from hwui context F:ES1-glDeleteTexturesSEC
D libEGL  : eglInitialize EGLDisplay = 0x9a3ff074
D libEGL  : eglInitialize EGLDisplay = 0x9a3ff074
D libEGL  : eglInitialize EGLDisplay = 0x9a3ff074
D ViewRootImpl: ViewPostImeInputStage processPointer 0
D ViewRootImpl: ViewPostImeInputStage processPointer 1
D SensorManager: unregisterListener ::
D Camera  : app passed NULL surface
D libEGL  : eglTerminate EGLDisplay = 0x9727ee84
D libEGL  : eglTerminate EGLDisplay = 0x9727ee84
D Camera  : app passed NULL surface
D libEGL  : eglTerminate EGLDisplay = 0xaea744cc
D libEGL  : eglTerminate EGLDisplay = 0xaea744b4
D MYAPP: qml: preview=image://camera/preview_1
D MYAPP: qml: image Path=>
mohsen
  • 1,763
  • 3
  • 17
  • 55
  • I see no point when you save the image. Please provide [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) – folibis Nov 30 '19 at 16:44
  • @folibis I want to upload the image to server ,after running onImageSaved signal,but it will not run. – mohsen Nov 30 '19 at 16:56
  • @folibis the `Camera` should himself save the image in my android gallery when I pressed the capture button. – mohsen Dec 01 '19 at 04:55
  • I suspect that the "onImageSaved" signal would only be triggered by an explicit save in Qt. The automatic save performed by the camera likely would not generate a signal. – Mark Dec 01 '19 at 08:43
  • @Mark I didn't have any problem in this Page(TakePic.qml).I updated Qt from 5.9 to 5.12.5.Now I see that my application don't work! I find the problem in above question.I don't khow why this happend,may be there is bug in Qt 5.12.5 .I don't khow.But I remember that before the signal was working – mohsen Dec 01 '19 at 08:57

0 Answers0