Commit 77837c69 authored by Martin Schultz's avatar Martin Schultz

Fixed the Datacontrol update bug by adding a new signal / slot that updates...

Fixed the Datacontrol update bug by adding a new signal / slot that updates all objects in the group.
parent cfcd9c6e
......@@ -208,6 +208,7 @@ void DataControlPlugin::initializePlugin()
connect( tool_->targetSelected, SIGNAL(toggled ( bool ) ),
this, SLOT (slotBoundingBoxChange ( ) ));
connect( this, SIGNAL(objectsGrouped(IdList)), this, SLOT(slotObjectsGrouped(IdList)),Qt::QueuedConnection);
viewHeader_ = tool_->treeView->header();
viewHeader_->setContextMenuPolicy(Qt::CustomContextMenu);
......@@ -241,6 +242,26 @@ void DataControlPlugin::initializePlugin()
emit addToolbox("Data Control", tool_, toolIcon_, headerAreaWidget);
}
//******************************************************************************
/** \brief update objects when they have been grouped
*
*/
void DataControlPlugin::slotObjectsGrouped(IdList _lst)
{
// Get all selected rows
int selectedRows = _lst.size();
//update each item
for(int i = 0 ; i < selectedRows ; ++i)
{
int id = _lst[i];
BaseObject* item = 0;
if ( id != -1 && PluginFunctions::getObject(id,item) )
emit updatedObject(item->id(),UPDATE_ALL);
}
}
//******************************************************************************
......
......@@ -112,6 +112,8 @@ class DataControlPlugin : public QObject, BaseInterface, ToolboxInterface, KeyIn
// ToolboxInterface
void addToolbox( QString _name , QWidget* _widget, QIcon* _icon, QWidget *_headerAreaWidget);
void objectsGrouped(IdList);
private slots :
// BaseInterface
void initializePlugin();
......@@ -137,6 +139,8 @@ class DataControlPlugin : public QObject, BaseInterface, ToolboxInterface, KeyIn
// Tell system that this plugin runs without ui
void noguiSupported( ) {} ;
void slotObjectsGrouped(IdList _lst);
public :
/// Constructor
......
......@@ -401,10 +401,16 @@ int DataControlPlugin::groupObjects(IdList _objectIDs, QString _groupName) {
groupItem->setParent(parent);
}
IdList ids;
//append new children to group
for ( int i = 0 ; i < objs.size() ; ++i) {
for ( int i = 0 ; i < objs.size() ; ++i)
{
(objs[i])->setParent(groupItem);
ids.push_back((objs[i])->id());
}
emit objectsGrouped(ids);
emit updatedObject(groupId,UPDATE_ALL);
return groupId;
}
......
......@@ -58,7 +58,6 @@
#include <ObjectTypes/Light/LightWidget.hh>
//******************************************************************************
/** \brief Slot for Remove action in ContextMenu
......@@ -167,8 +166,11 @@ void DataControlPlugin::slotGroup() {
for (int i = 0; i < indexList.size(); ++i)
ids.push_back( model_->itemId(indexList[i]) );
//group all objects
groupObjects(ids);
emit objectsGrouped(ids);
}
......@@ -413,7 +415,7 @@ void DataControlPlugin::slotHeaderCustomContextMenuRequested ( const QPoint & _p
//******************************************************************************
/** \brief show a rename dialog for object names
*
*
*/
void DataControlPlugin::slotRename(){
QItemSelectionModel* selection = view_->selectionModel();
......
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