add several QCameras on one window
-
Hi,
I want to add 4 QCameras on one window and record video. I manage to do it with one camera, but when trying to add the second one I get an error on the constructor of the QCamera:
usbcam.cpp:18:14: error: no viable overloaded '='
qcamera.h:251:5: note: candidate function not viable: no known conversion from 'QCamera *' to 'const QCamera' for 1st argument; dereference the argument with *
qglobal.h:436:12: note: expanded from macro 'Q_DISABLE_COPY'Can someone give me a hint whats my issue. Thanks
-
Hi,
I want to add 4 QCameras on one window and record video. I manage to do it with one camera, but when trying to add the second one I get an error on the constructor of the QCamera:
usbcam.cpp:18:14: error: no viable overloaded '='
qcamera.h:251:5: note: candidate function not viable: no known conversion from 'QCamera *' to 'const QCamera' for 1st argument; dereference the argument with *
qglobal.h:436:12: note: expanded from macro 'Q_DISABLE_COPY'Can someone give me a hint whats my issue. Thanks
@Garza said in add several QCameras on one window:
usbcam.cpp:18:14: error: no viable overloaded '='
Please show your code. It looks like you're trying to copy a QCamera instance.
-
this is on the .h file:
QCamera* cameraFL, cameraFR;//, cameraRL, cameraRR;
QCameraViewfinder* viewfinderFL, viewfinderFR;//, viewfinderRL, viewfinderRR;
QMediaRecorder* recorderFL, recorderFR;//, recorderRL, recorderRR;
QVideoEncoderSettings settingsFL;//s, settingsFR, settingsRL, settingsRR;This on the cpp file:
cameraFL = new QCamera("/dev/video0");
viewfinderFL = new QCameraViewfinder();
cameraFL->setViewfinder(viewfinderFL);
ui->gridLayout->addWidget(viewfinderFL);
cameraFL->start();cameraFR = new QCamera("/dev/video2"); -
this is on the .h file:
QCamera* cameraFL, cameraFR;//, cameraRL, cameraRR;
QCameraViewfinder* viewfinderFL, viewfinderFR;//, viewfinderRL, viewfinderRR;
QMediaRecorder* recorderFL, recorderFR;//, recorderRL, recorderRR;
QVideoEncoderSettings settingsFL;//s, settingsFR, settingsRL, settingsRR;This on the cpp file:
cameraFL = new QCamera("/dev/video0");
viewfinderFL = new QCameraViewfinder();
cameraFL->setViewfinder(viewfinderFL);
ui->gridLayout->addWidget(viewfinderFL);
cameraFL->start();cameraFR = new QCamera("/dev/video2");@Garza said in add several QCameras on one window:
QCamera* cameraFL, cameraFR;
cameraFR is not a pointer here. Change to
QCamera* cameraFL, *cameraFR;Or better
QCamera* cameraFL; QCamera* cameraFR;to avoid such confusion.
-
@Garza said in add several QCameras on one window:
QCamera* cameraFL, cameraFR;
cameraFR is not a pointer here. Change to
QCamera* cameraFL, *cameraFR;Or better
QCamera* cameraFL; QCamera* cameraFR;to avoid such confusion.
-
I have managed to add the cameras on one window and are working, I have used a grid of 2x2, now I want to add a text label below each camera. This sounds easy but I havent been able to make it, this is my code:
cameraFL = new QCamera("/dev/video2");
viewfinderFL = new QCameraViewfinder();
cameraFL->setViewfinder(viewfinderFL);
grid->addWidget(viewfinderFL,0,0,2,2);
recorderFL =new QMediaRecorder(cameraFL,this);
settingsFL = recorderFL->videoSettings();
settingsFL.setResolution(640,480);
settingsFL.setQuality(QMultimedia::VeryHighQuality);
settingsFL.setFrameRate(10.0);
recorderFL->setVideoSettings(settingsFL);
recorderFL->setContainerFormat("mp4");
cameraFL->setCaptureMode(QCamera::CaptureVideo);
cameraFL->start();This is for one camera, I have read I have to use a QVBoxLayout inside the grid and then add the camera and the label, but I havent been able to accomplish this. Thanks for the support.
-
I have managed to add the cameras on one window and are working, I have used a grid of 2x2, now I want to add a text label below each camera. This sounds easy but I havent been able to make it, this is my code:
cameraFL = new QCamera("/dev/video2");
viewfinderFL = new QCameraViewfinder();
cameraFL->setViewfinder(viewfinderFL);
grid->addWidget(viewfinderFL,0,0,2,2);
recorderFL =new QMediaRecorder(cameraFL,this);
settingsFL = recorderFL->videoSettings();
settingsFL.setResolution(640,480);
settingsFL.setQuality(QMultimedia::VeryHighQuality);
settingsFL.setFrameRate(10.0);
recorderFL->setVideoSettings(settingsFL);
recorderFL->setContainerFormat("mp4");
cameraFL->setCaptureMode(QCamera::CaptureVideo);
cameraFL->start();This is for one camera, I have read I have to use a QVBoxLayout inside the grid and then add the camera and the label, but I havent been able to accomplish this. Thanks for the support.
-
Hi,
I have managed to make the 4 webcams on a Main Window and it works, now I am porting this to my GUI and this webcam window should appear when I press a button wit a camera Icon.My questions is:
-On the NewWindow code I could set::
this->setCentralWidget(w);
but now I get the message:
error: no member named 'setCentralWidget' in 'Webcam'
I added the code as a Qt Designer Form Class and then called the class when I pressed the button and it works but the widget is not centered to the new window and also does not change size when I resize the window.
Can you give a hint ? thanks -
Hi,
I have managed to make the 4 webcams on a Main Window and it works, now I am porting this to my GUI and this webcam window should appear when I press a button wit a camera Icon.My questions is:
-On the NewWindow code I could set::
this->setCentralWidget(w);
but now I get the message:
error: no member named 'setCentralWidget' in 'Webcam'
I added the code as a Qt Designer Form Class and then called the class when I pressed the button and it works but the widget is not centered to the new window and also does not change size when I resize the window.
Can you give a hint ? thanks@Garza said in add several QCameras on one window:
setCentralWidget
This is only available in QMainWindow. If you use QWidget there is no need for setCentralWidget.
-
@Garza said in add several QCameras on one window:
setCentralWidget
This is only available in QMainWindow. If you use QWidget there is no need for setCentralWidget.