Skip to content

Commit

Permalink
[tool] load parameters before initializing so they are available onIn…
Browse files Browse the repository at this point in the history
…itialize
  • Loading branch information
jcmonteiro authored and João Carlos Espiúca Monteiro committed Dec 16, 2020
1 parent 2fe6d33 commit 462d717
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/rviz/tool_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ void ToolManager::load(const Config& config)
QString class_id;
if (tool_config.mapGetString("Class", &class_id))
{
Tool* tool = addTool(class_id);
tool->load(tool_config);
Tool* tool = addTool(class_id, tool_config);
}
}
}
Expand Down Expand Up @@ -220,7 +219,7 @@ void rviz::ToolManager::closeTool()
setCurrentTool(getDefaultTool());
}

Tool* ToolManager::addTool(const QString& class_id)
Tool* ToolManager::addTool(const QString& class_id, const Config& config)
{
QString error;
bool failed = false;
Expand All @@ -234,6 +233,7 @@ Tool* ToolManager::addTool(const QString& class_id)
tools_.append(tool);
tool->setName(addSpaceToCamelCase(factory_->getClassName(class_id)));
tool->setIcon(factory_->getIcon(class_id));
tool->load(config);
tool->initialize(context_);

if (tool->getShortcutKey() != '\0')
Expand Down
2 changes: 1 addition & 1 deletion src/rviz/tool_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class RVIZ_EXPORT ToolManager : public QObject
}

/** @brief Create a tool by class lookup name, add it to the list, and return it. */
Tool* addTool(const QString& tool_class_lookup_name);
Tool* addTool(const QString& tool_class_lookup_name, const Config& config = Config());

/**
* \brief Return the tool currently in use.
Expand Down

0 comments on commit 462d717

Please sign in to comment.