Skip to content

Commit 37cf805

Browse files
authored
Handle Tool::Finished returned by processKeyEvent (#1257)
1 parent a72ef90 commit 37cf805

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

rviz_common/src/rviz_common/tool_manager.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ void ToolManager::handleChar(QKeyEvent * event, RenderPanel * panel)
158158
tool = shortkey_to_tool_map_[event->key()];
159159
}
160160

161+
int flags = 0;
161162
if (tool) {
162163
// if there is a incoming tool check if it matches the current tool
163164
if (current_tool_ == tool) {
@@ -167,7 +168,7 @@ void ToolManager::handleChar(QKeyEvent * event, RenderPanel * panel)
167168
// if no, check if the current tool accesses all key events
168169
if (current_tool_->accessAllKeys()) {
169170
// if yes, pass the key
170-
current_tool_->processKeyEvent(event, panel);
171+
flags = current_tool_->processKeyEvent(event, panel);
171172
} else {
172173
// if no, switch the tool
173174
setCurrentTool(tool);
@@ -176,7 +177,11 @@ void ToolManager::handleChar(QKeyEvent * event, RenderPanel * panel)
176177
} else {
177178
// if the incoming key triggers no other tool,
178179
// just hand down the key event
179-
current_tool_->processKeyEvent(event, panel);
180+
flags = current_tool_->processKeyEvent(event, panel);
181+
}
182+
183+
if (flags & Tool::Finished) {
184+
setCurrentTool(getDefaultTool());
180185
}
181186
}
182187

0 commit comments

Comments
 (0)