diff options
-rw-r--r-- | src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineanimationform.cpp | 11 | ||||
-rw-r--r-- | src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineform.cpp | 11 |
2 files changed, 20 insertions, 2 deletions
diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineanimationform.cpp b/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineanimationform.cpp index 4fc04b5759..65f77a0e5f 100644 --- a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineanimationform.cpp +++ b/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineanimationform.cpp @@ -85,14 +85,23 @@ TimelineAnimationForm::TimelineAnimationForm(QWidget *parent) if (newId == animation().id()) return; - if (!animation().isValidId(newId)) { + bool error = false; + + if (!ModelNode::isValidId(newId)) { Core::AsynchronousMessageBox::warning(tr("Invalid Id"), tr("%1 is an invalid id.").arg(newId)); + error = true; } else if (animation().view()->hasId(newId)) { Core::AsynchronousMessageBox::warning(tr("Invalid Id"), tr("%1 already exists.").arg(newId)); } else { animation().setIdWithRefactoring(newId); + error = true; + } + + if (error) { + lastString.clear(); + ui->idLineEdit->setText(animation().id()); } }); diff --git a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineform.cpp b/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineform.cpp index 3c1c3950dd..eb63ad4883 100644 --- a/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineform.cpp +++ b/src/plugins/qmldesigner/qmldesignerextension/timelineeditor/timelineform.cpp @@ -98,15 +98,24 @@ TimelineForm::TimelineForm(QWidget *parent) if (newId == m_timeline.modelNode().id()) return; - if (!m_timeline.modelNode().isValidId(newId)) { + bool error = false; + + if (!ModelNode::isValidId(newId)) { Core::AsynchronousMessageBox::warning(tr("Invalid Id"), tr("%1 is an invalid id.").arg(newId)); + error = true; } else if (m_timeline.view()->hasId(newId)) { Core::AsynchronousMessageBox::warning(tr("Invalid Id"), tr("%1 already exists.").arg(newId)); + error = true; } else { m_timeline.modelNode().setIdWithRefactoring(newId); } + + if (error) { + lastString.clear(); + ui->idLineEdit->setText(m_timeline.modelNode().id()); + } }); connectSpinBox(ui->startFrame, "startFrame"); |