diff --git a/src/labels.cpp b/src/labels.cpp index 0ad37d2..e586e2c 100644 --- a/src/labels.cpp +++ b/src/labels.cpp @@ -28,6 +28,12 @@ LabelInfo::LabelInfo(QString name, QString categorie, int id, int id_categorie, shortcut = nullptr; } +LabelInfo::~LabelInfo() { + + delete item; + delete shortcut; +} + void LabelInfo::read(const QJsonObject &json) { id = json["id"].toInt(); name = json["name"].toString(); diff --git a/src/labels.h b/src/labels.h index bd93ef1..a586353 100644 --- a/src/labels.h +++ b/src/labels.h @@ -18,6 +18,8 @@ class LabelInfo { LabelInfo(QString name, QString categorie, int id, int id_categorie, QColor color); void read(const QJsonObject &json); void write(QJsonObject &json) const; + + ~LabelInfo(); }; class Name2Labels : public QMap { diff --git a/src/main_window.cpp b/src/main_window.cpp index 7283136..ef40692 100644 --- a/src/main_window.cpp +++ b/src/main_window.cpp @@ -44,6 +44,11 @@ MainWindow::MainWindow(QWidget *parent, Qt::WindowFlags flags) undo_action->setEnabled(false); redo_action->setEnabled(false); + watershed_shortcut = new QShortcut(QKeySequence("Ctrl+F"), this); + connect(watershed_shortcut, SIGNAL(activated()), this, SLOT(runWatershed())); + button_watershed->setText(button_watershed->text() + + QString("(%1)").arg(watershed_shortcut->key().toString())); + menuFile->addAction(save_action); menuEdit->addAction(close_tab_action); menuEdit->addAction(undo_action); diff --git a/src/main_window.h b/src/main_window.h index d2fe33d..703c2fb 100644 --- a/src/main_window.h +++ b/src/main_window.h @@ -54,6 +54,8 @@ class MainWindow : public QMainWindow, public Ui::MainWindow { QAction * swap_action; QAction * redo_action ; QString curr_open_dir; + QShortcut * watershed_shortcut; + public: QString currentDir() const; QString currentFile() const;