Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

After the photographing to continue the preview



  • Hi!
    After the photographing to continue the preview?
    In this case, the place of preview somehow gets a picture from the photo.

    import QtQuick 2.12
    import QtQuick.Controls 2.12
    import QtMultimedia 5.12
    
    Item {
        width: 400
        height: 700
    
        property alias buttonPhoto: buttonPhoto
        property alias photoImage: photoImage
        property alias photoPreview: photoPreview
        property alias camera: camera
    
        Camera {
            id: camera
    
            imageProcessing.whiteBalanceMode: CameraImageProcessing.WhiteBalanceFlash
    
            exposure {
                exposureCompensation: -1.0
                exposureMode: Camera.ExposurePortrait
            }
    
            flash.mode: Camera.FlashRedEyeReduction
    
            imageCapture {
                id: imageCapture1
                onImageCaptured: {
                    photoPreview.source = preview  // Show the preview in an Image
                }
                onImageSaved: {
                    //photoImage.source = "file:" + appCore.getDirApp() +  "/IMG_00000001.jpg"
                    photoImage.source = appCore.getImage(appCore.getDirApp() +  "/IMG_00000001.jpg")
                    //imageCapture1.cancelCapture()
                }
            }
        }
    
        VideoOutput {
            anchors.bottomMargin: 331
            source: camera
            anchors.fill: parent
            focus : visible // to receive focus and capture key events when visible
            autoOrientation: true
        }
    
        Image {
            id: photoPreview
        }
    
        Image {
            id: photoImage
            x: 21
            y: 433
            width: 219
            height: 215
            fillMode: Image.PreserveAspectFit
            cache: false
            source: "qrc:/Images/Images/6.png"
    
        }
    
        Button {
            id: buttonPhoto
            x: 264
            y: 507
            text: qsTr("Photo")
    //        onClicked: {
    //            camera.imageCapture.captureToLocation(appCore.getDirApp() +  "/IMG_00000001.jpg")
    //        }
        }
    }
    
    


  • Everything worked. It is only in Preview photo display of a static image, removed the photo Preview and all is well.


Log in to reply