summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Authoring/Studio/Application/DataInputDlg.cpp6
-rw-r--r--src/Authoring/Studio/Application/DataInputListDlg.cpp8
2 files changed, 12 insertions, 2 deletions
diff --git a/src/Authoring/Studio/Application/DataInputDlg.cpp b/src/Authoring/Studio/Application/DataInputDlg.cpp
index aa0551bf..0a31424d 100644
--- a/src/Authoring/Studio/Application/DataInputDlg.cpp
+++ b/src/Authoring/Studio/Application/DataInputDlg.cpp
@@ -132,7 +132,9 @@ void CDataInputDlg::initDialog()
void CDataInputDlg::accept()
{
- m_dataInput->name = m_name;
+ if (m_dataInput->name != m_name)
+ m_dataInput->name = getUniqueId(m_name);
+
m_dataInput->type = m_type;
if (m_type == DataTypeRangedNumber) {
m_dataInput->minValue = m_min;
@@ -169,7 +171,7 @@ void CDataInputDlg::onMaxChanged(float max)
void CDataInputDlg::onNameChanged(const QString &name)
{
int cursorPos = m_ui->lineEditInputName->cursorPosition();
- m_name = getUniqueId(name);
+ m_name = name;
m_ui->lineEditInputName->setText(m_name);
m_ui->lineEditInputName->setCursorPosition(cursorPos);
}
diff --git a/src/Authoring/Studio/Application/DataInputListDlg.cpp b/src/Authoring/Studio/Application/DataInputListDlg.cpp
index 3771d984..a03e9dcd 100644
--- a/src/Authoring/Studio/Application/DataInputListDlg.cpp
+++ b/src/Authoring/Studio/Application/DataInputListDlg.cpp
@@ -402,6 +402,14 @@ void CDataInputListDlg::onAddDataInput()
// dialog automatically
if (m_goToAdd)
accept();
+
+ // Otherwise find the new position of added DI and select it.
+ auto idxList = m_ui->tableView->selectionModel()->model()->match(
+ m_ui->tableView->selectionModel()->model()->index(
+ 0,0), Qt::EditRole, m_mostRecentlyAdded);
+
+ if (!idxList.empty())
+ m_ui->tableView->selectRow(idxList.first().row());
}
void CDataInputListDlg::onRemoveDataInput()