forked from qt-creator/qt-creator
QmlDesigner: Properly reset line edits if an error occurs
Task-number: QDS-707 Change-Id: Ic70c4296afd8bd6b590242fea129624af2fee7a6 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -85,14 +85,23 @@ TimelineAnimationForm::TimelineAnimationForm(QWidget *parent)
|
|||||||
if (newId == animation().id())
|
if (newId == animation().id())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!animation().isValidId(newId)) {
|
bool error = false;
|
||||||
|
|
||||||
|
if (!ModelNode::isValidId(newId)) {
|
||||||
Core::AsynchronousMessageBox::warning(tr("Invalid Id"),
|
Core::AsynchronousMessageBox::warning(tr("Invalid Id"),
|
||||||
tr("%1 is an invalid id.").arg(newId));
|
tr("%1 is an invalid id.").arg(newId));
|
||||||
|
error = true;
|
||||||
} else if (animation().view()->hasId(newId)) {
|
} else if (animation().view()->hasId(newId)) {
|
||||||
Core::AsynchronousMessageBox::warning(tr("Invalid Id"),
|
Core::AsynchronousMessageBox::warning(tr("Invalid Id"),
|
||||||
tr("%1 already exists.").arg(newId));
|
tr("%1 already exists.").arg(newId));
|
||||||
} else {
|
} else {
|
||||||
animation().setIdWithRefactoring(newId);
|
animation().setIdWithRefactoring(newId);
|
||||||
|
error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
lastString.clear();
|
||||||
|
ui->idLineEdit->setText(animation().id());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -98,15 +98,24 @@ TimelineForm::TimelineForm(QWidget *parent)
|
|||||||
if (newId == m_timeline.modelNode().id())
|
if (newId == m_timeline.modelNode().id())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!m_timeline.modelNode().isValidId(newId)) {
|
bool error = false;
|
||||||
|
|
||||||
|
if (!ModelNode::isValidId(newId)) {
|
||||||
Core::AsynchronousMessageBox::warning(tr("Invalid Id"),
|
Core::AsynchronousMessageBox::warning(tr("Invalid Id"),
|
||||||
tr("%1 is an invalid id.").arg(newId));
|
tr("%1 is an invalid id.").arg(newId));
|
||||||
|
error = true;
|
||||||
} else if (m_timeline.view()->hasId(newId)) {
|
} else if (m_timeline.view()->hasId(newId)) {
|
||||||
Core::AsynchronousMessageBox::warning(tr("Invalid Id"),
|
Core::AsynchronousMessageBox::warning(tr("Invalid Id"),
|
||||||
tr("%1 already exists.").arg(newId));
|
tr("%1 already exists.").arg(newId));
|
||||||
|
error = true;
|
||||||
} else {
|
} else {
|
||||||
m_timeline.modelNode().setIdWithRefactoring(newId);
|
m_timeline.modelNode().setIdWithRefactoring(newId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
lastString.clear();
|
||||||
|
ui->idLineEdit->setText(m_timeline.modelNode().id());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
connectSpinBox(ui->startFrame, "startFrame");
|
connectSpinBox(ui->startFrame, "startFrame");
|
||||||
|
Reference in New Issue
Block a user