diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index 4640931f5..8cc43cc9d 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -3181,9 +3181,13 @@ namespace NLGUI prev->setEditorSelected( false ); } e->setEditorSelected( true ); - currentEditorSelection = name; - notifySelectionWatchers(); } + else + if( !name.empty() ) + return; + + currentEditorSelection = name; + notifySelectionWatchers(); } void CWidgetManager::notifySelectionWatchers() diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_message_processor.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_message_processor.cpp index 944ce945a..36e3481e0 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_message_processor.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/editor_message_processor.cpp @@ -50,7 +50,9 @@ namespace GUIEditor return; if( g->delElement( e ) ) + { CWidgetManager::getInstance()->setCurrentEditorSelection( "" ); + } } } diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/property_browser_ctrl.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/property_browser_ctrl.cpp index 1612ea803..3c5fa9177 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/property_browser_ctrl.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/property_browser_ctrl.cpp @@ -78,7 +78,12 @@ namespace GUIEditor CInterfaceElement *e = CWidgetManager::getInstance()->getElementFromId( id ); if( e == NULL ) + { + connect( propertyMgr, SIGNAL( propertyChanged( QtProperty* ) ), + this, SLOT( onPropertyChanged( QtProperty* ) ) ); + return; + } currentElement = id; diff --git a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.cpp b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.cpp index b7485baa4..96ae10aa3 100644 --- a/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.cpp +++ b/code/nel/tools/3d/object_viewer_qt/src/plugins/gui_editor/widget_hierarchy.cpp @@ -144,14 +144,47 @@ namespace GUIEditor if( newSelection == currentSelection ) return; + if( newSelection.empty() ) + { + if( widgetHT->currentItem() != NULL ) + { + QTreeWidgetItem *item = widgetHT->currentItem(); + QTreeWidgetItem *p = item; + + // Deselect item + item->setSelected( false ); + widgetHT->setCurrentItem( NULL ); + + // Collapse the tree + while( p != NULL ) + { + p->setExpanded( false ); + p = p->parent(); + } + + // Finally remove the item! + delete item; + item = NULL; + + std::map< std::string, QTreeWidgetItem* >::iterator itr = + widgetHierarchyMap.find( currentSelection ); + if( itr != widgetHierarchyMap.end() ) + widgetHierarchyMap.erase( itr ); + currentSelection = ""; + } + return; + } + std::map< std::string, QTreeWidgetItem* >::iterator itr = widgetHierarchyMap.find( newSelection ); if( itr == widgetHierarchyMap.end() ) return; + // deselect current item if( widgetHT->currentItem() != NULL ) widgetHT->currentItem()->setSelected( false ); + // expand the tree items, so that we can see the selected item QTreeWidgetItem *item = itr->second; QTreeWidgetItem *currItem = item; while( currItem != NULL ) @@ -160,8 +193,10 @@ namespace GUIEditor currItem = currItem->parent(); } + // select the current item item->setSelected( true ); widgetHT->setCurrentItem( item ); + currentSelection = newSelection; } void WidgetHierarchy::onItemDblClicked( QTreeWidgetItem *item )