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 startDrag(QMimeData *mimeData, const QPixmap &icon);
|
||||||
void endDrag();
|
void endDrag();
|
||||||
|
|
||||||
|
void setCurrentStateNode(const ModelNode &node);
|
||||||
|
ModelNode currentStateNode(AbstractView *view = nullptr);
|
||||||
|
|
||||||
|
void setCurrentTimeline(const ModelNode &timeline);
|
||||||
|
|
||||||
NotNullPointer<const ProjectStorageType> projectStorage() const;
|
NotNullPointer<const ProjectStorageType> projectStorage() const;
|
||||||
const PathCacheType &pathCache() const;
|
const PathCacheType &pathCache() const;
|
||||||
PathCacheType &pathCache();
|
PathCacheType &pathCache();
|
||||||
|
@@ -569,8 +569,8 @@ void AbstractView::setCurrentTimeline(const ModelNode &timeline)
|
|||||||
if (currentTimeline().isValid())
|
if (currentTimeline().isValid())
|
||||||
currentTimeline().toogleRecording(false);
|
currentTimeline().toogleRecording(false);
|
||||||
|
|
||||||
if (model())
|
if (m_model)
|
||||||
model()->d->notifyCurrentTimelineChanged(timeline);
|
m_model->setCurrentTimeline(timeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractView::activateTimelineRecording(const ModelNode &timeline)
|
void AbstractView::activateTimelineRecording(const ModelNode &timeline)
|
||||||
@@ -580,8 +580,8 @@ void AbstractView::activateTimelineRecording(const ModelNode &timeline)
|
|||||||
|
|
||||||
Internal::WriteLocker locker(m_model.data());
|
Internal::WriteLocker locker(m_model.data());
|
||||||
|
|
||||||
if (model())
|
if (m_model)
|
||||||
model()->d->notifyCurrentTimelineChanged(timeline);
|
m_model->setCurrentTimeline(timeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractView::deactivateTimelineRecording()
|
void AbstractView::deactivateTimelineRecording()
|
||||||
@@ -590,9 +590,8 @@ void AbstractView::deactivateTimelineRecording()
|
|||||||
currentTimeline().toogleRecording(false);
|
currentTimeline().toogleRecording(false);
|
||||||
currentTimeline().resetGroupRecording();
|
currentTimeline().resetGroupRecording();
|
||||||
}
|
}
|
||||||
|
if (m_model)
|
||||||
if (model())
|
m_model->setCurrentTimeline({});
|
||||||
model()->d->notifyCurrentTimelineChanged(ModelNode());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AbstractView::executeInTransaction(const QByteArray &identifier, const OperationBlock &lambda)
|
bool AbstractView::executeInTransaction(const QByteArray &identifier, const OperationBlock &lambda)
|
||||||
@@ -761,9 +760,8 @@ void AbstractView::emitRewriterEndTransaction()
|
|||||||
|
|
||||||
void AbstractView::setCurrentStateNode(const ModelNode &node)
|
void AbstractView::setCurrentStateNode(const ModelNode &node)
|
||||||
{
|
{
|
||||||
Internal::WriteLocker locker(m_model.data());
|
if (m_model)
|
||||||
if (model())
|
m_model->setCurrentStateNode(node);
|
||||||
model()->d->notifyCurrentStateChanged(node);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractView::changeRootNodeType(const TypeName &type, int majorVersion, int minorVersion)
|
void AbstractView::changeRootNodeType(const TypeName &type, int majorVersion, int minorVersion)
|
||||||
@@ -872,11 +870,10 @@ ModelNode AbstractView::getTextureDefaultInstance(const QString &source)
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ModelNode AbstractView::currentStateNode() const
|
ModelNode AbstractView::currentStateNode() const
|
||||||
{
|
{
|
||||||
if (model())
|
if (m_model)
|
||||||
return ModelNode(m_model.data()->d->currentStateNode(), m_model.data(), const_cast<AbstractView*>(this));
|
return m_model->currentStateNode(const_cast<AbstractView *>(this));
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@@ -681,7 +681,6 @@ void ModelPrivate::notifyInstancesChildrenChanged(const QVector<ModelNode> &mode
|
|||||||
|
|
||||||
void ModelPrivate::notifyCurrentStateChanged(const ModelNode &node)
|
void ModelPrivate::notifyCurrentStateChanged(const ModelNode &node)
|
||||||
{
|
{
|
||||||
m_currentStateNode = node.internalNode();
|
|
||||||
notifyNodeInstanceViewLast([&](AbstractView *view) {
|
notifyNodeInstanceViewLast([&](AbstractView *view) {
|
||||||
view->currentStateChanged(ModelNode(node.internalNode(), m_model, 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)
|
void ModelPrivate::notifyCurrentTimelineChanged(const ModelNode &node)
|
||||||
{
|
{
|
||||||
m_currentTimelineNode = node.internalNode();
|
|
||||||
notifyNodeInstanceViewLast([&](AbstractView *view) {
|
notifyNodeInstanceViewLast([&](AbstractView *view) {
|
||||||
view->currentTimelineChanged(ModelNode(node.internalNode(), m_model, view));
|
view->currentTimelineChanged(ModelNode(node.internalNode(), m_model, view));
|
||||||
});
|
});
|
||||||
@@ -1913,6 +1911,26 @@ void Model::endDrag()
|
|||||||
d->notifyDragEnded();
|
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
|
NotNullPointer<const ProjectStorageType> Model::projectStorage() const
|
||||||
{
|
{
|
||||||
return d->projectStorage;
|
return d->projectStorage;
|
||||||
|
Reference in New Issue
Block a user