How do you use QImageCapture now? There's no way to specify a camera.



  • I'm encountering some aggravation porting a media-streaming application from Qt 5 to 6.2. The multimedia classes have undergone some major restructuring, which I appreciate given that the goal was to clean up their design.

    But (meaning no insult to anyone here) the documentation for these classes is in a poor and often unusable state. It refers to nonexistent (deleted) functions, and there's no document talking about how to port multimedia from version 5 to 6. This is essential. I've filed some doc bugs on the things I've found so far.

    I think I managed to get most of the way there porting to the new audio-input classes (some missing functions notwithstanding), but I'm stumped as to how to get video into the app now. QCameraImageCapture is gone. The documentation shows that you use QImageCapture and pass a camera into its constructor, but this is wrong. That constructor is explicitly deleted. Look at the Qt code in qimagecapture.h:

    // This is here to flag an incompatibilities with Qt 5
    QImageCapture(QCamera *) = delete;
    

    Mission accomplished then; it's flagged. Now what?

    Thanks for any insight!


  • Lifetime Qt Champion

    Hi,

    You found a documentation bug.

    You can use another QObject parent if you want to manage the lifetime of the QImageCapture through Qt's parent/child system.

    Otherwise, you can remove the parent.


  • Lifetime Qt Champion

    Doc fix in progress.



  • @SGaist Thanks. The bug report is here.

    Still... there's no apparent way to specify a video device (like a camera) for QImageCapture.


  • Lifetime Qt Champion

    It's set on the QMediaCaptureSession, isn't it ?


Log in to reply