m_mask->setVisible(false);
}
-void SubcomponentEditorTool::setContext(int contextIndex)
+QGraphicsObject *SubcomponentEditorTool::setContext(int contextIndex)
{
Q_ASSERT(contextIndex >= 0);
// sometimes we have to delete the context while user was still clicking around,
// so just bail out.
if (contextIndex >= m_currentContext.size() -1)
- return;
+ return 0;
while (m_currentContext.size() - 1 > contextIndex) {
popContext();
}
+ return m_currentContext.top();
+}
+
+int SubcomponentEditorTool::contextIndex() const
+{
+ return m_currentContext.size() - 1;
}
void pushContext(QGraphicsObject *contextItem);
QGraphicsObject *popContext();
QGraphicsObject *currentRootItem() const;
-
-public slots:
- void setContext(int contextIndex);
+ QGraphicsObject *setContext(int contextIndex);
+ int contextIndex() const;
signals:
void exitContextRequested();
void QDeclarativeDesignView::setInspectorContext(int contextIndex)
{
- data->subcomponentEditorTool->setContext(contextIndex);
+ if (data->subcomponentEditorTool->contextIndex() != contextIndex) {
+ QGraphicsObject *object = data->subcomponentEditorTool->setContext(contextIndex);
+ if (object)
+ qmlDesignDebugServer()->setCurrentObjects(QList<QObject*>() << object);
+ }
}
void QDeclarativeDesignViewPrivate::_q_reloadView()
data->cursorPos = event->pos();
data->currentTool->mouseReleaseEvent(event);
- //qmlDesignDebugServer()->setCurrentObjects(AbstractFormEditorTool::toObjectList(selectedItems()));
+ qmlDesignDebugServer()->setCurrentObjects(AbstractFormEditorTool::toObjectList(selectedItems()));
}
void QDeclarativeDesignView::keyPressEvent(QKeyEvent *event)
}
}
currentTool->updateSelectedItems();
+ qmlDesignDebugServer()->setCurrentObjects(AbstractFormEditorTool::toObjectList(items));
}
QList<QGraphicsItem *> QDeclarativeDesignViewPrivate::selectedItems()