CHANGED: #1471 Removing widgets from the widget properties dialog will now work.

--HG--
branch : gsoc2012-gui-editor
This commit is contained in:
dfighter1985 2012-11-17 20:13:29 +01:00
parent 2cebadaa79
commit f31af3d95b
3 changed files with 12 additions and 8 deletions

View file

@ -62,10 +62,10 @@ namespace GUIEditor
return true; return true;
} }
/// Finds a node and removes it /// Finds a node by it's name and removes it
bool removeNode( SWidgetInfo *info ) bool removeNode( const std::string &name )
{ {
CWidgetInfoTreeNode *node = findNodeByName( info->name ); CWidgetInfoTreeNode *node = findNodeByName( name );
if( node == NULL ) if( node == NULL )
return false; return false;
@ -78,6 +78,12 @@ namespace GUIEditor
return true; return true;
} }
/// Finds a node by it's info entry and removes it
bool removeNode( SWidgetInfo *info )
{
return removeNode( info->name );
}
/// Get the node names and put them into the vector /// Get the node names and put them into the vector
void getNames( std::vector< std::string > &v ) const void getNames( std::vector< std::string > &v ) const
{ {

View file

@ -85,8 +85,8 @@ namespace GUIEditor
{ {
if( ( *itr )->getInfo().name == name ) if( ( *itr )->getInfo().name == name )
{ {
children.erase( itr );
delete ( *itr ); delete ( *itr );
children.erase( itr );
return true; return true;
} }
} }

View file

@ -67,10 +67,8 @@ namespace GUIEditor{
if( reply != QMessageBox::Yes ) if( reply != QMessageBox::Yes )
return; return;
/* tree->removeNode( widgetName.toStdString() );
Remove the damned thing here widgetPropTree->clear();
*/
buildWidgetList(); buildWidgetList();
} }