From c7131429c9a2c8675b8da270a3953e28b7add9fa Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sun, 18 Nov 2012 02:20:52 +0100 Subject: [PATCH] CHANGED: #1471 Removing widget properties from the widget properties dialog will now work. --- .../src/plugins/gui_editor/widget_info_tree.h | 8 ++++++ .../gui_editor/widget_info_tree_node.h | 27 +++++++++++++++++++ .../plugins/gui_editor/widget_properties.cpp | 5 ++-- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_tree.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_tree.h index 88101c506..b93dff2cb 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_tree.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_tree.h @@ -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 { diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_tree_node.h b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_tree_node.h index 7e4119055..80d1f5a45 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_tree_node.h +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_info_tree_node.h @@ -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 ) { diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_properties.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_properties.cpp index a6c08f888..09e1e80d2 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_properties.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_properties.cpp @@ -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() ); }