FIXED: #1471 LinkList should update the edited item's display when the editor is finished.

This commit is contained in:
dfighter1985 2012-07-25 22:10:23 +02:00
parent f608e3a780
commit 0bd53bf1b6
4 changed files with 30 additions and 1 deletions

View file

@ -76,6 +76,8 @@ namespace GUIEditor
data.cond = condEdit->text().toStdString();
parser->updateLinkData( data.id, data );
Q_EMIT okClicked();
hide();
}
}

View file

@ -32,6 +32,9 @@ namespace GUIEditor
void setup();
void setLinkId( uint32 linkId );
Q_SIGNALS:
void okClicked();
private Q_SLOTS:
void onOKButtonClicked();

View file

@ -41,6 +41,8 @@ namespace GUIEditor
connect( linkTree, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ),
this, SLOT( onItemDblClicked( QTreeWidgetItem* ) ) );
connect( linkEditor, SIGNAL( okClicked() ), this, SLOT( onEditorFinished() ) );
}
LinkList::~LinkList()
@ -50,6 +52,8 @@ namespace GUIEditor
void LinkList::onGUILoaded()
{
linkTree->clear();
const std::map< uint32, SLinkData > &linkMap =
CWidgetManager::getInstance()->getParser()->getLinkMap();
@ -125,7 +129,6 @@ namespace GUIEditor
void LinkList::onEditButtonClicked()
{
QTreeWidgetItem *item =
linkTree->currentItem();
if( item == NULL )
@ -150,5 +153,25 @@ namespace GUIEditor
linkEditor->setLinkId( id );
linkEditor->show();
}
void LinkList::onEditorFinished()
{
QTreeWidgetItem *item =
linkTree->currentItem();
if( item == NULL )
return;
bool ok;
uint32 id = item->data( 3, Qt::UserRole ).toUInt( &ok );
if( !ok )
return;
SLinkData data;
if( !CWidgetManager::getInstance()->getParser()->getLinkData( id, data ) )
return;
item->setText( 1, data.target.c_str() );
item->setText( 2, data.action.c_str() );
}
}

View file

@ -39,6 +39,7 @@ namespace GUIEditor
void onRemoveButtonClicked();
void onEditButtonClicked();
void onItemDblClicked( QTreeWidgetItem *item );
void onEditorFinished();
private:
LinkEditor *linkEditor;