コード例 #1
0
ファイル: tag.cpp プロジェクト: XavierCLL/QOwnNotes
    Q_FOREACH(Tag tag, fetchAllByParentId(id)) {
            qDebug() << __func__ << " - 'tag': " << tag;

            if ((tag.getId() == tagId) || tag.hasChild(tagId)) {
                return true;
            }
        }
コード例 #2
0
ファイル: Tag.cpp プロジェクト: ah450/movie-project
bool Tag::operator== (const Tag &other)
{
    if ( this->getId() == other.getId() &&
         this->getName() == other.getName() )
    {
        return true;
    }

    return false;
}
コード例 #3
0
void TagCatalog::relateTagToKnowledge(Tag tag, KnowledgeItem knowledge)
{
    if ( !exist(tag) )
        add(tag);

    DB *db = DB::getInstance();
    QString query = QString("INSERT INTO `KnowledgeTag` VALUES (NULL,'%1','%2')").
            arg(knowledge.getId()).
            arg(tag.getId());

    db->executeQuery(query);
}
コード例 #4
0
ファイル: noteapi.cpp プロジェクト: pbek/QOwnNotes
/**
 * Returns all linked tags
 */
QQmlListProperty<TagApi> NoteApi::tags() {
    _tags.clear();

    Note note = Note::fetch(id);
    QList<Tag> tags = Tag::fetchAllOfNote(note);
    QListIterator<Tag> itr(tags);
    while (itr.hasNext()) {
        Tag tag = itr.next();

        TagApi* tagApi = new TagApi();
        tagApi->fetch(tag.getId());
        _tags.append(tagApi);
    }

    return QQmlListProperty<TagApi>(this, _tags);
}