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

--HG--
branch : gsoc2012-gui-editor
This commit is contained in:
dfighter1985 2012-11-18 02:20:52 +01:00
parent f31af3d95b
commit 3c854dc1e2
3 changed files with 37 additions and 3 deletions

View file

@ -84,6 +84,14 @@ namespace GUIEditor
return removeNode( info->name );
}
/// Removes this property from all of the nodes
void removePropertyFromAll( const SPropEntry &prop )
{
if( root == NULL )
return;
root->removePropertyFromAll( prop );
}
/// Get the node names and put them into the vector
void getNames( std::vector< std::string > &v ) const
{

View file

@ -144,6 +144,33 @@ namespace GUIEditor
info.props.push_back( prop );
}
/// Removes this property from the node
void removeProperty( const SPropEntry &prop )
{
std::vector< SPropEntry >::const_iterator itr = info.props.begin();
while( itr != info.props.end() )
{
if( ( itr->propName == prop.propName ) &&
( itr->propType == prop.propType ) &&
( itr->propDefault == prop.propDefault ) )
break;
++itr;
}
if( itr != info.props.end() )
info.props.erase( itr );
}
/// Removes this property from all of the nodes recursively
void removePropertyFromAll( const SPropEntry &prop )
{
removeProperty( prop );
for( std::vector< CWidgetInfoTreeNode* >::iterator itr = children.begin(); itr != children.end(); ++itr )
{
( *itr )->removePropertyFromAll( prop );
}
}
/// Find the node by it's name and then return a pointer to it
CWidgetInfoTreeNode* findNodeByName( const std::string &name )
{

View file

@ -95,9 +95,8 @@ namespace GUIEditor{
if( reply != QMessageBox::Yes )
return;
/*
Remove the damned thing here
*/
SPropEntry prop = *itr;
tree->removePropertyFromAll( prop );
onListSelectionChanged( widgetList->currentRow() );
}