<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QML Image: Invalid image provider with modified declarative camera example]]></title><description><![CDATA[<p dir="auto">I'm updating our application to Qt6.2.</p>
<p dir="auto">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:</p>
<pre><code>qrc:/resources/camera_qml/PhotoPreview.qml:59:5: QML Image: Invalid image provider: image://camera/preview_1
</code></pre>
<p dir="auto">This is on Ubuntu 20.04, though I don't think this is a platform-related issue.</p>
<p dir="auto">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.</p>
<p dir="auto">I've extracted the relevant code into an example at <a href="https://github.com/martinburchell/qml-camera-example" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/martinburchell/qml-camera-example</a> .</p>
<p dir="auto">The main application is at:<br />
<a href="https://github.com/martinburchell/qml-camera-example/blob/main/main.cpp" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/martinburchell/qml-camera-example/blob/main/main.cpp</a></p>
<p dir="auto">The widget containing the QML is at:<br />
<a href="https://github.com/martinburchell/qml-camera-example/blob/main/cameraqml.cpp" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/martinburchell/qml-camera-example/blob/main/cameraqml.cpp</a></p>
<p dir="auto">The QML is different from the example in the following ways:</p>
<p dir="auto"><a href="https://github.com/martinburchell/qml-camera-example/blob/main/resources/camera_qml/camera.qml" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/martinburchell/qml-camera-example/blob/main/resources/camera_qml/camera.qml</a></p>
<p dir="auto">We've added:</p>
<ul>
<li>handlers for <code>onImageCaptured</code> and <code>onImageSaved</code> to <code>ImageCapture</code>.</li>
<li>a custom handler for <code>onImageSavedToFile</code> to <code>PhotoPreview</code></li>
<li>a custom <code>fileNoLongerNeeded</code> signal to tidy up saved images</li>
</ul>
<p dir="auto"><a href="https://github.com/martinburchell/qml-camera-example/blob/main/resources/camera_qml/PhotoCaptureControls.qml" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/martinburchell/qml-camera-example/blob/main/resources/camera_qml/PhotoCaptureControls.qml</a></p>
<p dir="auto">The <code>CameraButton</code> <code>onClicked</code> handler sends the <code>fileNoLongerNeeded</code> signal mentioned above.</p>
<p dir="auto"><a href="https://github.com/martinburchell/qml-camera-example/blob/main/resources/camera_qml/PhotoPreview.qml" target="_blank" rel="noopener noreferrer nofollow ugc">https://github.com/martinburchell/qml-camera-example/blob/main/resources/camera_qml/PhotoPreview.qml</a></p>
<p dir="auto">We've added a Save button, which sends the <code>imageSavedToFile</code> signal.</p>
<p dir="auto">Any suggestions as to what the problem might be?</p>
]]></description><link>https://forum.qt.io/topic/142847/qml-image-invalid-image-provider-with-modified-declarative-camera-example</link><generator>RSS for Node</generator><lastBuildDate>Wed, 07 Oct 2026 14:57:25 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/142847.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 10 Feb 2023 15:16:14 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QML Image: Invalid image provider with modified declarative camera example on Thu, 23 Feb 2023 16:42:31 GMT]]></title><description><![CDATA[<p dir="auto"><a href="https://bugreports.qt.io/browse/QTBUG-111460" target="_blank" rel="noopener noreferrer nofollow ugc">https://bugreports.qt.io/browse/QTBUG-111460</a></p>
]]></description><link>https://forum.qt.io/post/748917</link><guid isPermaLink="true">https://forum.qt.io/post/748917</guid><dc:creator><![CDATA[Martin Burchell]]></dc:creator><pubDate>Thu, 23 Feb 2023 16:42:31 GMT</pubDate></item></channel></rss>