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