forked from qt-creator/qt-creator
QmlDesigner.NodeInstance: Better content check
Fix rendering bug for repeaters. Change-Id: I1c56bb63ff91cd8f58e349b0f8b038d1dd7d40e9 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
committed by
Thomas Hartmann
parent
9246e78d23
commit
6994079f96
@@ -66,7 +66,10 @@ QuickItemNodeInstance::~QuickItemNodeInstance()
|
|||||||
|
|
||||||
bool QuickItemNodeInstance::hasContent() const
|
bool QuickItemNodeInstance::hasContent() const
|
||||||
{
|
{
|
||||||
return m_hasContent;
|
if (m_hasContent)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return childItemsHaveContent(quickItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ServerNodeInstance> QuickItemNodeInstance::childItems() const
|
QList<ServerNodeInstance> QuickItemNodeInstance::childItems() const
|
||||||
@@ -112,12 +115,22 @@ void QuickItemNodeInstance::setHasContent(bool hasContent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool QuickItemNodeInstance::anyItemHasContent(QQuickItem *graphicsItem)
|
bool QuickItemNodeInstance::anyItemHasContent(QQuickItem *quickItem)
|
||||||
{
|
{
|
||||||
if (graphicsItem->flags().testFlag(QQuickItem::ItemHasContents))
|
if (quickItem->flags().testFlag(QQuickItem::ItemHasContents))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
foreach (QQuickItem *childItem, graphicsItem->childItems()) {
|
foreach (QQuickItem *childItem, quickItem->childItems()) {
|
||||||
|
if (anyItemHasContent(childItem))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool QuickItemNodeInstance::childItemsHaveContent(QQuickItem *quickItem)
|
||||||
|
{
|
||||||
|
foreach (QQuickItem *childItem, quickItem->childItems()) {
|
||||||
if (anyItemHasContent(childItem))
|
if (anyItemHasContent(childItem))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,6 +117,7 @@ protected:
|
|||||||
QRectF boundingRectWithStepChilds(QQuickItem *parentItem) const;
|
QRectF boundingRectWithStepChilds(QQuickItem *parentItem) const;
|
||||||
void updateDirtyNodeRecursive(QQuickItem *parentItem) const;
|
void updateDirtyNodeRecursive(QQuickItem *parentItem) const;
|
||||||
static bool anyItemHasContent(QQuickItem *graphicsItem);
|
static bool anyItemHasContent(QQuickItem *graphicsItem);
|
||||||
|
static bool childItemsHaveContent(QQuickItem *graphicsItem);
|
||||||
|
|
||||||
private: //variables
|
private: //variables
|
||||||
bool m_hasHeight;
|
bool m_hasHeight;
|
||||||
|
|||||||
Reference in New Issue
Block a user