本文整理汇总了C++中ListItem::setActive方法的典型用法代码示例。如果您正苦于以下问题:C++ ListItem::setActive方法的具体用法?C++ ListItem::setActive怎么用?C++ ListItem::setActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListItem
的用法示例。
在下文中一共展示了ListItem::setActive方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switchNotebook
void NotesWidget::switchNotebook(TreeItem::noteListType type, QStringList id, QString currentNote)
{
listType = type;
signalsDisabled = true;
bool active = true;
clear();
QSqlQuery result;
if (type == TreeItem::allNotes) {
result.prepare("SELECT title, guid, notebookGuid, created, updated FROM notes WHERE active=:active");
result.bindValue(":active", true);
} else if ((type == TreeItem::noteBook) || (type == TreeItem::stack)) {
result.prepare(QString("SELECT title, guid, notebookGuid, created, updated FROM notes WHERE notebookGuid IN (%1) AND active=:active").arg(AddSQLArray(id.count())));
BindSQLArray(result, id);
result.bindValue(":active", true);
} else if (type == TreeItem::trashBin) {
result.prepare("SELECT title, guid, notebookGuid, created, updated FROM notes WHERE active=:active");
result.bindValue(":active", false);
active = false;
} else if (type == TreeItem::conflict) {
result.prepare("SELECT notes.title, conflictingNotes.guid, notes.notebookGuid, notes.created, conflictingNotes.updated FROM conflictingNotes LEFT JOIN notes ON notes.guid = conflictingNotes.guid");
}
if (!result.exec())
LOG_ERROR("SQL: " + result.lastError().text());
while (result.next()) {
ListItem* item = new ListItem(this);
item->setText(result.value(0).toString());
item->setGUID(result.value(1).toString());
item->setNoteBookGUID(result.value(2).toString());
item->setCreated(result.value(3).toLongLong());
item->setModified(result.value(4).toLongLong());
item->setIcon(QIcon::fromTheme("basket"));
item->setActive(active);
item->setSortType(sortType);
}
if (!currentNote.isEmpty())
selectNoteWithGuid(currentNote);
sortItems();
signalsDisabled = false;
emit reloaded();
}