diff --git a/Core/Core.cc b/Core/Core.cc index 8d102e69868c023d8cd3e6ebd8273f2330f5e510..c11c7ff165d703cf8d29fe5bdf28239f6b6e2873 100644 --- a/Core/Core.cc +++ b/Core/Core.cc @@ -1126,27 +1126,40 @@ void Core::setDescriptions(){ emit setSlotDescription("loadObject()", "Show the dialog to load an object. (only works if GUI is available)",QStringList(), QStringList()); emit setSlotDescription("loadSettings()", "Show the dialog to load settings. (only works if GUI is available)",QStringList(), QStringList()); emit setSlotDescription("loadSettings(QString)", "load settings from file.",QStringList(), QStringList()); - emit setSlotDescription("createWidget(QString,QString);", "Create a widget from an ui file", + + emit setSlotDescription("createWidget(QString,QString)", "Create a widget from an ui file", QString("Object name,ui file").split(","), QString("Name of the new widget in script,ui file to load").split(",")); + emit setSlotDescription("addToolbox(QString,QWidget*)", "Add a widget as a toolbox", + QString("Toolbox Entry name,Widget").split(","), + QString("Name of the new widget in the toolbox,Pointer to the new widget").split(",")); } -void Core::slotAddToolbox(QString _name ,QWidget* _widget) { +void Core::addToolbox(QString _name ,QWidget* _widget) { int id = -1; for ( uint i = 0 ; i < plugins.size(); ++i ) { if ( plugins[i].plugin == sender() ) { id = i; - std::cerr << "Found" << std::endl; break; } } if ( id == -1 ) { - std::cerr << "Unknown sender plugin when adding Toolbox!" << std::endl; - return; + for ( uint i = 0 ; i < plugins.size(); ++i ) { + if ( plugins[i].name == "Scripting" ) { + id = i; + break; + } + } + + + if ( id == -1 ) { + std::cerr << "Unknown sender plugin when adding Toolbox!" << std::endl; + return; + } } plugins[id].widgets.push_back( std::pair< QString,QWidget* >( _name , _widget) ); diff --git a/Core/Core.hh b/Core/Core.hh index 6931a28a9a21ce9d5c99865210a57216001cb800..2902c27b5f7f7f4d58d2f2f21a19297a99351d2e 100644 --- a/Core/Core.hh +++ b/Core/Core.hh @@ -401,9 +401,6 @@ private: /// The current Toolbox item has changed // void slotToolboxSwitched(int _index); - /// Add a Toolbox from a plugin - void slotAddToolbox(QString _name ,QWidget* _widget); - /// Slot adding empty object from Menu void slotAddEmptyObjectMenu(); @@ -415,6 +412,11 @@ private: /// Open Recent file void slotRecentOpen(QAction* _action); + + public slots: + + /// Add a Toolbox from a plugin or from scripting + void addToolbox(QString _name ,QWidget* _widget); private : diff --git a/Core/PluginLoader.cc b/Core/PluginLoader.cc index 3453a0ffc2e6543a3da28136c62a3840bf30adce..630c523504923fd5df2e395473c7b6e40b788de6 100644 --- a/Core/PluginLoader.cc +++ b/Core/PluginLoader.cc @@ -605,7 +605,7 @@ void Core::loadPlugin(QString filename, bool silent){ if ( checkSignal(plugin, "addToolbox(QString,QWidget*)")) connect(plugin, SIGNAL( addToolbox(QString,QWidget*) ), - this, SLOT( slotAddToolbox(QString,QWidget*) ),Qt::DirectConnection ); + this, SLOT( addToolbox(QString,QWidget*) ),Qt::DirectConnection );