Skip to content
Snippets Groups Projects
Commit f49b0591 authored by simon.fanetti's avatar simon.fanetti
Browse files

fixe overrided SubApp's functions

parent fb2c8523
No related branches found
No related tags found
No related merge requests found
...@@ -43,23 +43,28 @@ void CroppingMask::cancelRoutine(){ ...@@ -43,23 +43,28 @@ void CroppingMask::cancelRoutine(){
void CroppingMask::showEvent(QShowEvent *event){ void CroppingMask::showEvent(QShowEvent *event){
QWidget::showEvent(event); QWidget::showEvent(event);
QTimer::singleShot(100, this, &CroppingMask::takePicture); takePicture();
} }
void CroppingMask::on_btnTakePicture_clicked() void CroppingMask::on_btnTakePicture_clicked()
{ {
takePicture();
}
void CroppingMask::takePicture(){
// take picture of blue screen // take picture of blue screen
if(!blueScreenInitilized){ if(!blueScreenInitilized){
blueScreenInitilized = true; blueScreenInitilized = true;
projBlueScreen->setGeometry(mg->getResolution()); projBlueScreen->setGeometry(mg->getResolution());
} }
cv::Mat blueMat = cv::Mat(1, 1, CV_8UC3, cv::Scalar(0, 0, 255)); cv::Mat blueMat = cv::Mat(1, 1, CV_8UC3, cv::Scalar(0, 0, 255));
projBlueScreen->imShow(blueMat); projBlueScreen->imShow(blueMat);
QTimer::singleShot(1000, this, &CroppingMask::takePicture); QTimer::singleShot(1000, this, &CroppingMask::capture);
} }
void CroppingMask::takePicture(){ void CroppingMask::capture(){
setup->getCamera()->capture(); setup->getCamera()->capture();
projBlueScreen->close(); projBlueScreen->close();
......
...@@ -44,6 +44,7 @@ private: ...@@ -44,6 +44,7 @@ private:
bool maskValideInFrame(cv::Mat *rgb); bool maskValideInFrame(cv::Mat *rgb);
void takePicture(); void takePicture();
void capture();
}; };
#endif // CROPPINGMASK_H #endif // CROPPINGMASK_H
...@@ -11,7 +11,6 @@ void CameraStartThread::run() { ...@@ -11,7 +11,6 @@ void CameraStartThread::run() {
camera->start(); camera->start();
camera->warmUpDepthLens(); camera->warmUpDepthLens();
std::cout << "camera ready" << std::endl;
emit setupReady(); emit setupReady();
} }
......
...@@ -108,7 +108,6 @@ void MainWindow::nextApp(){ ...@@ -108,7 +108,6 @@ void MainWindow::nextApp(){
if(verifyApp()){ if(verifyApp()){
applist.at(step)->valideRoutine(); applist.at(step)->valideRoutine();
closeApp(); closeApp();
if((uint)step < applist.size()-1){ if((uint)step < applist.size()-1){
step++; step++;
loadApp(); loadApp();
......
...@@ -99,7 +99,7 @@ int MaskEdit::selectCorner(QMouseEvent* eMouse){ ...@@ -99,7 +99,7 @@ int MaskEdit::selectCorner(QMouseEvent* eMouse){
if(capture != nullptr && rectPoints != nullptr){ if(capture != nullptr && rectPoints != nullptr){
int margin = 20; int margin = 10;
// x and y relative to the captured frame, not the UI // x and y relative to the captured frame, not the UI
int mouseX = (int)( (float)eMouse->x() * ratioX ); int mouseX = (int)( (float)eMouse->x() * ratioX );
......
...@@ -10,7 +10,7 @@ ProjectionGui::ProjectionGui(SandboxSetup *_setup, MonitorGui *_mg, QWidget *par ...@@ -10,7 +10,7 @@ ProjectionGui::ProjectionGui(SandboxSetup *_setup, MonitorGui *_mg, QWidget *par
ui->setupUi(this); ui->setupUi(this);
ui->lblFrame->setGeometry(0, 0, ui->fContainer->width(), ui->fContainer->height()); ui->lblFrame->setGeometry(0, 0, ui->fContainer->width(), ui->fContainer->height());
blueScreen = new QtFullScreen(mg->getResolution(), false); blueScreen = new QtFullScreen(mg->getResolution(), true, this);
frameTimer = new QTimer(this); frameTimer = new QTimer(this);
connect(frameTimer, &QTimer::timeout, this, &ProjectionGui::refreshFrame); connect(frameTimer, &QTimer::timeout, this, &ProjectionGui::refreshFrame);
...@@ -44,9 +44,7 @@ void ProjectionGui::on_btnStart_clicked() ...@@ -44,9 +44,7 @@ void ProjectionGui::on_btnStart_clicked()
cv::Mat blue = cv::Mat(1, 1, CV_8UC3, cv::Scalar(0, 0, 255)); cv::Mat blue = cv::Mat(1, 1, CV_8UC3, cv::Scalar(0, 0, 255));
blueScreen->setGeometry(mg->getResolution()); blueScreen->setGeometry(mg->getResolution());
blueScreen->imShow(blue); blueScreen->imShow(blue);
cameraUsed = true; cameraUsed = true;
//ui->fContainer->hide();
frameTimer->start(100); frameTimer->start(100);
} }
} }
......
#include "qtfullscreen.h" #include "qtfullscreen.h"
QtFullScreen::QtFullScreen(QRect _resolution, bool _isBorderless, QWidget *parent) : QWidget(parent) QtFullScreen::QtFullScreen(QRect reso, bool _isBorderless, QWidget *parent) : QObject()
{ {
p = parent; p = parent;
win = new QDialog; resolution = new QRect(reso.left(), reso.top(), reso.width(), reso.height());
resolution = &_resolution;
isBorderless = _isBorderless; isBorderless = _isBorderless;
//win->setWindowFlags(Qt::Window);
win = new QDialog(parent);
win->setWindowFlags(Qt::Window);
win->setFocusPolicy(Qt::NoFocus);
win->setGeometry(*resolution); win->setGeometry(*resolution);
image = new QLabel(win); image = new QLabel(win);
...@@ -18,15 +20,7 @@ QtFullScreen::~QtFullScreen() ...@@ -18,15 +20,7 @@ QtFullScreen::~QtFullScreen()
{ {
delete image; delete image;
delete win; delete win;
} delete resolution;
void QtFullScreen::showEvent(QShowEvent* event){
QWidget::showEvent( event );
if(win->parent() != 0)
std::cout << "QtFullScreen showEvent : " << win->parent()->objectName().toStdString() << std::endl;
if(p != nullptr)
p->setFocus();
} }
void QtFullScreen::setGeometry(QRect reso){ void QtFullScreen::setGeometry(QRect reso){
...@@ -45,12 +39,17 @@ void QtFullScreen::imShow(cv::Mat frame){ ...@@ -45,12 +39,17 @@ void QtFullScreen::imShow(cv::Mat frame){
QPixmap px = QPixmap::fromImage(src); QPixmap px = QPixmap::fromImage(src);
image->setPixmap(px); image->setPixmap(px);
if(isBorderless && !win->windowState().testFlag(Qt::WindowFullScreen)){ if(!win->isVisible()){
win->setWindowState(Qt::WindowFullScreen); if(isBorderless){
win->showFullScreen();
}else{
win->show();
}
} }
if(!win->isVisible()) if(p != nullptr)
win->show(); p->setFocus();
} }
void QtFullScreen::close(){ void QtFullScreen::close(){
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
#include <QScreen> #include <QScreen>
#include <QDialog> #include <QDialog>
class QtFullScreen : public QWidget class QtFullScreen : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
...@@ -18,13 +18,6 @@ public: ...@@ -18,13 +18,6 @@ public:
void setGeometry(QRect resolution); void setGeometry(QRect resolution);
void setGeometry(int x, int y, int w, int h); void setGeometry(int x, int y, int w, int h);
signals:
public slots:
protected:
void showEvent(QShowEvent* event);
private: private:
QDialog *win; QDialog *win;
QLabel *image; QLabel *image;
......
...@@ -13,9 +13,9 @@ public: ...@@ -13,9 +13,9 @@ public:
bool getEndState(){ return endSuccess; }; bool getEndState(){ return endSuccess; };
std::string getErrorMessage(){ return error_msg; }; std::string getErrorMessage(){ return error_msg; };
void setErrorMessage(std::string msg){ error_msg = msg; }; void setErrorMessage(std::string msg){ error_msg = msg; };
bool checkRoutine(); virtual bool checkRoutine();
void valideRoutine(); virtual void valideRoutine();
void cancelRoutine(); virtual void cancelRoutine();
signals: signals:
void sendNotif(); void sendNotif();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment