working on enable/disable keys

This commit is contained in:
lostjared
2018-11-16 15:16:21 -08:00
parent f0b4f44970
commit 445d183153
2 changed files with 20 additions and 0 deletions

View File

@@ -110,6 +110,7 @@ void ChromaWindow::createControls() {
connect(color_okay, SIGNAL(clicked()), this, SLOT(colorSet())); connect(color_okay, SIGNAL(clicked()), this, SLOT(colorSet()));
connect(lowButton, SIGNAL(clicked()), this, SLOT(setColorLow())); connect(lowButton, SIGNAL(clicked()), this, SLOT(setColorLow()));
connect(highButton, SIGNAL(clicked()), this, SLOT(setColorHigh())); connect(highButton, SIGNAL(clicked()), this, SLOT(setColorHigh()));
connect(keys_enabled, SIGNAL(clicked()), this, SLOT(toggleKey()));
} }
@@ -251,3 +252,20 @@ void ChromaWindow::setColorHigh() {
} }
} }
void ChromaWindow::enableKey(bool op) {
if(op) {
if(colorkeys_vec.size()==0) {
QMessageBox::information(this, "Needs a Key", "Please set a key to enable this feature");
keys_enabled->setChecked(false);
return;
}
}
}
void ChromaWindow::toggleKey() {
if(keys_enabled->isChecked()) {
enableKey(true);
} else {
enableKey(false);
}
}

View File

@@ -11,6 +11,7 @@ public:
bool checkInput(cv::Vec3b &low, cv::Vec3b &high); bool checkInput(cv::Vec3b &low, cv::Vec3b &high);
bool checkEdit(QLineEdit *edit); bool checkEdit(QLineEdit *edit);
void setEditFromColor(int val, QColor color); void setEditFromColor(int val, QColor color);
void enableKey(bool op);
public slots: public slots:
void openColorSelectRange(); void openColorSelectRange();
void openColorSelectTolerance(); void openColorSelectTolerance();
@@ -20,6 +21,7 @@ public slots:
void setColorLow(); void setColorLow();
void setColorHigh(); void setColorHigh();
void setImage(); void setImage();
void toggleKey();
private: private:
void createControls(); void createControls();
QRadioButton *button_select_range, *button_select_tolerance; QRadioButton *button_select_range, *button_select_tolerance;