本文整理汇总了C++中Note::exists方法的典型用法代码示例。如果您正苦于以下问题:C++ Note::exists方法的具体用法?C++ Note::exists怎么用?C++ Note::exists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Note
的用法示例。
在下文中一共展示了Note::exists方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add
void NoteHistory::add(Note note, int cursorPosition) {
if (!note.exists()) {
return;
}
NoteHistoryItem item(¬e, cursorPosition);
if (noteHistory->contains(item)) {
// decrease current index if we are going to remove an item before it
if (noteHistory->indexOf(item) < currentIndex) {
currentIndex--;
}
// remove found item
noteHistory->removeAll(item);
}
noteHistory->prepend(item);
if (currentIndex < lastIndex()) {
// increase current index
currentIndex++;
}
noteHistory->move(0, currentIndex);
currentIndex = noteHistory->indexOf(item);
qDebug() << " added to history: " << item;
}
示例2: removeTag
/**
* Removes a tag from the note
*
* @param tagName
* @return true if the tag was removed from the note
*/
bool NoteApi::removeTag(QString tagName) {
Tag tag = Tag::fetchByName(tagName);
if (!tag.exists()) {
return false;
}
Note note = Note::fetch(id);
if (!note.exists()) {
return false;
}
return tag.removeLinkToNote(note);
}
示例3: addTag
/**
* Adds a tag to the note
*
* @param tagName
* @return true if the note was tagged
*/
bool NoteApi::addTag(QString tagName) {
if (tagName.isEmpty()) {
return false;
}
Note note = Note::fetch(id);
if (!note.exists()) {
return false;
}
// create a new tag if it doesn't exist
Tag tag = Tag::fetchByName(tagName);
if (!tag.isFetched()) {
tag.setName(tagName);
tag.store();
}
return tag.linkToNote(note);
}
示例4: isNoteValid
bool NoteHistoryItem::isNoteValid() {
Note note = getNote();
return note.exists();
}