How to get the supported resolution of a QCamera
-
Hi,
I've never usedQCamera
myself but as nobody replied yet I'll give it a shot...
The documentation states:The camera must be loaded before calling this function, otherwise the returned list is empty.
So, did you load the camera before calling
QCamera::supportedViewfinderResolutions()
? -
@Andy314 Hi! What @Joel-Bodenmann said is correct; you must wait until the camera status has changed to loaded. You can use
QCamera::statusChanged
signal for this:QList<QCameraInfo> cameras = QCameraInfo::availableCameras(); m_camera = new QCamera(cameras.at(0), this); connect(m_camera, &QCamera::statusChanged, this, &MainWindow::onStatusChanged); m_camera->load(); // ... void MainWindow::onStatusChanged() { qDebug() << m_camera->status(); qDebug() << m_camera->supportedViewfinderResolutions(); }
-
Sorry I pasted the the wrong test-code.
(The supportedViewfinderResolutions() works indeed, but I need the natural camera-resolution.)Capture = new QCameraImageCapture(Cam);
QList<QSize> res = Capture->supportedResolutions();List ist empty after loaded signal!!!
My aim it to retriever the possible resolutions of a camera, choose a possible resolution and make a capture with this resolution.
If found the code above in the integrated Camera example of the Qt.
The direct compiled example does not work as well. -
I found this link:
Multimedia Backends
I seem that in Qt 5.5 (dont know what is with 5.6) for Windows the Camera in not really supported. :-(((
Any ideas how to integrate camera functionality in a Qt-App ?