예제 #1
0
    /**
     * @brief ProjectDatabase::addExistsScope
     * @param scope
     * @return
     */
    Entity::SharedScope ProjectDatabase::addExistsScope(const Entity::SharedScope &scope)
    {
        Database::addExistsScope(scope);
        G_CONNECT(scope.get(), &Entity::Scope::typeSearcherRequired,
                  this, &ProjectDatabase::onTypeUserAdded);

        return scope;
    }
예제 #2
0
    /**
     * @brief ProjectTreeModel::addScope
     * @param scope
     * @param parent
     */
    void ProjectTreeModel::addScope(const entity::SharedScope &scope, const QString &projectName)
    {
        if (auto &&pr = find(projectName)) {
            auto &&projectIndex = index(indexOf(pr), 0);
            Q_ASSERT(projectIndex.isValid());

            auto pos = projectIndex.row() + 1;
            beginInsertRows(projectIndex, pos, pos);
            auto &&newItem = pr->makeChild(QVariant::fromValue(scope), TreeItemType::ScopeItem);
            endInsertRows();

            observeItemChanging(m_CurrentProject, scope.get(), newItem);
        }
    }