Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-97622

QML ImageCapture preview property does nothing?

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 6.2.1, 6.3.0 Alpha, 6.2
    • 6.2.0
    • Multimedia
    • None
    • Windows 10 20H2 Build 19042.1288
    • Windows
    • 1040fb6de4206dfe7f19c55de198b5db26b48d17 (qt/qtmultimedia/dev) 71466d9382e8712e6ee6167fcc3ebf61e7efb350 (qt/qtmultimedia/6.2) d6e4f86c28b28bed684b9d79fbb4598163e6c2ce (qt/qtmultimedia/6.2.1)

    Description

      I took the example from: https://doc.qt.io/qt-6/qml-qtmultimedia-imagecapture.html

      I modified it a little bit to get it running:

      import QtQuick
      import QtQuick.Window
      import QtMultimedia
      import QtQuick.Controls
      
      Window {
          width: 640
          height: 720
          visible: true
          CaptureSession {
              imageCapture : ImageCapture {
                  id: imageCapture
                  onImageCaptured: function( id, preview ){
                      console.log( "Image captured: >" + preview + "<" )
                  }
              }
              camera: Camera {
                  id: camera
              }
      
              videoOutput: videoOutput
          }
          VideoOutput {
              id: videoOutput
              anchors.top: parent.top
              anchors.left: parent.left
              anchors.right: parent.right
              height: parent.height / 2
          }
          Image {
              id: photoPreview
              anchors.top: videoOutput.bottom
              anchors.bottom: parent.bottom
              anchors.left: parent.left
              anchors.right: parent.right
              source: imageCapture.preview // always shows the last captured image
          }
          Button{
              text: "Capture"
              anchors.left: parent.left
              anchors.bottom: parent.bottom
              onClicked: imageCapture.capture()
          }
          Button{
              text: "Check whats in imageCapture.preview"
              anchors.right: parent.right
              anchors.bottom: parent.bottom
              onClicked: console.log( "imageCapture.preview >" + imageCapture.preview + "<" )
          }
      
          Component.onCompleted: camera.start()
      }
      
      1. Open the app
      2. Push button "Capture"
      3. onImageCaptured is called with an image
      4. photoPreview does not show an image
      5. Push button "Check whats in imageCapture.preview" logs to console - imageCapture.preview seems empty

       

      So now I am not certain if the example is just wrong or something is broken.

       

      Also the type for preview is documented wrong (I guess):

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            piotr Piotr Srebrny (Inactive)
            Marscho Marscho
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes