Commit 0b4c141b authored by Hans-Christian Ebke's avatar Hans-Christian Ebke

Core: Added getToolbox method to scripting interface.


git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@15117 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 9cf9935b
......@@ -948,6 +948,15 @@ private slots:
/// Add a Toolbox from a plugin or from scripting (with icon)
void addToolbox(QString _name ,QWidget* _widget, QIcon* _icon);
/**
* Get a toolbox.
*
* @param _pluginName The plugin which the requested toolbox belongs tp.
* @param _toolboxName The name of the requested toolbox.
* @return A pointer to the requested widget if it was found, nullptr, otherwise.
*/
QWidget *getToolbox(QString _pluginName, QString _toolboxName);
private :
//===========================================================================
......
......@@ -217,6 +217,25 @@ void Core::setToolBoxSide(QString _side) {
//-----------------------------------------------------------------------------
QWidget *Core::getToolbox(QString _pluginName, QString _toolboxName) {
std::vector<PluginInfo>::const_iterator pluginIt = plugins_.end();
for (std::vector<PluginInfo>::const_iterator it = plugins_.begin(), it_end = plugins_.end(); it != it_end; ++it) {
if (it->name == _pluginName) {
pluginIt = it;
}
}
if (pluginIt == plugins_.end()) return 0;
std::vector<std::pair<QString , QWidget*> >::const_iterator widgetIt;
for (std::vector<std::pair<QString , QWidget*> >::const_iterator it = pluginIt->toolboxWidgets.begin(), it_end = pluginIt->toolboxWidgets.end();
it != it_end; ++it) {
if (it->first == _toolboxName)
return it->second;
}
return 0;
}
void Core::addToolbox(QString _name ,QWidget* _widget) {
int id = -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment