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