Commit 369b63ec authored by Lasse Holmstedt's avatar Lasse Holmstedt Committed by Olivier Goffart
Browse files

added flags for ignoring context while highlighting

parent 8936292d
......@@ -274,19 +274,22 @@ void QDeclarativeDesignView::clearHighlight()
m_boundingRectHighlighter->clear();
}
void QDeclarativeDesignView::highlight(QGraphicsItem * item)
void QDeclarativeDesignView::highlight(QGraphicsItem * item, ContextFlags flags)
{
highlight(QList<QGraphicsItem*>() << item);
highlight(QList<QGraphicsItem*>() << item, flags);
}
void QDeclarativeDesignView::highlight(QList<QGraphicsItem *> items)
void QDeclarativeDesignView::highlight(QList<QGraphicsItem *> items, ContextFlags flags)
{
if (items.isEmpty())
return;
QList<QGraphicsObject*> objectList;
foreach(QGraphicsItem *item, items) {
QGraphicsItem *child = m_subcomponentEditorTool->firstChildOfContext(item);
QGraphicsItem *child = item;
if (flags & ContextSensitive)
child = m_subcomponentEditorTool->firstChildOfContext(item);
if (child) {
QGraphicsObject *childObject = child->toGraphicsObject();
if (childObject)
......@@ -457,7 +460,6 @@ QList<QGraphicsItem*> QDeclarativeDesignView::filterForCurrentContext(QList<QGra
itemlist.removeAt(index);
}
}
}
return itemlist;
......@@ -491,8 +493,7 @@ void QDeclarativeDesignView::onCurrentObjectsChanged(QList<QObject*> objects)
setSelectedItems(items);
clearHighlight();
if (!items.isEmpty())
highlight(items);
highlight(items, IgnoreContext);
}
QToolBar *QDeclarativeDesignView::toolbar() const
......
......@@ -23,6 +23,10 @@ class QDeclarativeDesignView : public QDeclarativeView
{
Q_OBJECT
public:
enum ContextFlags {
IgnoreContext,
ContextSensitive
};
explicit QDeclarativeDesignView(QWidget *parent = 0);
~QDeclarativeDesignView();
......@@ -36,8 +40,8 @@ public:
Constants::ToolFlags flags = Constants::NoToolFlags);
void clearHighlight();
void highlight(QList<QGraphicsItem *> item);
void highlight(QGraphicsItem *item);
void highlight(QList<QGraphicsItem *> item, ContextFlags flags = ContextSensitive);
void highlight(QGraphicsItem *item, ContextFlags flags = ContextSensitive);
bool mouseInsideContextItem() const;
bool isEditorItem(QGraphicsItem *item) const;
......
Markdown is supported
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