Skip to content

Commit 4aacb79

Browse files
Handle Tool::Finished returned by processKeyEvent (#1257) (#1264)
(cherry picked from commit 37cf805) Co-authored-by: Patrick Roncagliolo <[email protected]>
1 parent 49c68a7 commit 4aacb79

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
@@ -157,6 +157,7 @@ void ToolManager::handleChar(QKeyEvent * event, RenderPanel * panel)
157157
tool = shortkey_to_tool_map_[event->key()];
158158
}
159159

160+
int flags = 0;
160161
if (tool) {
161162
// if there is a incoming tool check if it matches the current tool
162163
if (current_tool_ == tool) {
@@ -166,7 +167,7 @@ void ToolManager::handleChar(QKeyEvent * event, RenderPanel * panel)
166167
// if no, check if the current tool accesses all key events
167168
if (current_tool_->accessAllKeys()) {
168169
// if yes, pass the key
169-
current_tool_->processKeyEvent(event, panel);
170+
flags = current_tool_->processKeyEvent(event, panel);
170171
} else {
171172
// if no, switch the tool
172173
setCurrentTool(tool);
@@ -175,7 +176,11 @@ void ToolManager::handleChar(QKeyEvent * event, RenderPanel * panel)
175176
} else {
176177
// if the incoming key triggers no other tool,
177178
// just hand down the key event
178-
current_tool_->processKeyEvent(event, panel);
179+
flags = current_tool_->processKeyEvent(event, panel);
180+
}
181+
182+
if (flags & Tool::Finished) {
183+
setCurrentTool(getDefaultTool());
179184
}
180185
}
181186

0 commit comments

Comments
 (0)