| 62 | ModelsManager::~ModelsManager() {} |
| 63 | |
| 64 | QString ModelsManager::addView(QAbstractItemView* view) |
| 65 | { |
| 66 | if (m_models->contains(view)) { |
| 67 | return m_models->nameForView(view); |
| 68 | } |
| 69 | |
| 70 | Q_ASSERT(m_controller); |
| 71 | |
| 72 | QString name; |
| 73 | const auto namesOfRegisterGroups = m_controller->namesOfRegisterGroups(); |
| 74 | for (const GroupsName& group : namesOfRegisterGroups) { |
| 75 | if (!m_models->contains(group.name())) { |
| 76 | QStandardItemModel* m = m_models->addModel(Model(group.name(), QSharedPointer<QStandardItemModel>(new QStandardItemModel()), view)); |
| 77 | view->setModel(m); |
| 78 | |
| 79 | if (group.type() == flag) { |
| 80 | connect(view, &QAbstractItemView::doubleClicked, this, &ModelsManager::flagChanged, Qt::UniqueConnection); |
| 81 | } |
| 82 | |
| 83 | name = group.name(); |
| 84 | load(group); |
| 85 | break; |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | return name; |
| 90 | } |
| 91 | |
| 92 | void ModelsManager::updateModelForGroup(const RegistersGroup& group) |
| 93 | { |
nothing calls this directly
no test coverage detected