mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-17 04:51:52 +00:00
Reparent items in widget hierarchy instead of deleting and creating a new item...
--HG-- branch : dfighter-tools
This commit is contained in:
parent
97ddd3573d
commit
5d5bf860d4
1 changed files with 3 additions and 8 deletions
|
@ -269,21 +269,16 @@ namespace GUIEditor
|
|||
if( ( newParent == NULL ) || ( item == NULL ) )
|
||||
return;
|
||||
|
||||
// Remove old item
|
||||
// Remove item from old parent
|
||||
QTreeWidgetItem *p = item->parent();
|
||||
if( p != NULL )
|
||||
p->setExpanded( false );
|
||||
id = item->data( 0, Qt::DisplayRole ).toString();
|
||||
delete item;
|
||||
item = NULL;
|
||||
p->removeChild( item );
|
||||
|
||||
// Remove reference to old item
|
||||
widgetHierarchyMap.erase( oldid );
|
||||
|
||||
// Add new item
|
||||
item = new QTreeWidgetItem();
|
||||
item->setData( 0, Qt::DisplayRole, id );
|
||||
item->setSelected( true );
|
||||
// Add item to new parent
|
||||
newParent->addChild( item );
|
||||
|
||||
// Add reference to new item
|
||||
|
|
Loading…
Reference in a new issue