Skip to content

Commit

Permalink
Added hotkey for plugin remove (Ctrl + X)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjb0026 committed Aug 11, 2024
1 parent d2242ed commit 997aa20
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions mapviz/include/mapviz/mapviz.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <QWidget>
#include <QStringList>
#include <QMainWindow>
#include <QShortcut>

#include <swri_transform_util/transform_manager.h>
#include <mapviz_interfaces/srv/add_mapviz_display.hpp> // Service
Expand Down
2 changes: 2 additions & 0 deletions mapviz/src/config_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ namespace mapviz
ui_.setupUi(this);

edit_name_action_ = new QAction("Edit Name", this);
edit_name_action_->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_R));
remove_item_action_ = new QAction("Remove", this);
remove_item_action_->setIcon(QIcon(":/images/remove-icon-th.png"));
remove_item_action_->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_X));

connect(edit_name_action_, SIGNAL(triggered()), this, SLOT(EditName()));
connect(remove_item_action_, SIGNAL(triggered()), this, SLOT(Remove()));
Expand Down
6 changes: 6 additions & 0 deletions mapviz/src/mapviz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,12 @@ Mapviz::Mapviz(bool is_standalone, int argc, char** argv, QWidget *parent, Qt::W

ui_.bg_color->setColor(background_);
canvas_->SetBackground(background_);

// Keyboard shortcuts for the main window
/* QShortcut * edit_display_name_shortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_R), this); */
/* connect(edit_display_name_shortcut, SIGNAL(activated()), this, SLOT()); */
QShortcut * remove_display_shortcut = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_X), this);
connect(remove_display_shortcut, SIGNAL(activated()), this, SLOT(RemoveDisplay()));
}

Mapviz::~Mapviz()
Expand Down

0 comments on commit 997aa20

Please sign in to comment.