forked from qt-creator/qt-creator
QmlDesigner.NodeInstances: Workaround qml design bug
Task-number: QTCREATORBUG-5005 Change-Id: Ia0f1f30a04818bc6ee55a0822eaf0d2b0183e50d Reviewed-on: http://codereview.qt.nokia.com/1252 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Marco Bubke <marco.bubke@nokia.com>
This commit is contained in:
@@ -45,6 +45,7 @@ GraphicsObjectNodeInstance::GraphicsObjectNodeInstance(QGraphicsObject *graphics
|
|||||||
: ObjectNodeInstance(graphicsObject),
|
: ObjectNodeInstance(graphicsObject),
|
||||||
m_isMovable(true)
|
m_isMovable(true)
|
||||||
{
|
{
|
||||||
|
QGraphicsItemPrivate::get(graphicsObject)->sendParentChangeNotification = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
QGraphicsObject *GraphicsObjectNodeInstance::graphicsObject() const
|
QGraphicsObject *GraphicsObjectNodeInstance::graphicsObject() const
|
||||||
|
|||||||
@@ -207,13 +207,24 @@ void QmlGraphicsItemNodeInstance::refresh()
|
|||||||
repositioning(qmlGraphicsItem());
|
repositioning(qmlGraphicsItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void QmlGraphicsItemNodeInstance::recursiveDoComponentComplete(QGraphicsItem *item)
|
||||||
|
{
|
||||||
|
QGraphicsObject *graphicsObject = item->toGraphicsObject();
|
||||||
|
QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem*>(graphicsObject);
|
||||||
|
if (declarativeItem && !nodeInstanceServer()->hasInstanceForObject(declarativeItem)) {
|
||||||
|
if (QDeclarativeItemPrivate::get(qmlGraphicsItem())->componentComplete)
|
||||||
|
return;
|
||||||
|
static_cast<QDeclarativeParserStatus*>(qmlGraphicsItem())->componentComplete();
|
||||||
|
|
||||||
|
foreach (QGraphicsItem *childItem, item->childItems())
|
||||||
|
recursiveDoComponentComplete(childItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void QmlGraphicsItemNodeInstance::doComponentComplete()
|
void QmlGraphicsItemNodeInstance::doComponentComplete()
|
||||||
{
|
{
|
||||||
if (qmlGraphicsItem()) {
|
if (qmlGraphicsItem()) {
|
||||||
if (static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(qmlGraphicsItem()))->componentComplete)
|
recursiveDoComponentComplete(qmlGraphicsItem());
|
||||||
return;
|
|
||||||
static_cast<QDeclarativeParserStatus*>(qmlGraphicsItem())->componentComplete();
|
|
||||||
QGraphicsItemPrivate::get(qmlGraphicsItem())->sendParentChangeNotification = 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
graphicsObject()->update();
|
graphicsObject()->update();
|
||||||
@@ -301,7 +312,9 @@ void QmlGraphicsItemNodeInstance::reparent(const ObjectNodeInstance::Pointer &ol
|
|||||||
setMovable(true);
|
setMovable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QDeclarativeItemPrivate::get(qmlGraphicsItem())->componentComplete = 1;
|
||||||
GraphicsObjectNodeInstance::reparent(oldParentInstance, oldParentProperty, newParentInstance, newParentProperty);
|
GraphicsObjectNodeInstance::reparent(oldParentInstance, oldParentProperty, newParentInstance, newParentProperty);
|
||||||
|
QDeclarativeItemPrivate::get(qmlGraphicsItem())->componentComplete = 0;
|
||||||
|
|
||||||
if (newParentInstance && newParentInstance->isPositioner()) {
|
if (newParentInstance && newParentInstance->isPositioner()) {
|
||||||
setInPositioner(true);
|
setInPositioner(true);
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ protected:
|
|||||||
void resetHorizontal();
|
void resetHorizontal();
|
||||||
void resetVertical();
|
void resetVertical();
|
||||||
void refresh();
|
void refresh();
|
||||||
|
void recursiveDoComponentComplete(QGraphicsItem *item);
|
||||||
|
|
||||||
private: //variables
|
private: //variables
|
||||||
bool m_hasHeight;
|
bool m_hasHeight;
|
||||||
|
|||||||
Reference in New Issue
Block a user