From f31af3d95bf46bc30710171c0f3841b02a5bda9c Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Sat, 17 Nov 2012 20:13:29 +0100 Subject: [PATCH] CHANGED: #1471 Removing widgets from the widget properties dialog will now work. --HG-- branch : gsoc2012-gui-editor --- .../src/plugins/gui_editor/widget_info_tree.h | 12 +++++++++--- .../src/plugins/gui_editor/widget_info_tree_node.h | 2 +- .../src/plugins/gui_editor/widget_properties.cpp | 6 ++---- 3 files changed, 12 insertions(+), 8 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 020639b9b..88101c506 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 @@ -62,10 +62,10 @@ namespace GUIEditor return true; } - /// Finds a node and removes it - bool removeNode( SWidgetInfo *info ) + /// Finds a node by it's name and removes it + bool removeNode( const std::string &name ) { - CWidgetInfoTreeNode *node = findNodeByName( info->name ); + CWidgetInfoTreeNode *node = findNodeByName( name ); if( node == NULL ) return false; @@ -78,6 +78,12 @@ namespace GUIEditor 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 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 6e4c69c59..7e4119055 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 @@ -85,8 +85,8 @@ namespace GUIEditor { if( ( *itr )->getInfo().name == name ) { - children.erase( itr ); delete ( *itr ); + children.erase( itr ); return true; } } 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 9012bf323..a6c08f888 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 @@ -67,10 +67,8 @@ namespace GUIEditor{ if( reply != QMessageBox::Yes ) return; - /* - Remove the damned thing here - */ - + tree->removeNode( widgetName.toStdString() ); + widgetPropTree->clear(); buildWidgetList(); }