Merge pull request #38 from Blatoy/remove-image-shortcut
Add a shortcut to remove images
This commit is contained in:
commit
ab7ed4b83f
@ -102,6 +102,7 @@ To minimize wrist strain when labeling, I adopted the method **"twice left butto
|
||||
| `W` | Prev Label <br> ![ezgif-5-ee915c66dad8](https://user-images.githubusercontent.com/35001605/47703191-d39d3080-dc62-11e8-800b-986ec214b80c.gif) |
|
||||
| `Ctrl + S` | Save |
|
||||
| `Ctrl + C` | Delete all existing bounding boxes in the image |
|
||||
| `Ctrl + D` | Delete current image |
|
||||
|
||||
| Mouse | Action |
|
||||
|---|:---:|
|
||||
|
@ -29,6 +29,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
connect(new QShortcut(QKeySequence(Qt::Key_A), this), SIGNAL(activated()), this, SLOT(prev_img()));
|
||||
connect(new QShortcut(QKeySequence(Qt::Key_D), this), SIGNAL(activated()), this, SLOT(next_img()));
|
||||
connect(new QShortcut(QKeySequence(Qt::Key_Space), this), SIGNAL(activated()), this, SLOT(next_img()));
|
||||
connect(new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_D), this), SIGNAL(activated()), this, SLOT(remove_img()));
|
||||
|
||||
init_table_widget();
|
||||
}
|
||||
@ -182,6 +183,32 @@ void MainWindow::clear_label_data()
|
||||
ui->label_image->showImage();
|
||||
}
|
||||
|
||||
void MainWindow::remove_img()
|
||||
{
|
||||
if(m_imgList.size() > 0) {
|
||||
//remove a image
|
||||
QFile::remove(m_imgList.at(m_imgIndex));
|
||||
|
||||
//remove a txt file
|
||||
QString qstrOutputLabelData = get_labeling_data(m_imgList.at(m_imgIndex));
|
||||
QFile::remove(qstrOutputLabelData);
|
||||
|
||||
m_imgList.removeAt(m_imgIndex);
|
||||
|
||||
if(m_imgList.size() == 0)
|
||||
{
|
||||
pjreddie_style_msgBox(QMessageBox::Information,"End", "In directory, there are not any image. program quit.");
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
else if( m_imgIndex == m_imgList.size())
|
||||
{
|
||||
m_imgIndex --;
|
||||
}
|
||||
|
||||
goto_img(m_imgIndex);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::next_label()
|
||||
{
|
||||
set_label(m_objIndex + 1);
|
||||
@ -377,26 +404,7 @@ void MainWindow::on_pushButton_save_clicked()
|
||||
|
||||
void MainWindow::on_pushButton_remove_clicked()
|
||||
{
|
||||
//remove a image
|
||||
QFile::remove(m_imgList.at(m_imgIndex));
|
||||
|
||||
//remove a txt file
|
||||
QString qstrOutputLabelData = get_labeling_data(m_imgList.at(m_imgIndex));
|
||||
QFile::remove(qstrOutputLabelData);
|
||||
|
||||
m_imgList.removeAt(m_imgIndex);
|
||||
|
||||
if(m_imgList.size() == 0)
|
||||
{
|
||||
pjreddie_style_msgBox(QMessageBox::Information,"End", "In directory, there are not any image. program quit.");
|
||||
QCoreApplication::quit();
|
||||
}
|
||||
else if( m_imgIndex == m_imgList.size())
|
||||
{
|
||||
m_imgIndex --;
|
||||
}
|
||||
|
||||
goto_img(m_imgIndex);
|
||||
remove_img();
|
||||
}
|
||||
|
||||
void MainWindow::on_tableWidget_label_cellDoubleClicked(int row, int column)
|
||||
|
@ -36,6 +36,7 @@ private slots:
|
||||
void prev_img(bool bSavePrev = true);
|
||||
void save_label_data() const;
|
||||
void clear_label_data();
|
||||
void remove_img();
|
||||
|
||||
void next_label();
|
||||
void prev_label();
|
||||
|
Loading…
Reference in New Issue
Block a user