From ec8a7522b275aec7f9c46e3eec841de767ff76e7 Mon Sep 17 00:00:00 2001 From: dfighter1985 Date: Tue, 2 Sep 2014 23:07:55 +0200 Subject: [PATCH] Implemented remove button. --HG-- branch : dfighter-tools --- .../georges_editor/georges_typ_dialog.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/code/studio/src/plugins/georges_editor/georges_typ_dialog.cpp b/code/studio/src/plugins/georges_editor/georges_typ_dialog.cpp index 8305bfbbf..c3ea462ec 100644 --- a/code/studio/src/plugins/georges_editor/georges_typ_dialog.cpp +++ b/code/studio/src/plugins/georges_editor/georges_typ_dialog.cpp @@ -59,6 +59,23 @@ void GeorgesTypDialog::onAddClicked() void GeorgesTypDialog::onRemoveClicked() { + QTreeWidgetItem *item = m_ui.tree->currentItem(); + if( item == NULL ) + return; + + int i = 0; + for( i = 0; i < m_ui.tree->topLevelItemCount(); i++ ) + { + if( item == m_ui.tree->topLevelItem( i ) ) + break; + } + + m_ui.tree->takeTopLevelItem( i ); + delete item; + + std::vector< NLGEORGES::CType::CDefinition >::iterator itr = m_pvt->typ->Definitions.begin() + i; + m_pvt->typ->Definitions.erase( itr ); + } void GeorgesTypDialog::setupConnections()