forked from qt-creator/qt-creator
QmlDesigner: Cleanup notifier
The notifier should not change the state. That is really surprising. Change-Id: I179cf9e49c6ae916435c9aada5e1ddff6f9f52ee Reviewed-by: Tim Jenssen <tim.jenssen@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
@@ -245,6 +245,11 @@ public:
|
||||
void startDrag(QMimeData *mimeData, const QPixmap &icon);
|
||||
void endDrag();
|
||||
|
||||
void setCurrentStateNode(const ModelNode &node);
|
||||
ModelNode currentStateNode(AbstractView *view = nullptr);
|
||||
|
||||
void setCurrentTimeline(const ModelNode &timeline);
|
||||
|
||||
NotNullPointer<const ProjectStorageType> projectStorage() const;
|
||||
const PathCacheType &pathCache() const;
|
||||
PathCacheType &pathCache();
|
||||
|
@@ -569,8 +569,8 @@ void AbstractView::setCurrentTimeline(const ModelNode &timeline)
|
||||
if (currentTimeline().isValid())
|
||||
currentTimeline().toogleRecording(false);
|
||||
|
||||
if (model())
|
||||
model()->d->notifyCurrentTimelineChanged(timeline);
|
||||
if (m_model)
|
||||
m_model->setCurrentTimeline(timeline);
|
||||
}
|
||||
|
||||
void AbstractView::activateTimelineRecording(const ModelNode &timeline)
|
||||
@@ -580,8 +580,8 @@ void AbstractView::activateTimelineRecording(const ModelNode &timeline)
|
||||
|
||||
Internal::WriteLocker locker(m_model.data());
|
||||
|
||||
if (model())
|
||||
model()->d->notifyCurrentTimelineChanged(timeline);
|
||||
if (m_model)
|
||||
m_model->setCurrentTimeline(timeline);
|
||||
}
|
||||
|
||||
void AbstractView::deactivateTimelineRecording()
|
||||
@@ -590,9 +590,8 @@ void AbstractView::deactivateTimelineRecording()
|
||||
currentTimeline().toogleRecording(false);
|
||||
currentTimeline().resetGroupRecording();
|
||||
}
|
||||
|
||||
if (model())
|
||||
model()->d->notifyCurrentTimelineChanged(ModelNode());
|
||||
if (m_model)
|
||||
m_model->setCurrentTimeline({});
|
||||
}
|
||||
|
||||
bool AbstractView::executeInTransaction(const QByteArray &identifier, const OperationBlock &lambda)
|
||||
@@ -761,9 +760,8 @@ void AbstractView::emitRewriterEndTransaction()
|
||||
|
||||
void AbstractView::setCurrentStateNode(const ModelNode &node)
|
||||
{
|
||||
Internal::WriteLocker locker(m_model.data());
|
||||
if (model())
|
||||
model()->d->notifyCurrentStateChanged(node);
|
||||
if (m_model)
|
||||
m_model->setCurrentStateNode(node);
|
||||
}
|
||||
|
||||
void AbstractView::changeRootNodeType(const TypeName &type, int majorVersion, int minorVersion)
|
||||
@@ -872,11 +870,10 @@ ModelNode AbstractView::getTextureDefaultInstance(const QString &source)
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
ModelNode AbstractView::currentStateNode() const
|
||||
{
|
||||
if (model())
|
||||
return ModelNode(m_model.data()->d->currentStateNode(), m_model.data(), const_cast<AbstractView*>(this));
|
||||
if (m_model)
|
||||
return m_model->currentStateNode(const_cast<AbstractView *>(this));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@@ -681,7 +681,6 @@ void ModelPrivate::notifyInstancesChildrenChanged(const QVector<ModelNode> &mode
|
||||
|
||||
void ModelPrivate::notifyCurrentStateChanged(const ModelNode &node)
|
||||
{
|
||||
m_currentStateNode = node.internalNode();
|
||||
notifyNodeInstanceViewLast([&](AbstractView *view) {
|
||||
view->currentStateChanged(ModelNode(node.internalNode(), m_model, view));
|
||||
});
|
||||
@@ -689,7 +688,6 @@ void ModelPrivate::notifyCurrentStateChanged(const ModelNode &node)
|
||||
|
||||
void ModelPrivate::notifyCurrentTimelineChanged(const ModelNode &node)
|
||||
{
|
||||
m_currentTimelineNode = node.internalNode();
|
||||
notifyNodeInstanceViewLast([&](AbstractView *view) {
|
||||
view->currentTimelineChanged(ModelNode(node.internalNode(), m_model, view));
|
||||
});
|
||||
@@ -1913,6 +1911,26 @@ void Model::endDrag()
|
||||
d->notifyDragEnded();
|
||||
}
|
||||
|
||||
void Model::setCurrentStateNode(const ModelNode &node)
|
||||
{
|
||||
Internal::WriteLocker locker(this);
|
||||
d->m_currentStateNode = node.internalNode();
|
||||
d->notifyCurrentStateChanged(node);
|
||||
}
|
||||
|
||||
// QTC_TEMP
|
||||
ModelNode Model::currentStateNode(AbstractView *view)
|
||||
{
|
||||
return ModelNode(d->currentStateNode(), this, view);
|
||||
}
|
||||
|
||||
void Model::setCurrentTimeline(const ModelNode &timeline)
|
||||
{
|
||||
d->m_currentTimelineNode = timeline.internalNode();
|
||||
|
||||
d->notifyCurrentTimelineChanged(timeline);
|
||||
}
|
||||
|
||||
NotNullPointer<const ProjectStorageType> Model::projectStorage() const
|
||||
{
|
||||
return d->projectStorage;
|
||||
|
Reference in New Issue
Block a user