Commit a060480e authored by Marco Bubke's avatar Marco Bubke Committed by Thomas Hartmann
Browse files

QmlDesigner.NodeInstances: Item with content are selectable

If a list view for example has content it is now selectable too.

Task-number: QTCREATORBUG-5476
Change-Id: Ifb0902edcda064e488337c94fc4e575994da3ef1
Reviewed-on: http://codereview.qt.nokia.com/1786

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@nokia.com>
parent 97ad34bc
......@@ -34,6 +34,8 @@
#include <QGraphicsObject>
#include "private/qgraphicsitem_p.h"
#include <private/qdeclarativemetatype_p.h>
#include <QStyleOptionGraphicsItem>
#include <QPixmap>
#include <QSizeF>
......@@ -57,9 +59,28 @@ QGraphicsObject *GraphicsObjectNodeInstance::graphicsObject() const
return static_cast<QGraphicsObject*>(object());
}
bool GraphicsObjectNodeInstance::childrenHasContent(QGraphicsItem *graphicsItem) const
{
QGraphicsObject *graphicsObject = graphicsItem->toGraphicsObject();
if (graphicsObject && !nodeInstanceServer()->hasInstanceForObject(graphicsObject) && !graphicsItem->flags().testFlag(QGraphicsItem::ItemHasNoContents))
return true;
foreach (QGraphicsItem *childItem, graphicsItem->childItems()) {
bool childHasContent = childrenHasContent(childItem);
if (childHasContent)
return true;
}
return false;
}
bool GraphicsObjectNodeInstance::hasContent() const
{
return m_hasContent;
if (m_hasContent)
return true;
return childrenHasContent(graphicsObject());
}
QList<ServerNodeInstance> GraphicsObjectNodeInstance::childItems() const
......
......@@ -88,7 +88,7 @@ protected:
QGraphicsObject *graphicsObject() const;
void paintRecursively(QGraphicsItem *graphicsItem, QPainter *painter) const;
QRectF boundingRectWithStepChilds(QGraphicsItem *parentItem) const;
bool childrenHasContent(QGraphicsItem *graphicsItem) const;
private: // variables
bool m_hasContent;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment