diff options
author | Janne Kangas <janne.kangas@qt.io> | 2018-09-27 10:28:42 +0300 |
---|---|---|
committer | Janne Kangas <janne.kangas@qt.io> | 2018-09-27 08:27:13 +0000 |
commit | f9e0237e6798e167e672895d39525a750449932b (patch) | |
tree | 8527133480932ab3368c1ee1d8710ba74ccfa0cc | |
parent | 29b89d95df02f2d13359bd473e6ab9d83290af5c (diff) |
Update datainput dialog internal map when renaming datainputs
Dialog did not update the internal map when datainput name was changed.
When the same datainput was edited again and map entry was queried with an
incorrect name, dialog crashed.
Change-Id: Ibe803cf20c0c42922d8622d21b33f885bfd82b2c
Task-id: QT3DS-2406
Task-id: QT3DS-2405
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
-rw-r--r-- | src/Authoring/Studio/Application/DataInputListDlg.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/Authoring/Studio/Application/DataInputListDlg.cpp b/src/Authoring/Studio/Application/DataInputListDlg.cpp index 238e3f3f..401ddee4 100644 --- a/src/Authoring/Studio/Application/DataInputListDlg.cpp +++ b/src/Authoring/Studio/Application/DataInputListDlg.cpp @@ -319,8 +319,16 @@ void CDataInputListDlg::onEditDataInput() CDataInputDlg datainputdialog(&di, m_tableContents, this, allowedTypes); datainputdialog.exec(); - // insert replaces the previous key - value pair + // if we are renaming a datainput, remove the old key - value and + // add it again as new entry with new name + if (m_currentDataInputName != di->name) { + m_dataInputs.remove(m_currentDataInputName); + m_currentDataInputName = di->name; + } + + // insert replaces the previous key - value pair if existing m_dataInputs.insert(m_currentDataInputName, di); + updateButtons(); updateContents(); |