@@ -34,6 +34,8 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags)
34
34
swap_action = new QAction (tr (" &Swap check box Watershed" ), this );
35
35
undo_action = new QAction (tr (" &Undo" ), this );
36
36
redo_action = new QAction (tr (" &Redo" ), this );
37
+ next_file_action = new QAction (tr (" &Select next file" ), this );
38
+ previous_file_action = new QAction (tr (" &Select previous file" ), this );
37
39
undo_action->setShortcuts (QKeySequence::Undo);
38
40
redo_action->setShortcuts (QKeySequence::Redo);
39
41
save_action->setShortcut (Qt::CTRL + Qt::Key_S);
@@ -42,6 +44,8 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags)
42
44
paste_mask_action->setShortcut (Qt::CTRL + Qt::Key_V);
43
45
clear_mask_action->setShortcut (Qt::CTRL + Qt::Key_R);
44
46
close_tab_action->setShortcut (Qt::CTRL + Qt::Key_W);
47
+ next_file_action->setShortcut (Qt::CTRL + Qt::SHIFT + Qt::Key_Down);
48
+ previous_file_action->setShortcut (Qt::CTRL + Qt::SHIFT + Qt::Key_Up);
45
49
undo_action->setEnabled (false );
46
50
redo_action->setEnabled (false );
47
51
@@ -53,6 +57,8 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags)
53
57
menuEdit->addAction (paste_mask_action);
54
58
menuEdit->addAction (clear_mask_action);
55
59
menuEdit->addAction (swap_action);
60
+ menuEdit->addAction (next_file_action);
61
+ menuEdit->addAction (previous_file_action);
56
62
57
63
tabWidget->clear ();
58
64
@@ -64,6 +70,8 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags)
64
70
connect (copy_mask_action , SIGNAL (triggered ()) , this , SLOT (copyMask ()));
65
71
connect (paste_mask_action , SIGNAL (triggered ()) , this , SLOT (pasteMask ()));
66
72
connect (clear_mask_action , SIGNAL (triggered ()) , this , SLOT (clearMask ()));
73
+ connect (next_file_action , SIGNAL (triggered ()) , this , SLOT (nextFile ()));
74
+ connect (previous_file_action , SIGNAL (triggered ()) , this , SLOT (previousFile ()));
67
75
connect (tabWidget , SIGNAL (tabCloseRequested (int )) , this , SLOT (closeTab (int ) ));
68
76
connect (tabWidget , SIGNAL (currentChanged (int )) , this , SLOT (updateConnect (int )));
69
77
connect (tree_widget_img , SIGNAL (itemClicked (QTreeWidgetItem *,int )), this , SLOT (treeWidgetClicked ()));
@@ -365,6 +373,23 @@ void MainWindow::on_actionOpenDir_triggered() {
365
373
// setWindowTitle("PixelAnnotation - " + openedDir);
366
374
}
367
375
376
+ void MainWindow::nextFile () {
377
+ QTreeWidgetItem *currentItem = tree_widget_img->currentItem ();
378
+ if (!currentItem) return ;
379
+ QTreeWidgetItem *nextItem = tree_widget_img->itemBelow (currentItem);
380
+ if (!nextItem) return ;
381
+ tree_widget_img->setCurrentItem (nextItem);
382
+ treeWidgetClicked ();
383
+ }
384
+
385
+ void MainWindow::previousFile () {
386
+ QTreeWidgetItem *currentItem = tree_widget_img->currentItem ();
387
+ if (!currentItem) return ;
388
+ QTreeWidgetItem *previousItem = tree_widget_img->itemAbove (currentItem);
389
+ if (!previousItem) return ;
390
+ tree_widget_img->setCurrentItem (previousItem);
391
+ treeWidgetClicked ();
392
+ }
368
393
369
394
void MainWindow::saveConfigFile () {
370
395
QString file = QFileDialog::getSaveFileName (this , tr (" Save Config File" ), QString (), tr (" JSon file (*.json)" ));
0 commit comments