forked from qt-creator/qt-creator
QmlDesigner.documentController: adding instance()
Also exposing changeCurrentModelTo() as public API. Change-Id: I7c9ed3679ef5859b1349f1d1fe3088e78bccc7ad Reviewed-on: http://codereview.qt.nokia.com/787 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Thomas Hartmann <Thomas.Hartmann@nokia.com>
This commit is contained in:
@@ -72,6 +72,11 @@ ModelNode ComponentView::modelNode(int index) const
|
||||
return ModelNode();
|
||||
}
|
||||
|
||||
void ComponentView::setComponentNode(const ModelNode &node)
|
||||
{
|
||||
m_componentAction->setCurrentIndex(indexForNode(node));
|
||||
}
|
||||
|
||||
void ComponentView::appendWholeDocumentAsComponent()
|
||||
{
|
||||
QStandardItem *item = new QStandardItem(tr("whole document"));
|
||||
@@ -88,6 +93,16 @@ void ComponentView::removeSingleNodeFromList(const ModelNode &node)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int ComponentView::indexForNode(const ModelNode &node)
|
||||
{
|
||||
for (int row = 0; row < m_standardItemModel->rowCount(); row++) {
|
||||
if (m_standardItemModel->item(row)->data(ModelNodeRole).value<ModelNode>() == node)
|
||||
return row;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ComponentView::modelAttached(Model *model)
|
||||
{
|
||||
if (AbstractView::model() == model)
|
||||
|
||||
Reference in New Issue
Block a user