本文整理汇总了C++中ListViewItem类的典型用法代码示例。如果您正苦于以下问题:C++ ListViewItem类的具体用法?C++ ListViewItem怎么用?C++ ListViewItem使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ListViewItem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: currentId
void
PriceBatchList::performRefresh()
{
bool showInactive = _inactive->isChecked();
Id batch_id = currentId();
QListViewItem* current = NULL;
clearLists();
PriceBatchSelect conditions;
conditions.activeOnly = !showInactive;
vector<PriceBatch> batches;
_quasar->db()->select(batches, conditions);
for (unsigned int i = 0; i < batches.size(); i++) {
PriceBatch& batch = batches[i];
ListViewItem* lvi = new ListViewItem(_list, batch.id());
lvi->setText(0, batch.number());
lvi->setText(1, batch.description());
if (showInactive) lvi->setValue(2, !batch.isActive());
if (batch.id() == batch_id) current = lvi;
}
if (current == NULL) current = _list->firstChild();
_list->setCurrentItem(current);
_list->setSelected(current, true);
}
示例2: currentId
void
TaxList::performRefresh()
{
bool showInactive = _inactive->isChecked();
Id tax_id = currentId();
QListViewItem* current = NULL;
clearLists();
TaxSelect conditions;
conditions.activeOnly = !showInactive;
vector<Tax> taxes;
_quasar->db()->select(taxes, conditions);
for (unsigned int i = 0; i < taxes.size(); i++) {
Tax& tax = taxes[i];
fixed rate = _db->taxRate(tax);
ListViewItem* lvi = new ListViewItem(_list, tax.id());
lvi->setValue(0, tax.name());
lvi->setValue(1, tax.description());
lvi->setValue(2, rate);
if (showInactive) lvi->setValue(3, !tax.isActive());
if (tax.id() == tax_id) current = lvi;
}
if (current == NULL) current = _list->firstChild();
_list->setCurrentItem(current);
_list->setSelected(current, true);
}
示例3: currentId
void
GroupList::performRefresh()
{
bool showInactive = _inactive->isChecked();
Id group_id = currentId();
QListViewItem* current = NULL;
clearLists();
GroupSelect conditions;
conditions.activeOnly = !showInactive;
vector<Group> groups;
_quasar->db()->select(groups, conditions);
for (unsigned int i = 0; i < groups.size(); ++i) {
Group& group = groups[i];
ListViewItem* lvi = new ListViewItem(_list, group.id());
lvi->setText(0, group.name());
lvi->setText(1, group.typeName());
if (showInactive) lvi->setValue(2, !group.isActive());
if (group.id() == group_id) current = lvi;
}
if (current == NULL) current = _list->firstChild();
_list->setCurrentItem(current);
_list->setSelected(current, true);
}
示例4: ListViewItem
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
int ListViewPanel::AddItem(const KeyValues *data, bool bScrollToItem, bool bSortOnAdd)
{
ListViewItem *pNewItem = new ListViewItem(this);
pNewItem->SetData(data);
if (m_hFont)
{
pNewItem->SetFont(m_hFont);
}
int itemID = m_DataItems.AddToTail(pNewItem);
ApplyItemChanges(itemID);
m_SortedItems.AddToTail(itemID);
if ( bSortOnAdd )
{
m_bNeedsSort = true;
}
InvalidateLayout();
if ( bScrollToItem )
{
ScrollToItem(itemID);
}
return itemID;
}
示例5: currentId
void
CompanyList::performRefresh()
{
bool showInactive = _inactive->isChecked();
Id company_id = currentId();
QListViewItem* current = NULL;
clearLists();
CompanySelect conditions;
conditions.activeOnly = !showInactive;
vector<Company> companies;
_quasar->db()->select(companies, conditions);
for (unsigned int i = 0; i < companies.size(); ++i) {
Company& company = companies[i];
ListViewItem* lvi = new ListViewItem(_list, company.id());
lvi->setValue(0, company.name());
lvi->setValue(1, company.number());
if (showInactive) lvi->setValue(2, !company.isActive());
if (company.id() == company_id) current = lvi;
}
if (current == NULL) current = _list->firstChild();
_list->setCurrentItem(current);
_list->setSelected(current, true);
}
示例6: add_player_message
void GameViewChat::add_player_message(GamePlayer *player, const std::string &message)
{
ListViewItem item = listview_chat->create_item();
std::string chat_message = string_format("%1: %2", player->name, message);
item.set_column_text("message", chat_message);
listview_chat->get_document_item().append_child(item);
}
示例7: text
void
ExtraLookup::refresh()
{
ExtraSelect conditions;
if (!text().isEmpty())
conditions.name = text() + "%";
conditions.table = table->text();
conditions.activeOnly = activeOnly;
vector<Extra> extras;
_quasar->db()->select(extras, conditions);
_list->clear();
for (unsigned int i = 0; i < extras.size(); ++i) {
Extra& extra = extras[i];
ListViewItem* item = new ListViewItem(_list, extra.id());
item->setValue(0, extra.name());
item->setValue(1, extra.table());
}
QListViewItem* current = _list->firstChild();
_list->setCurrentItem(current);
_list->setSelected(current, true);
}
示例8: text
void
StoreLookup::refresh()
{
StoreSelect conditions;
if (!text().isEmpty())
conditions.name = text() + "%";
conditions.sellOnly = sellOnly;
conditions.activeOnly = activeOnly;
vector<Store> stores;
_quasar->db()->select(stores, conditions);
_list->clear();
for (unsigned int i = 0; i < stores.size(); ++i) {
Store& store = stores[i];
ListViewItem* item = new ListViewItem(_list, store.id());
item->setText(0, store.name());
item->setText(1, store.number());
}
QListViewItem* current = _list->firstChild();
_list->setCurrentItem(current);
_list->setSelected(current, true);
}
示例9: listViewItemClicked
/**
* This method is called when the user selects an item from
* the list view
* @param listView The list view object that generated the event
* @param listViewItem The ListViewItem object that was clicked.
*/
void MainScreen::listViewItemClicked(ListView* listView, ListViewItem* listViewItem)
{
int listViewItemIndex = -1;
for(int i = 0; i < listView->countChildWidgets(); i++)
{
ListViewItem* currentItem = (ListViewItem*)listView->getChild(i);
currentItem->setBackgroundColor(0xFFFFFF);
if (currentItem == listViewItem)
{
listViewItemIndex = i;
}
}
if (listView == mInputModeListView)
{
listViewItem->setBackgroundColor(0xFF0000);
if (listViewItemIndex >= 0)
{
this->setInputMode(listViewItemIndex);
}
}
else if (listView == mInputFlagListView)
{
listViewItem->setBackgroundColor(0xFF0000);
if (listViewItemIndex >= 0)
{
this->setInputFlag(listViewItemIndex);
}
}
}
示例10: ListViewItem
void
DriverConfigTab::loadData()
{
QListViewItem* item = _drivers->currentItem();
QString currentName;
if (item != NULL) currentName = item->text(0);
QStringList drivers = Driver::types();
_drivers->clear();
QListViewItem* current = NULL;
for (unsigned int i = 0; i < drivers.size(); ++i) {
const QString& driver = drivers[i];
ListViewItem* lvi = new ListViewItem(_drivers);
lvi->setText(0, driver);
if (driver == currentName)
current = lvi;
}
if (current == NULL) current = _drivers->firstChild();
_drivers->setCurrentItem(current);
_drivers->setSelected(current, true);
}
示例11: currentId
void
CustomerTypeList::performRefresh()
{
bool showInactive = _inactive->isChecked();
Id type_id = currentId();
QListViewItem* current = NULL;
clearLists();
CustomerTypeSelect conditions;
conditions.activeOnly = !showInactive;
vector<CustomerType> types;
_quasar->db()->select(types, conditions);
for (unsigned int i = 0; i < types.size(); i++) {
CustomerType& type = types[i];
Account account;
_quasar->db()->lookup(type.accountId(), account);
ListViewItem* lvi = new ListViewItem(_list, type.id());
lvi->setText(0, type.name());
lvi->setText(1, account.name());
if (showInactive) lvi->setValue(2, !type.isActive());
if (type.id() == type_id) current = lvi;
}
if (current == NULL) current = _list->firstChild();
_list->setCurrentItem(current);
_list->setSelected(current, true);
}
示例12: currentId
void
GltxList::performRefresh()
{
Id gltx_id = currentId();
QListViewItem* current = NULL;
clearLists();
vector<Gltx> gltxs;
_quasar->db()->select(gltxs, GltxSelect());
DateValcon dateValcon;
for (unsigned int i = 0; i < gltxs.size(); i++) {
Gltx& gltx = gltxs[i];
ListViewItem* lvi = new ListViewItem(_list, gltx.id());
lvi->setText(0, dateValcon.format(gltx.postDate()));
lvi->setText(1, gltx.memo());
if (gltx.id() == gltx_id)
current = lvi;
}
if (current == NULL)
current = _list->firstChild();
_list->setCurrentItem(current);
_list->setSelected(current, true);
}
示例13: text
void
DiscountLookup::refresh()
{
DiscountSelect conditions;
if (!text().isEmpty())
conditions.name = text() + "%";
conditions.lineOnly = lineOnly;
conditions.txOnly = txOnly;
conditions.activeOnly = activeOnly;
vector<Discount> discounts;
_quasar->db()->select(discounts, conditions);
_list->clear();
for (unsigned int i = 0; i < discounts.size(); ++i) {
Discount& discount = discounts[i];
ListViewItem* item = new ListViewItem(_list, discount.id());
item->setText(0, discount.name());
}
QListViewItem* current = _list->firstChild();
_list->setCurrentItem(current);
_list->setSelected(current, true);
}
示例14: clearData
void
ReportList::slotRefresh()
{
QApplication::setOverrideCursor(waitCursor);
qApp->processEvents();
clearData();
_quasar->resourceList("reports", ".name", ".module", _files, _names,
_modules);
for (unsigned int i = 0; i < _names.size(); ++i) {
ListView* list = findModule(_modules[i]);
ListViewItem* item = new ListViewItem(list);
item->extra.push_back(_files[i]);
item->setValue(0, _names[i]);
if (_modules[i] != tr("All")) {
list = findModule(tr("All"));
item = new ListViewItem(list);
item->extra.push_back(_files[i]);
item->setValue(0, _names[i]);
item->setValue(1, _modules[i]);
}
}
if (_module->firstChild() != NULL) {
_module->setSelected(_module->firstChild(), true);
_module->setCurrentItem(_module->firstChild());
}
slotModuleChange();
QApplication::restoreOverrideCursor();
}
示例15: currentId
void
TenderList::performRefresh()
{
bool showInactive = _inactive->isChecked();
Id tender_id = currentId();
QListViewItem* current = NULL;
clearLists();
TenderSelect conditions;
conditions.activeOnly = !showInactive;
vector<Tender> tenders;
_quasar->db()->select(tenders, conditions);
for (unsigned int i = 0; i < tenders.size(); i++) {
Tender& tender = tenders[i];
ListViewItem* lvi = new ListViewItem(_list, tender.id());
lvi->setValue(0, tender.name());
lvi->setValue(1, tender.typeName());
if (showInactive) lvi->setValue(2, !tender.isActive());
if (tender.id() == tender_id)
current = lvi;
}
if (current == NULL)
current = _list->firstChild();
_list->setCurrentItem(current);
_list->setSelected(current, true);
}