forked from qt-creator/qt-creator
QmlDesigner: Add error channel from puppet -> designer
Change-Id: I57c325fd98ed505abc19f87ac8a164d7e0c76244 Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
committed by
Thomas Hartmann
parent
6d81730764
commit
dd32d1a16e
@@ -173,6 +173,7 @@ public:
|
|||||||
void emitCustomNotification(const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
void emitCustomNotification(const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
||||||
|
|
||||||
void emitInstancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList);
|
void emitInstancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList);
|
||||||
|
void emitInstanceErrorChange(const QVector<qint32> &instanceIds);
|
||||||
void emitInstancesCompleted(const QVector<ModelNode> &nodeList);
|
void emitInstancesCompleted(const QVector<ModelNode> &nodeList);
|
||||||
void emitInstanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash);
|
void emitInstanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash);
|
||||||
void emitInstancesRenderImageChanged(const QVector<ModelNode> &nodeList);
|
void emitInstancesRenderImageChanged(const QVector<ModelNode> &nodeList);
|
||||||
@@ -214,6 +215,7 @@ public:
|
|||||||
virtual void rewriterEndTransaction() = 0;
|
virtual void rewriterEndTransaction() = 0;
|
||||||
|
|
||||||
virtual void currentStateChanged(const ModelNode &node) = 0; // base state is a invalid model node
|
virtual void currentStateChanged(const ModelNode &node) = 0; // base state is a invalid model node
|
||||||
|
virtual void instanceErrorChange(const QVector<ModelNode> &errorNodeList);
|
||||||
|
|
||||||
virtual void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
virtual void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
|
||||||
const QList<ModelNode> &lastSelectedNodeList) = 0;
|
const QList<ModelNode> &lastSelectedNodeList) = 0;
|
||||||
|
@@ -94,6 +94,8 @@ public:
|
|||||||
void setY(double y);
|
void setY(double y);
|
||||||
|
|
||||||
bool hasAnchors() const;
|
bool hasAnchors() const;
|
||||||
|
QString error() const;
|
||||||
|
bool hasError() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setProperty(const PropertyName &name, const QVariant &value);
|
void setProperty(const PropertyName &name, const QVariant &value);
|
||||||
@@ -124,6 +126,7 @@ protected:
|
|||||||
|
|
||||||
void setParentId(qint32 instanceId);
|
void setParentId(qint32 instanceId);
|
||||||
void setRenderPixmap(const QImage &image);
|
void setRenderPixmap(const QImage &image);
|
||||||
|
bool setError(const QString &errorMessage);
|
||||||
NodeInstance(ProxyNodeInstanceData *d);
|
NodeInstance(ProxyNodeInstanceData *d);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -55,6 +55,8 @@ public:
|
|||||||
static bool isValidQmlObjectNode(const ModelNode &modelNode);
|
static bool isValidQmlObjectNode(const ModelNode &modelNode);
|
||||||
bool isValid() const;
|
bool isValid() const;
|
||||||
|
|
||||||
|
bool hasError() const;
|
||||||
|
QString error() const;
|
||||||
bool hasNodeParent() const;
|
bool hasNodeParent() const;
|
||||||
bool hasInstanceParent() const;
|
bool hasInstanceParent() const;
|
||||||
bool hasInstanceParentItem() const;
|
bool hasInstanceParentItem() const;
|
||||||
|
@@ -84,6 +84,8 @@ public:
|
|||||||
QPixmap renderPixmap;
|
QPixmap renderPixmap;
|
||||||
QPixmap blurredRenderPixmap;
|
QPixmap blurredRenderPixmap;
|
||||||
|
|
||||||
|
QString errorMessage;
|
||||||
|
|
||||||
QHash<PropertyName, QPair<PropertyName, qint32> > anchors;
|
QHash<PropertyName, QPair<PropertyName, qint32> > anchors;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -179,6 +181,17 @@ bool NodeInstance::hasAnchors() const
|
|||||||
|| hasAnchor("anchors.baseline");
|
|| hasAnchor("anchors.baseline");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString NodeInstance::error() const
|
||||||
|
{
|
||||||
|
return d->errorMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool NodeInstance::hasError() const
|
||||||
|
{
|
||||||
|
return !d->errorMessage.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool NodeInstance::isValid() const
|
bool NodeInstance::isValid() const
|
||||||
{
|
{
|
||||||
return instanceId() >= 0 && modelNode().isValid();
|
return instanceId() >= 0 && modelNode().isValid();
|
||||||
@@ -392,6 +405,15 @@ void NodeInstance::setRenderPixmap(const QImage &image)
|
|||||||
d->blurredRenderPixmap = QPixmap();
|
d->blurredRenderPixmap = QPixmap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool NodeInstance::setError(const QString &errorMessage)
|
||||||
|
{
|
||||||
|
if (d->errorMessage != errorMessage) {
|
||||||
|
d->errorMessage = errorMessage;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void NodeInstance::setParentId(qint32 instanceId)
|
void NodeInstance::setParentId(qint32 instanceId)
|
||||||
{
|
{
|
||||||
d->parentInstanceId = instanceId;
|
d->parentInstanceId = instanceId;
|
||||||
|
@@ -192,6 +192,11 @@ void AbstractView::modelAboutToBeDetached(Model *)
|
|||||||
Empty properties were removed.
|
Empty properties were removed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
void AbstractView::instanceErrorChange(const QVector<ModelNode> &/*errorNodeList*/)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// Node related functions
|
// Node related functions
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -462,6 +467,12 @@ void AbstractView::emitInstancePropertyChange(const QList<QPair<ModelNode, Prope
|
|||||||
model()->d->notifyInstancePropertyChange(propertyList);
|
model()->d->notifyInstancePropertyChange(propertyList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AbstractView::emitInstanceErrorChange(const QVector<qint32> &instanceIds)
|
||||||
|
{
|
||||||
|
if (model() && nodeInstanceView() == this)
|
||||||
|
model()->d->notifyInstanceErrorChange(instanceIds);
|
||||||
|
}
|
||||||
|
|
||||||
void AbstractView::emitInstancesCompleted(const QVector<ModelNode> &nodeVector)
|
void AbstractView::emitInstancesCompleted(const QVector<ModelNode> &nodeVector)
|
||||||
{
|
{
|
||||||
if (model() && nodeInstanceView() == this)
|
if (model() && nodeInstanceView() == this)
|
||||||
|
@@ -435,6 +435,19 @@ void ModelPrivate::notifyInstancePropertyChange(const QList<QPair<ModelNode, Pro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModelPrivate::notifyInstanceErrorChange(const QVector<qint32> &instanceIds)
|
||||||
|
{
|
||||||
|
// no need to notify the rewriter or the instance view
|
||||||
|
|
||||||
|
QVector<ModelNode> errorNodeList;
|
||||||
|
foreach (const QPointer<AbstractView> &view, m_viewList) {
|
||||||
|
Q_ASSERT(view != 0);
|
||||||
|
foreach (qint32 instanceId, instanceIds)
|
||||||
|
errorNodeList.append(ModelNode(model()->d->nodeForInternalId(instanceId), model(), view));
|
||||||
|
view->instanceErrorChange(errorNodeList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ModelPrivate::notifyInstancesCompleted(const QVector<ModelNode> &nodeVector)
|
void ModelPrivate::notifyInstancesCompleted(const QVector<ModelNode> &nodeVector)
|
||||||
{
|
{
|
||||||
bool resetModel = false;
|
bool resetModel = false;
|
||||||
|
@@ -152,6 +152,7 @@ public:
|
|||||||
|
|
||||||
void notifyCustomNotification(const AbstractView *senderView, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
void notifyCustomNotification(const AbstractView *senderView, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &data);
|
||||||
void notifyInstancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList);
|
void notifyInstancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &propertyList);
|
||||||
|
void notifyInstanceErrorChange(const QVector<qint32> &instanceIds);
|
||||||
void notifyInstancesCompleted(const QVector<ModelNode> &nodeList);
|
void notifyInstancesCompleted(const QVector<ModelNode> &nodeList);
|
||||||
void notifyInstancesInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash);
|
void notifyInstancesInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash);
|
||||||
void notifyInstancesRenderImageChanged(const QVector<ModelNode> &nodeList);
|
void notifyInstancesRenderImageChanged(const QVector<ModelNode> &nodeList);
|
||||||
|
@@ -486,6 +486,22 @@ bool QmlObjectNode::isValid() const
|
|||||||
return isValidQmlObjectNode(modelNode());
|
return isValidQmlObjectNode(modelNode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QmlObjectNode::hasError() const
|
||||||
|
{
|
||||||
|
if (isValid())
|
||||||
|
return nodeInstance().hasError();
|
||||||
|
else
|
||||||
|
qDebug() << "called hasError() on an invalid QmlObjectNode";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString QmlObjectNode::error() const
|
||||||
|
{
|
||||||
|
if (hasError())
|
||||||
|
return nodeInstance().error();
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
bool QmlObjectNode::hasNodeParent() const
|
bool QmlObjectNode::hasNodeParent() const
|
||||||
{
|
{
|
||||||
return modelNode().hasParentProperty();
|
return modelNode().hasParentProperty();
|
||||||
|
Reference in New Issue
Block a user