-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the possibility to change the input camera
- Loading branch information
1 parent
825b284
commit b84ad01
Showing
9 changed files
with
246 additions
and
127 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#include "dialog_choose_camera.h" | ||
|
||
Dialog_choose_camera::Dialog_choose_camera(QList<QCameraInfo> cameras,QWidget *parent): QDialog(parent){ | ||
this->list_cameras = cameras; | ||
|
||
QList< QPushButton* > PB; | ||
QButtonGroup* group = new QButtonGroup(this); | ||
QGridLayout *grid = new QGridLayout; | ||
|
||
QLabel* label = new QLabel("Please choose one of the following cameras:"); | ||
grid->addWidget(label, 0, 0); | ||
int i=0; | ||
foreach (const QCameraInfo &cameraInfo, cameras) { | ||
// Retrieve camera name | ||
QString info = cameraInfo.description() ; | ||
|
||
// Create new button with textValue == camera name | ||
QPushButton *button = new QPushButton(info, this); | ||
|
||
// Store button in an array | ||
PB << button; | ||
group->addButton(button,i); | ||
grid->addWidget(button, i+1, 0); | ||
i++; | ||
} | ||
|
||
connect(group, SIGNAL(buttonClicked(int)), this, SLOT(onClick_Choose_Camera(int))); | ||
|
||
setLayout(grid); | ||
setWindowTitle(tr("Camera control window")); | ||
} | ||
|
||
void Dialog_choose_camera::onClick_Choose_Camera(int val) { | ||
this->info_camera = this->list_cameras[val].description(); | ||
emit this->Signal_camera_chosen( val ) ; | ||
} | ||
|
||
QString Dialog_choose_camera::get_info_camera() { | ||
return this->info_camera ; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef DIALOG_CHOOSE_CAMERA_H | ||
#define DIALOG_CHOOSE_CAMERA_H | ||
|
||
#include <QDialog> | ||
#include <QLabel> | ||
#include <QPushButton> | ||
#include <QButtonGroup> | ||
#include <QGridLayout> | ||
#include <QCameraInfo> | ||
#include <QDebug> | ||
|
||
class Dialog_choose_camera : public QDialog | ||
{ | ||
Q_OBJECT | ||
public: | ||
explicit Dialog_choose_camera(QList<QCameraInfo> cameras,QWidget *parent = nullptr); | ||
QString get_info_camera() ; | ||
|
||
private: | ||
QString info_camera ; | ||
QList<QCameraInfo> list_cameras ; | ||
|
||
private slots: | ||
void onClick_Choose_Camera(int); | ||
|
||
signals: | ||
void Signal_camera_chosen(int value); | ||
}; | ||
|
||
#endif // DIALOG_CHOOSE_CAMERA_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.