Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Image: Invalid image provider with modified declarative camera example
Qt 6.11 is out! See what's new in the release blog

QML Image: Invalid image provider with modified declarative camera example

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 1 Posters 445 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Martin Burchell
    wrote on last edited by
    #1

    I'm updating our application to Qt6.2.

    We have a CameraQml widget, which is based on the declarative camera example and has the ability to save the captured image. The images are being saved OK but the preview window only displays the first captured photo. For subsequent photos the preview window shows a black screen and there is the error message:

    qrc:/resources/camera_qml/PhotoPreview.qml:59:5: QML Image: Invalid image provider: image://camera/preview_1
    

    This is on Ubuntu 20.04, though I don't think this is a platform-related issue.

    The declarative camera example runs fine and does not display this message so I'm pretty sure the problem is in my code. It seems like something isn't getting tidied up properly.

    I've extracted the relevant code into an example at https://github.com/martinburchell/qml-camera-example .

    The main application is at:
    https://github.com/martinburchell/qml-camera-example/blob/main/main.cpp

    The widget containing the QML is at:
    https://github.com/martinburchell/qml-camera-example/blob/main/cameraqml.cpp

    The QML is different from the example in the following ways:

    https://github.com/martinburchell/qml-camera-example/blob/main/resources/camera_qml/camera.qml

    We've added:

    • handlers for onImageCaptured and onImageSaved to ImageCapture.
    • a custom handler for onImageSavedToFile to PhotoPreview
    • a custom fileNoLongerNeeded signal to tidy up saved images

    https://github.com/martinburchell/qml-camera-example/blob/main/resources/camera_qml/PhotoCaptureControls.qml

    The CameraButton onClicked handler sends the fileNoLongerNeeded signal mentioned above.

    https://github.com/martinburchell/qml-camera-example/blob/main/resources/camera_qml/PhotoPreview.qml

    We've added a Save button, which sends the imageSavedToFile signal.

    Any suggestions as to what the problem might be?

    M 1 Reply Last reply
    1
    • M Martin Burchell

      I'm updating our application to Qt6.2.

      We have a CameraQml widget, which is based on the declarative camera example and has the ability to save the captured image. The images are being saved OK but the preview window only displays the first captured photo. For subsequent photos the preview window shows a black screen and there is the error message:

      qrc:/resources/camera_qml/PhotoPreview.qml:59:5: QML Image: Invalid image provider: image://camera/preview_1
      

      This is on Ubuntu 20.04, though I don't think this is a platform-related issue.

      The declarative camera example runs fine and does not display this message so I'm pretty sure the problem is in my code. It seems like something isn't getting tidied up properly.

      I've extracted the relevant code into an example at https://github.com/martinburchell/qml-camera-example .

      The main application is at:
      https://github.com/martinburchell/qml-camera-example/blob/main/main.cpp

      The widget containing the QML is at:
      https://github.com/martinburchell/qml-camera-example/blob/main/cameraqml.cpp

      The QML is different from the example in the following ways:

      https://github.com/martinburchell/qml-camera-example/blob/main/resources/camera_qml/camera.qml

      We've added:

      • handlers for onImageCaptured and onImageSaved to ImageCapture.
      • a custom handler for onImageSavedToFile to PhotoPreview
      • a custom fileNoLongerNeeded signal to tidy up saved images

      https://github.com/martinburchell/qml-camera-example/blob/main/resources/camera_qml/PhotoCaptureControls.qml

      The CameraButton onClicked handler sends the fileNoLongerNeeded signal mentioned above.

      https://github.com/martinburchell/qml-camera-example/blob/main/resources/camera_qml/PhotoPreview.qml

      We've added a Save button, which sends the imageSavedToFile signal.

      Any suggestions as to what the problem might be?

      M Offline
      M Offline
      Martin Burchell
      wrote on last edited by
      #2

      https://bugreports.qt.io/browse/QTBUG-111460

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved