当前位置: 首页>>代码示例>>C++>>正文


C++ ListItem::getGUID方法代码示例

本文整理汇总了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;
}
开发者ID:MidoriYakumo,项目名称:hippo,代码行数:14,代码来源:noteswidget.cpp

示例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());
}
开发者ID:MidoriYakumo,项目名称:hippo,代码行数:25,代码来源:mainwindow.cpp

示例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));
}
开发者ID:MidoriYakumo,项目名称:hippo,代码行数:15,代码来源:mainwindow.cpp

示例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();
}
开发者ID:MidoriYakumo,项目名称:hippo,代码行数:99,代码来源:noteswidget.cpp


注:本文中的ListItem::getGUID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。