Commit df8affc8 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.statesEditor: usability fix

If the user aborts state renaming or gives the state the same
name again there is no MessageBox shown anymore.
parent 990d66a0
......@@ -169,7 +169,10 @@ void StatesEditorModel::removeState(int stateIndex)
}
void StatesEditorModel::renameState(int nodeId, const QString &newName)
{
{
if (newName == m_statesEditorView->currentStateName())
return;
if (newName.isEmpty() ||! m_statesEditorView->validStateName(newName)) {
QMessageBox::warning(0, tr("Invalid state name"),
newName.isEmpty() ?
......
......@@ -198,6 +198,11 @@ bool StatesEditorView::validStateName(const QString &name) const
return true;
}
QString StatesEditorView::currentStateName() const
{
return currentState().isValid() ? currentState().name() : QString();
}
void StatesEditorView::renameState(int nodeId, const QString &newName)
{
if (hasModelNodeForInternalId(nodeId)) {
......
......@@ -50,6 +50,7 @@ public:
void renameState(int nodeId,const QString &newName);
bool validStateName(const QString &name) const;
QString currentStateName() const;
void nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment