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