forked from qt-creator/qt-creator
QmlDesigner.statesEditor: usability fix
If the user aborts state renaming or gives the state the same name again there is no MessageBox shown anymore.
This commit is contained in:
@@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user