本文整理汇总了C++中ListItem::getGUID方法的典型用法代码示例。如果您正苦于以下问题:C++ ListItem::getGUID方法的具体用法?C++ ListItem::getGUID怎么用?C++ ListItem::getGUID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListItem
的用法示例。
在下文中一共展示了ListItem::getGUID方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getNoteWithGuid
ListItem* NotesWidget::getNoteWithGuid(QString guid)
{
ListItem* item = reinterpret_cast<ListItem*>(this->currentItem());
if ((item != NULL) && (item->getGUID() == guid))
return item;
for (int i = 0; i < count(); i++) {
ListItem* item = reinterpret_cast<ListItem*>(this->item(i));
if (item->getGUID() == guid) {
return item;
}
}
return NULL;
}
示例2: saveSelectionState
void MainWindow::saveSelectionState(QString notebook) {
QSqlQuery query;
if (!query.exec("DELETE FROM syncStatus WHERE option IN ('selNotebook', 'selTab', 'selNote', 'selTag')"))
LOG_ERROR("SQL: " + query.lastError().text());
sql::updateSyncStatus("selTab", ui->toolBox->currentIndex());
if (notebook.isEmpty() && (ui->notebooks->currentItem() != NULL)) {
TreeItem* n = reinterpret_cast<TreeItem*>(ui->notebooks->currentItem());
notebook = n->getName();
}
if (!notebook.isEmpty())
sql::updateSyncStatus("selNotebook", notebook);
QStringList tagGuids = ui->tags->currentGuids();
if (!tagGuids.isEmpty())
sql::updateSyncStatus("selTag", tagGuids.first());
if (ui->NotesList->currentItem() == NULL)
return;
ListItem* l = reinterpret_cast<ListItem*>(ui->NotesList->currentItem());
sql::updateSyncStatus("selNote", l->getGUID());
}
示例3: switchNote
void MainWindow::switchNote()
{
ListItem* l = reinterpret_cast<ListItem*>(ui->NotesList->currentItem());
QString id = l->getGUID();
if (id.isEmpty())
return;
ui->noteTitle->clear();
ui->titleBar->show();
ui->editButton->setChecked(false);
clearConflictBar();
JS(QString("loadNote('%1', false);").arg(id));
}
示例4: contextMenuEvent
void NotesWidget::contextMenuEvent (QContextMenuEvent * event)
{
ListItem* item = reinterpret_cast<ListItem*>(this->itemAt(event->pos()));
QMenu menu(this);
QMenu *sortMenu = menu.addMenu(QIcon::fromTheme("view-sort-ascending"), "Sort By");
QActionGroup *sortActions = new QActionGroup(this);
sortActions->setExclusive(true);
QAction *sortByTitle = new QAction("Title", this);
sortByTitle->setObjectName("sortByTitle");
sortByTitle->setCheckable(true);
sortByTitle->setChecked(sortType == byTitle);
sortMenu->addAction(sortByTitle);
sortActions->addAction(sortByTitle);
QAction *sortByTitleDesc = new QAction("Title Desc...", this);
sortByTitleDesc->setObjectName("sortByTitleDesc");
sortByTitleDesc->setCheckable(true);
sortByTitleDesc->setChecked(sortType == byTitleDesc);
sortMenu->addAction(sortByTitleDesc);
sortActions->addAction(sortByTitleDesc);
QAction *sortByCreated = new QAction("Created Date", this);
sortByCreated->setObjectName("sortByCreated");
sortByCreated->setCheckable(true);
sortByCreated->setChecked(sortType == byCreated);
sortMenu->addAction(sortByCreated);
sortActions->addAction(sortByCreated);
QAction *sortByCreatedDesc = new QAction("Created Date Desc...", this);
sortByCreatedDesc->setObjectName("sortByCreatedDesc");
sortByCreatedDesc->setCheckable(true);
sortByCreatedDesc->setChecked(sortType == byCreatedDesc);
sortMenu->addAction(sortByCreatedDesc);
sortActions->addAction(sortByCreatedDesc);
QAction *sortByModified = new QAction("Modified Date", this);
sortByModified->setObjectName("sortByModified");
sortByModified->setCheckable(true);
sortByModified->setChecked(sortType == byModified);
sortMenu->addAction(sortByModified);
sortActions->addAction(sortByModified);
QAction *sortByModifiedDesc = new QAction("Modified Date Desc...", this);
sortByModifiedDesc->setObjectName("sortByModifiedDesc");
sortByModifiedDesc->setCheckable(true);
sortByModifiedDesc->setChecked(sortType == byModifiedDesc);
sortMenu->addAction(sortByModifiedDesc);
sortActions->addAction(sortByModifiedDesc);
if (item == NULL) {
QAction *newNote = new QAction(QIcon::fromTheme("document-new"), "New Note...", this);
newNote->setObjectName("new");
newNote->setDisabled(listType == TreeItem::trashBin);
menu.addAction(newNote);
} else {
if (item->isActive()) {
QAction *del = new QAction(QIcon::fromTheme("edit-delete"), "Delete Note", this);
del->setObjectName("delete");
menu.addAction(del);
} else {
QAction *res = new QAction("Restore", this);
res->setObjectName("restore");
menu.addAction(res);
}
}
QAction *ret = menu.exec(event->globalPos());
if (ret == NULL) {
event->ignore();
return;
}
if (ret->objectName() == "delete")
emit noteDeleted(item->getGUID());
else if (ret->objectName() == "restore")
emit noteRestored(item->getGUID());
else if (ret->objectName() == "new")
emit noteCreated();
else if (ret->objectName() == "sortByTitle")
setNoteSortType(byTitle);
else if (ret->objectName() == "sortByCreated")
setNoteSortType(byCreated);
else if (ret->objectName() == "sortByModified")
setNoteSortType(byModified);
else if (ret->objectName() == "sortByTitleDesc")
setNoteSortType(byTitleDesc);
else if (ret->objectName() == "sortByCreatedDesc")
setNoteSortType(byCreatedDesc);
else if (ret->objectName() == "sortByModifiedDesc")
setNoteSortType(byModifiedDesc);
event->accept();
}