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); }
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); }
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); }
//----------------------------------------------------------------------------- // 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; }
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); }
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); }
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); }
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); }
/** * 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); } } }
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); }
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); }
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); }
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); }
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(); }
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); }
void SubdeptLookup::refresh() { SubdeptSelect conditions; if (!text().isEmpty()) conditions.name = text() + "%"; conditions.dept_id = dept->getId(); conditions.activeOnly = activeOnly; vector<Subdept> subdepts; _quasar->db()->select(subdepts, conditions); _list->clear(); for (unsigned int i = 0; i < subdepts.size(); ++i) { Subdept& subdept = subdepts[i]; Dept dept; findDept(subdept.deptId(), dept); ListViewItem* item = new ListViewItem(_list, subdept.id()); item->setValue(0, subdept.name()); item->setValue(1, subdept.number()); item->setValue(2, dept.name()); } QListViewItem* current = _list->firstChild(); _list->setCurrentItem(current); _list->setSelected(current, true); }
/** * Show currently used selection style for an list view item. * Works on iOS platform. */ void SettingsScreen::showSelectionStyleMessageBox() { MAUtil::String textToShow; if (mListView->countChildWidgets() == 0) { textToShow = "The list view section does not have sections."; } else { ListViewSection* section = (ListViewSection*) mListView->getChild(0); if (section->countChildWidgets() == 0) { textToShow = "The list view section does not have items."; } else { ListViewItem* item = (ListViewItem*) section->getChild(0); ListViewItemSelectionStyle selectionStyle = item->getSelectionStyle(); textToShow = "The selection style is: " + getSelectionStyleString(selectionStyle); } } maAlert("ListViewItem selection style", textToShow.c_str(), "OK", NULL, NULL); }
/** * Create ListView item properties layout */ void SettingsScreen::createListViewItemPropertiesLayout() { VerticalLayout* listViewItemPropertiesVerticalLayout = new VerticalLayout(); listViewItemPropertiesVerticalLayout->wrapContentVertically(); mCurrentListViewItemLabel = new Label(); mCurrentListViewItemLabel->setText("No item selected"); mCurrentListViewItemLabel->setFontSize(TITLE_FONT_SIZE); mCurrentListViewItemLabel->setFontColor(0xFF0000); listViewItemPropertiesVerticalLayout->addChild(mCurrentListViewItemLabel); createListViewItemTextLayout(listViewItemPropertiesVerticalLayout); createListViewItemFontColorLayout(listViewItemPropertiesVerticalLayout); createListViewItemFontSizeLayout(listViewItemPropertiesVerticalLayout); if (isIOS()) { listViewItemPropertiesVerticalLayout->wrapContentVertically(); createListViewItemEditModeLayout(listViewItemPropertiesVerticalLayout); createListViewItemDeleteButtonTextLayout(listViewItemPropertiesVerticalLayout); createListViewItemSelectedAnimationLayout(listViewItemPropertiesVerticalLayout); createListViewItemUnselectedAnimationLayout(listViewItemPropertiesVerticalLayout); createListViewItemHighlightedAnimationLayout(listViewItemPropertiesVerticalLayout); createListViewItemUnhighlightedAnimationLayout(listViewItemPropertiesVerticalLayout); createListViewItemAccessoryTypeIntLayout(listViewItemPropertiesVerticalLayout); createListViewItemAccessoryTypeEditModeLayout(listViewItemPropertiesVerticalLayout); createListViewItemEditStyleLayout(listViewItemPropertiesVerticalLayout); } ListViewItem* mListItemProperties = new ListViewItem(); mListItemProperties->setSelectionStyle(LIST_VIEW_ITEM_SELECTION_STYLE_NONE); mListItemProperties->addChild(listViewItemPropertiesVerticalLayout); mPropertiesListView->addChild(mListItemProperties); }
/** * Create ListView section properties layout */ void SettingsScreen::createListViewSectionPropertiesLayout() { VerticalLayout* listViewSectionPropertiesVerticalLayout = new VerticalLayout(); listViewSectionPropertiesVerticalLayout->wrapContentVertically(); mListViewSectionLabel = new Label(); mListViewSectionLabel->setText("No section in focus"); mListViewSectionLabel->setFontSize(TITLE_FONT_SIZE); mListViewSectionLabel->setFontColor(0xFF0000); listViewSectionPropertiesVerticalLayout->addChild(mListViewSectionLabel); // create the current section title layout HorizontalLayout* currentSectionTitleLayout = new HorizontalLayout(); currentSectionTitleLayout->wrapContentVertically(); mSetListViewSectionTitleButton = new Button(); mSetListViewSectionTitleButton->setText("Set title"); mSetListViewSectionTitleButton->fillSpaceHorizontally(); currentSectionTitleLayout->addChild(mSetListViewSectionTitleButton); mCurrentListViewSectionTitleEditBox = new EditBox(); mCurrentListViewSectionTitleEditBox->fillSpaceHorizontally(); currentSectionTitleLayout->addChild(mCurrentListViewSectionTitleEditBox); listViewSectionPropertiesVerticalLayout->addChild(currentSectionTitleLayout); // create the current section header text layout HorizontalLayout* currentSectionHeaderTextLayout = new HorizontalLayout(); currentSectionHeaderTextLayout->wrapContentVertically(); mSetListViewSectionHeaderButton = new Button(); mSetListViewSectionHeaderButton->setText("Set header"); mSetListViewSectionHeaderButton->fillSpaceHorizontally(); currentSectionHeaderTextLayout->addChild(mSetListViewSectionHeaderButton); mCurrentListViewSectionHeaderEditBox = new EditBox(); mCurrentListViewSectionHeaderEditBox->fillSpaceHorizontally(); currentSectionHeaderTextLayout->addChild(mCurrentListViewSectionHeaderEditBox); listViewSectionPropertiesVerticalLayout->addChild(currentSectionHeaderTextLayout); // create the current section footer text layout HorizontalLayout* currentSectionFooterTextLayout = new HorizontalLayout(); currentSectionFooterTextLayout->wrapContentVertically(); mSetListViewSectionFooterButton = new Button(); mSetListViewSectionFooterButton->setText("Set footer"); mSetListViewSectionFooterButton->fillSpaceHorizontally(); currentSectionFooterTextLayout->addChild(mSetListViewSectionFooterButton); mCurrentListViewSectionFooterEditBox = new EditBox(); mCurrentListViewSectionFooterEditBox->fillSpaceHorizontally(); currentSectionFooterTextLayout->addChild(mCurrentListViewSectionFooterEditBox); listViewSectionPropertiesVerticalLayout->addChild(currentSectionFooterTextLayout); if (isWindowsPhone() || isAndroid()) { listViewSectionPropertiesVerticalLayout->wrapContentVertically(); createListViewSectionHeaderPropertiesLayout(listViewSectionPropertiesVerticalLayout); createListViewSectionFooterPropertiesLayout(listViewSectionPropertiesVerticalLayout); } ListViewItem* mListSectionPropertiesItem = new ListViewItem(); mListSectionPropertiesItem->setSelectionStyle(LIST_VIEW_ITEM_SELECTION_STYLE_NONE); mListSectionPropertiesItem->addChild(listViewSectionPropertiesVerticalLayout); mPropertiesListView->addChild(mListSectionPropertiesItem); }
/** * Creates and adds main layout to the screen. */ void SettingsScreen::createMainLayout() { VerticalLayout* mainLayout = new VerticalLayout(); Screen::setMainWidget(mainLayout); ListView* listView = new ListView(); listView->fillSpaceHorizontally(); listView->fillSpaceVertically(); mainLayout->addChild(listView); ListViewItem* listItem; // Add IP label and edit box mIPEditBox = new EditBox(); mIPEditBox->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC); listView->addChild(this->createListViewItem(IP_LABEL_TEXT, mIPEditBox)); // Add port label and edit box mPortEditBox = new EditBox(); mPortEditBox->setInputMode(EDIT_BOX_INPUT_MODE_NUMERIC); listView->addChild(this->createListViewItem(PORT_LABEL_TEXT, mPortEditBox)); if ( isAndroid() ) { mShowOnlyIfInBackground = new CheckBox(); mShowOnlyIfInBackground->setState(true); listView->addChild(createListViewItem(SHOW_ONLY_IF_NOT_RUNNING, mShowOnlyIfInBackground)); mTickerText = new EditBox(); mTickerText->setText(TICKER_DEFAULT); listView->addChild(createListViewItem(TICKER_LABEL, mTickerText)); mContentTitle = new EditBox(); mContentTitle->setText(TITLE_DEFAULT); listView->addChild(createListViewItem(TITLE_LABEL, mContentTitle)); } // Android: If the registrationID was already saved from previous launches, // do not connect again. MAHandle myStore = maOpenStore("MyStore", 0); if ( isAndroid() && myStore == STERR_NONEXISTENT || !isAndroid() ) { // Add connection status label. listItem = new ListViewItem; listView->addChild(listItem); mConnectionStatusLabel = new Label(); mConnectionStatusLabel->setText(CONNECTION_NOT_ESTABLISHED); listItem->addChild(mConnectionStatusLabel); listItem = new ListViewItem; listView->addChild(listItem); mConnectButton = new Button(); mConnectButton->setText(CONNECT_BUTTON_TEXT); listItem->addChild(mConnectButton); } }
void OutputWindow::error(const QString& message) { ListViewItem* item = new ListViewItem(_list); item->setValue(0, _list->childCount()); item->setValue(1, tr("Error")); item->setValue(2, message); }
/** * This method is called when the edit box text was changed. * @param editBox The edit box object that generated the event. * @param text The new text. */ void MainScreen::editBoxTextChanged( EditBox* editBox, const MAUtil::String& text) { ListViewItem* info = new ListViewItem(); info->setText("Text Changed: " + text); mEventsList->addChild(info); }
/** * Create ListView properties layout */ void SettingsScreen::createListViewPropertiesLayout() { VerticalLayout* listViewPropertiesVerticalLayout = new VerticalLayout(); listViewPropertiesVerticalLayout->wrapContentVertically(); Label* mListViewPropertiesLabel = new Label(); mListViewPropertiesLabel->setText("ListView properties"); mListViewPropertiesLabel->setFontSize(TITLE_FONT_SIZE); mListViewPropertiesLabel->setFontColor(0xFF0000); listViewPropertiesVerticalLayout->addChild(mListViewPropertiesLabel); // create the allow selection layout HorizontalLayout* allowSelectionLayout = new HorizontalLayout(); allowSelectionLayout->wrapContentVertically(); mListViewAllowSelectionCheckbox = new CheckBox(); mListViewAllowSelectionCheckbox->setState(true); Label* allowSelectionLabel = new Label(); allowSelectionLabel->setText("Allow selection"); allowSelectionLayout->addChild(mListViewAllowSelectionCheckbox); allowSelectionLayout->addChild(allowSelectionLabel); listViewPropertiesVerticalLayout->addChild(allowSelectionLayout); if (isIOS()) { listViewPropertiesVerticalLayout->wrapContentVertically(); // create the mode selection layout HorizontalLayout* modeSelectionLayout = new HorizontalLayout(); modeSelectionLayout->wrapContentVertically(); Label* setModeLabel = new Label(); setModeLabel->setText("Set mode: "); modeSelectionLayout->addChild(setModeLabel); mDisplayCheckBox = new CheckBox(); mDisplayCheckBox->setState(true); listViewPropertiesVerticalLayout->addChild(modeSelectionLayout); modeSelectionLayout = new HorizontalLayout(); Label* setDisplayLabel = new Label(); setDisplayLabel->setText("Display"); modeSelectionLayout->addChild(mDisplayCheckBox); modeSelectionLayout->addChild(setDisplayLabel); mEditCheckBox = new CheckBox(); mEditCheckBox->setState(false); Label* setEditLabel = new Label(); setEditLabel->setText("Edit"); modeSelectionLayout->addChild(mEditCheckBox); modeSelectionLayout->addChild(setEditLabel); listViewPropertiesVerticalLayout->addChild(modeSelectionLayout); createListViewItemSelectionStyleLayout(listViewPropertiesVerticalLayout); } ListViewItem* mListPropertiesItem = new ListViewItem(); mListPropertiesItem->setSelectionStyle(LIST_VIEW_ITEM_SELECTION_STYLE_NONE); mListPropertiesItem->addChild(listViewPropertiesVerticalLayout); mPropertiesListView->addChild(mListPropertiesItem); }
/** * Creates and adds main layout to the screen. */ void SettingsScreen::createMainLayout() { // Create and add the main layout to the screen. VerticalLayout* mainLayout = new VerticalLayout(); Screen::setMainWidget(mainLayout); ListView* listView = new ListView(); mainLayout->addChild(listView); // Add set duration option row. this->addSetDurationRow(listView); // Add get duration option row. this->addGetDurationRow(listView); // Add options for setting and getting the video quality value. this->addVideoQualityRows(listView); if ( isIOS()) { // Add options for setting and getting the flash mode value. this->addFlashModeRows(listView); // Add option for setting the camera roll flag. this->addCameraRollFlagRow(listView); // Add option for setting the camera controls flag. this->addCameraControlsFlagRow(listView); } // Add take picture button. mTakePictureBtn = new Button(); mTakePictureBtn->setText(TAKE_PICTURE_BTN_TEXT); this->addButtonToListView(mTakePictureBtn, listView); if (isAndroid()) { mTakenPicturePath = new Label(); ListViewItem* listItem = new ListViewItem(); listItem->addChild(mTakenPicturePath); listView->addChild(listItem); } // Add record video button. mRecordVideoBtn = new Button(); mRecordVideoBtn->setText(RECORD_VIDEO_BTN_TEXT); this->addButtonToListView(mRecordVideoBtn, listView); // Add show image button. mShowImageScreen = new Button(); mShowImageScreen->setText(SHOW_IMAGE_SCREEN_TEXT); this->addButtonToListView(mShowImageScreen, listView); // Add show video screen button. mShowVideoScreen = new Button(); mShowVideoScreen->setText(SHOW_VIDEO_SCREEN_TEXT); this->addButtonToListView(mShowVideoScreen, listView); }
ListViewItem ListViewItem::get_document_item() { ListViewItem p = *this; while (!p.get_parent().is_null()) { p = p.get_parent(); } return p; }
void ImportScreen::slotMessage(int count, QString severity, QString message) { ListViewItem* item = new ListViewItem(_log); item->setValue(0, count); item->setValue(1, severity); item->setValue(2, _import->currentType()); item->setValue(3, _import->currentName()); item->setValue(4, message); }
void AccountLookup::refresh() { QApplication::setOverrideCursor(waitCursor); qApp->processEvents(); _list->clear(); AccountSelect conditions; if (!text().isEmpty()) conditions.name = text() + "%"; conditions.type = matchType(); conditions.headerOnly = (includeHeader && !includePosting); conditions.postingOnly = (includePosting && !includeHeader); conditions.activeOnly = activeOnly; int count; _quasar->db()->count(count, conditions); if (count > 100) { QApplication::restoreOverrideCursor(); QWidget* parent = this; if (isHidden() && parentWidget() != NULL) parent = parentWidget(); QString message = tr("This will select %1 items\n" "which may be slow. Continue?").arg(count); int ch = QMessageBox::warning(parent, tr("Are You Sure?"), message, QMessageBox::Yes, QMessageBox::No); if (ch != QMessageBox::Yes) return; QApplication::setOverrideCursor(waitCursor); qApp->processEvents(); } vector<Account> accounts; _quasar->db()->select(accounts, conditions); for (unsigned int i = 0; i < accounts.size(); ++i) { Account& account = accounts[i]; if (account.id() == skipId) continue; ListViewItem* item = new ListViewItem(_list, account.id()); item->setValue(0, account.name()); item->setValue(1, account.number()); item->setValue(2, account.typeName()); } QListViewItem* current = _list->firstChild(); _list->setCurrentItem(current); _list->setSelected(current, true); _list->triggerUpdate(); QApplication::restoreOverrideCursor(); }
int ListViewItem::get_parent_count() { int num_parents = 0; ListViewItem i = get_parent(); while (i.is_item()) { num_parents++; i = i.get_parent(); } return num_parents; }
/** * Adds a list row that contains widgets for getting the current * maximum video duration. */ void SettingsScreen::addGetDurationRow(ListView* listView) { ListViewItem* listItem = new ListViewItem(); listView->addChild(listItem); mMaxDurationLabel = new Label(); mMaxDurationLabel->setText(MAX_DURATION_LABEL_TEXT); // mMaxDurationLabel->setFontColor(0x123456); mMaxDurationLabel->fillSpaceHorizontally(); mGetMaxDurationBtn = new Button(); mGetMaxDurationBtn->setText(MAX_DURATION_BTN_TEXT); listItem->addChild(this->createRow(mGetMaxDurationBtn, mMaxDurationLabel)); }
void ModelEdit::insert(const BusinessObject& object) { _curr.objects.push_back(object); // Update list ListViewItem* lvi = new ListViewItem(_objects); lvi->setText(0, object.name); if (object.number != -1) lvi->setValue(1, object.number); lvi->setText(2, object.description); _objects->setCurrentItem(lvi); _objects->setSelected(lvi, true); }