summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml6
-rw-r--r--share/qtcreator/qmldesigner/statesEditorQmlSources/stateslist.qml3
-rw-r--r--src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp14
-rw-r--r--src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h4
-rw-r--r--src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp6
-rw-r--r--src/plugins/qmldesigner/components/stateseditor/stateseditorview.h2
6 files changed, 18 insertions, 17 deletions
diff --git a/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml b/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml
index 4a56443552..b0115e7980 100644
--- a/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml
+++ b/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml
@@ -48,7 +48,7 @@ Rectangle {
MouseArea {
anchors.fill: parent
- onClicked: root.currentStateInternalId = nodeId
+ onClicked: root.currentStateInternalId = internalNodeId
}
ToolButton {
@@ -60,7 +60,7 @@ Rectangle {
width: 16
iconSource: "images/darkclose.png"
- onClicked: root.deleteState(nodeId)
+ onClicked: root.deleteState(internalNodeId)
}
TextField {
@@ -75,7 +75,7 @@ Rectangle {
Component.onCompleted: text = delegateStateName
onEditingFinished: {
if (text != delegateStateName)
- statesEditorModel.renameState(nodeId, text)
+ statesEditorModel.renameState(internalNodeId, text)
}
}
diff --git a/share/qtcreator/qmldesigner/statesEditorQmlSources/stateslist.qml b/share/qtcreator/qmldesigner/statesEditorQmlSources/stateslist.qml
index 016a739979..6095fb17da 100644
--- a/share/qtcreator/qmldesigner/statesEditorQmlSources/stateslist.qml
+++ b/share/qtcreator/qmldesigner/statesEditorQmlSources/stateslist.qml
@@ -35,7 +35,7 @@ Rectangle {
id: root
signal createNewState
- signal deleteState(int nodeId)
+ signal deleteState(int internalNodeId)
signal duplicateCurrentState
property int stateImageSize: 100
@@ -92,6 +92,7 @@ Rectangle {
id: statesDelegate
width: delegateWidth
height: delegateHeight
+ isCurrentState: root.currentStateInternalId == internalNodeId
gradiantBaseColor: isCurrentState ? Qt.darker(highlightColor, 1.8) : root.color
delegateStateName: stateName
delegateStateImageSource: stateImageSource
diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp
index 3830be278c..e1fe464268 100644
--- a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp
+++ b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.cpp
@@ -56,7 +56,7 @@ StatesEditorModel::StatesEditorModel(StatesEditorView *view)
QHash<int, QByteArray> roleNames;
roleNames.insert(StateNameRole, "stateName");
roleNames.insert(StateImageSourceRole, "stateImageSource");
- roleNames.insert(NodeId, "nodeId");
+ roleNames.insert(InternalNodeId, "internalNodeId");
setRoleNames(roleNames);
}
@@ -72,11 +72,11 @@ QModelIndex StatesEditorModel::index(int row, int column, const QModelIndex &par
return QModelIndex();
- int internalId = 0;
+ int internalNodeId = 0;
if (row > 0)
- internalId = m_statesEditorView->rootModelNode().nodeListProperty("states").at(row - 1).internalId();
+ internalNodeId = m_statesEditorView->rootModelNode().nodeListProperty("states").at(row - 1).internalId();
- return hasIndex(row, column, parent) ? createIndex(row, column, internalId) : QModelIndex();
+ return hasIndex(row, column, parent) ? createIndex(row, column, internalNodeId) : QModelIndex();
}
int StatesEditorModel::rowCount(const QModelIndex &parent) const
@@ -126,7 +126,7 @@ QVariant StatesEditorModel::data(const QModelIndex &index, int role) const
else
return QString("image://qmldesigner_stateseditor/%1-%2").arg(index.internalId()).arg(randomNumber);
}
- case NodeId : return index.internalId();
+ case InternalNodeId : return index.internalId();
}
@@ -167,7 +167,7 @@ void StatesEditorModel::removeState(int stateIndex)
}
}
-void StatesEditorModel::renameState(int nodeId, const QString &newName)
+void StatesEditorModel::renameState(int internalNodeId, const QString &newName)
{
if (newName == m_statesEditorView->currentStateName())
return;
@@ -178,7 +178,7 @@ void StatesEditorModel::renameState(int nodeId, const QString &newName)
tr("The empty string as a name is reserved for the base state.") :
tr("Name already used in another state"));
} else {
- m_statesEditorView->renameState(nodeId, newName);
+ m_statesEditorView->renameState(internalNodeId, newName);
}
}
diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h
index 7137a438d9..99f08be602 100644
--- a/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h
+++ b/src/plugins/qmldesigner/components/stateseditor/stateseditormodel.h
@@ -47,7 +47,7 @@ class StatesEditorModel : public QAbstractListModel
enum {
StateNameRole = Qt::DisplayRole,
StateImageSourceRole = Qt::UserRole,
- NodeId
+ InternalNodeId
};
public:
@@ -61,7 +61,7 @@ public:
void insertState(int stateIndex);
void removeState(int stateIndex);
void updateState(int beginIndex, int endIndex);
- Q_INVOKABLE void renameState(int nodeId, const QString &newName);
+ Q_INVOKABLE void renameState(int internalNodeId, const QString &newName);
void reset();
diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp
index 875f27bb73..99b38969e2 100644
--- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp
+++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp
@@ -291,10 +291,10 @@ QString StatesEditorView::currentStateName() const
return currentState().isValid() ? currentState().name() : QString();
}
-void StatesEditorView::renameState(int nodeId, const QString &newName)
+void StatesEditorView::renameState(int internalNodeId, const QString &newName)
{
- if (hasModelNodeForInternalId(nodeId)) {
- QmlModelState state(modelNodeForInternalId(nodeId));
+ if (hasModelNodeForInternalId(internalNodeId)) {
+ QmlModelState state(modelNodeForInternalId(internalNodeId));
try {
if (state.isValid() && state.name() != newName) {
// Jump to base state for the change
diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h
index 0f21597b5d..a7c1b0a481 100644
--- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h
+++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.h
@@ -47,7 +47,7 @@ public:
explicit StatesEditorView(QObject *parent = 0);
~StatesEditorView();
- void renameState(int nodeId,const QString &newName);
+ void renameState(int internalNodeId,const QString &newName);
bool validStateName(const QString &name) const;
QString currentStateName() const;
void setCurrentState(const QmlModelState &state);