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)
|
void StatesEditorModel::renameState(int nodeId, const QString &newName)
|
||||||
{
|
{
|
||||||
|
if (newName == m_statesEditorView->currentStateName())
|
||||||
|
return;
|
||||||
|
|
||||||
if (newName.isEmpty() ||! m_statesEditorView->validStateName(newName)) {
|
if (newName.isEmpty() ||! m_statesEditorView->validStateName(newName)) {
|
||||||
QMessageBox::warning(0, tr("Invalid state name"),
|
QMessageBox::warning(0, tr("Invalid state name"),
|
||||||
newName.isEmpty() ?
|
newName.isEmpty() ?
|
||||||
|
@@ -198,6 +198,11 @@ bool StatesEditorView::validStateName(const QString &name) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString StatesEditorView::currentStateName() const
|
||||||
|
{
|
||||||
|
return currentState().isValid() ? currentState().name() : QString();
|
||||||
|
}
|
||||||
|
|
||||||
void StatesEditorView::renameState(int nodeId, const QString &newName)
|
void StatesEditorView::renameState(int nodeId, const QString &newName)
|
||||||
{
|
{
|
||||||
if (hasModelNodeForInternalId(nodeId)) {
|
if (hasModelNodeForInternalId(nodeId)) {
|
||||||
|
@@ -50,6 +50,7 @@ public:
|
|||||||
|
|
||||||
void renameState(int nodeId,const QString &newName);
|
void renameState(int nodeId,const QString &newName);
|
||||||
bool validStateName(const QString &name) const;
|
bool validStateName(const QString &name) const;
|
||||||
|
QString currentStateName() const;
|
||||||
|
|
||||||
void nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName);
|
void nodeInstancePropertyChanged(const ModelNode &node, const QString &propertyName);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user