diff options
author | Katja Marttila <katja.marttila@qt.io> | 2019-05-28 12:50:13 +0300 |
---|---|---|
committer | Katja Marttila <katja.marttila@qt.io> | 2021-02-11 09:41:19 +0200 |
commit | 4abb9cd9b360278f5c8984a9fd2e62677e7c940c (patch) | |
tree | 5b7721b82eefe103dc9f148f4323ef31de28731b /src/libs/installer/componentmodel.cpp | |
parent | 5aee36b74eb1d7613ea0108971e8a22f8dca8101 (diff) |
Add possibility to move component in component tree
Setting <TreeName> -tag to component.xml will overwrite the default location
of component in installer's tree view. This way we can define the component
location without a complete repo build. Updates.xml can be directly modified
by adding <TreeName> -tag for easy relocation of components. TreeName must be
an unique name - it cannot conflict with existing tree name or name.
Task-number: QTIFW-594
Change-Id: Ie69f90f1303d932369d566d0d7b4bc0e354505c6
Reviewed-by: Arttu Tarkiainen <arttu.tarkiainen@qt.io>
Diffstat (limited to 'src/libs/installer/componentmodel.cpp')
-rw-r--r-- | src/libs/installer/componentmodel.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/libs/installer/componentmodel.cpp b/src/libs/installer/componentmodel.cpp index 45e27ba4a..aab487b45 100644 --- a/src/libs/installer/componentmodel.cpp +++ b/src/libs/installer/componentmodel.cpp @@ -1,6 +1,6 @@ /************************************************************************** ** -** Copyright (C) 2017 The Qt Company Ltd. +** Copyright (C) 2021 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Installer Framework. @@ -159,7 +159,7 @@ QModelIndex ComponentModel::parent(const QModelIndex &child) const if (Component *childComponent = componentFromIndex(child)) { if (Component *parent = childComponent->parentComponent()) - return indexFromComponentName(parent->name()); + return indexFromComponentName(parent->treeName()); } return QModelIndex(); } @@ -513,18 +513,18 @@ void ComponentModel::updateAndEmitModelState() emit checkStateChanged(m_modelState); foreach (const Component *component, m_rootComponentList) { - emit dataChanged(indexFromComponentName(component->name()), - indexFromComponentName(component->name())); + emit dataChanged(indexFromComponentName(component->treeName()), + indexFromComponentName(component->treeName())); QList<Component *> children = component->childItems(); foreach (const Component *child, children) - emit dataChanged(indexFromComponentName(child->name()), - indexFromComponentName(child->name())); + emit dataChanged(indexFromComponentName(child->treeName()), + indexFromComponentName(child->treeName())); } } void ComponentModel::collectComponents(Component *const component, const QModelIndex &parent) const { - m_indexByNameCache.insert(component->name(), parent); + m_indexByNameCache.insert(component->treeName(), parent); for (int i = 0; i < component->childCount(); ++i) collectComponents(component->childAt(i), index(i, 0, parent)); } @@ -568,8 +568,8 @@ QSet<QModelIndex> ComponentModel::updateCheckedState(const ComponentSet &compone // get all parent nodes for the components we're going to update QMap<QString, Component *> sortedNodesMap; foreach (Component *component, components) { - while (component && !sortedNodesMap.values(component->name()).contains(component)) { - sortedNodesMap.insertMulti(component->name(), component); + while (component && !sortedNodesMap.values(component->treeName()).contains(component)) { + sortedNodesMap.insertMulti(component->treeName(), component); component = component->parentComponent(); } } @@ -596,7 +596,7 @@ QSet<QModelIndex> ComponentModel::updateCheckedState(const ComponentSet &compone continue; node->setCheckState(newState); - changed.insert(indexFromComponentName(node->name())); + changed.insert(indexFromComponentName(node->treeName())); m_currentCheckedState[Qt::Checked].remove(node); m_currentCheckedState[Qt::Unchecked].remove(node); |