本文整理汇总了C++中MyMoneyFile::tagList方法的典型用法代码示例。如果您正苦于以下问题:C++ MyMoneyFile::tagList方法的具体用法?C++ MyMoneyFile::tagList怎么用?C++ MyMoneyFile::tagList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MyMoneyFile
的用法示例。
在下文中一共展示了MyMoneyFile::tagList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadTags
void KTagsView::loadTags()
{
if (m_inSelection)
return;
QMap<QString, bool> isSelected;
QString id;
MyMoneyFile* file = MyMoneyFile::instance();
// remember which items are selected in the list
QList<QListWidgetItem *> selectedItems = m_tagsList->selectedItems();
QList<QListWidgetItem *>::const_iterator tagsIt = selectedItems.constBegin();
while (tagsIt != selectedItems.constEnd()) {
KTagListItem* item = dynamic_cast<KTagListItem*>(*tagsIt);
if (item)
isSelected[item->tag().id()] = true;
++tagsIt;
}
// keep current selected item
KTagListItem *currentItem = static_cast<KTagListItem *>(m_tagsList->currentItem());
if (currentItem)
id = currentItem->tag().id();
m_allowEditing = false;
// clear the list
m_searchWidget->clear();
m_searchWidget->updateSearch();
m_tagsList->clear();
m_register->clear();
currentItem = 0;
QList<MyMoneyTag>list = file->tagList();
QList<MyMoneyTag>::ConstIterator it;
for (it = list.constBegin(); it != list.constEnd(); ++it) {
if (m_tagFilterType == eAllTags ||
(m_tagFilterType == eReferencedTags && file->isReferenced(*it)) ||
(m_tagFilterType == eUnusedTags && !file->isReferenced(*it)) ||
(m_tagFilterType == eOpenedTags && !(*it).isClosed()) ||
(m_tagFilterType == eClosedTags && (*it).isClosed())) {
KTagListItem* item = new KTagListItem(m_tagsList, *it);
if (item->tag().id() == id)
currentItem = item;
if (isSelected[item->tag().id()])
item->setSelected(true);
}
}
m_tagsList->sortItems();
if (currentItem) {
m_tagsList->setCurrentItem(currentItem);
m_tagsList->scrollToItem(currentItem);
}
m_filterProxyModel->invalidate();
slotSelectTag(0, 0);
m_allowEditing = true;
}