Commit c014325d authored by Tim Jenssen's avatar Tim Jenssen

QmlDesigner: rename nodeId -> internalNodeId

Change-Id: I8f038479f31a282db256144a3254e438eb6a629f
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent b0ffe15a
......@@ -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)
}
}
......
......@@ -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
......
......@@ -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);
}
}
......
......@@ -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();
......
......@@ -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
......
......@@ -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);
......
Markdown is supported
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