Details
-
Bug
-
Resolution: Done
-
P2: Important
-
6.2.0, 6.2.1, 6.2, 6.3.0 Alpha
-
6.2.0 RC
-
None
-
-
31fa752209c4a6dfbd0aa7874350fd0ba37f8623 (qt/qtmultimedia/dev) 255e8cde23ae609f5109cb3caff639fbbae23334 (qt/qtmultimedia/6.2) 0df6cc0151a6c6dc564b2cee2bcf34182baa5243 (qt/qtmultimedia/6.2.0)
Description
In Qt5, the imageCaptured signal was embedded a URL as in the preview parameter. In Qt6, this parameter is now a QVariant(QImage).
While this can be useful, it breaks the usage of the preview parameter as a Image.source. The documentation still states that it can be used as such though.
qml: QVariant(QImage, QImage(QSize(1280, 720),format=QImage::Format_RGB32,depth=32,devicePixelRatio=1,bytesPerLine=5120,sizeInBytes=3686400))
Error: Cannot assign QImage to QUrl
Questions:
- Is this expected?
- Is there another way to grasp the preview image from QML?
Here is a sample to reproduce the behavior:
import QtQuick import QtQuick.Controls import QtMultimedia Window { id: root width: 1024 height: 600 visible: true CaptureSession { id: captureSession videoOutput: output camera: Camera {} imageCapture: ImageCapture { onImageCaptured: function (id, preview) { console.log(preview) image.source = preview } } } VideoOutput { id: output anchors.fill: parent Button { text: qsTr("Shot!") onClicked: captureSession.imageCapture.capture() } } Window { x: root.x - width y: root.y width: 250 height: 250 Image { id: image anchors.fill: parent fillMode: Image.PreserveAspectFit } } Component.onCompleted: captureSession.camera.start() }