void KMyMoneyAccountCombo::setModel(QAbstractItemModel *model) { delete d->m_popupView; KComboBox::setModel(model); AccountNamesFilterProxyModel* filterModel = qobject_cast<AccountNamesFilterProxyModel*>(model); if(filterModel) { filterModel->setFilterKeyColumn(AccountsModel::Account); filterModel->setFilterRole(AccountsModel::FullNameRole); } d->m_popupView = new QTreeView(this); d->m_popupView->setSelectionMode(QAbstractItemView::SingleSelection); setView(d->m_popupView); d->m_popupView->installEventFilter(this); d->m_popupView->setHeaderHidden(true); d->m_popupView->setRootIsDecorated(false); d->m_popupView->setAlternatingRowColors(true); d->m_popupView->setAnimated(true); d->m_popupView->expandAll(); connect(this, SIGNAL(activated(int)), SLOT(activated())); connect(d->m_popupView, SIGNAL(activated(QModelIndex)), this, SLOT(selectItem(QModelIndex))); connect(d->m_popupView, SIGNAL(pressed(QModelIndex)), this, SLOT(selectItem(QModelIndex))); if(isEditable()) { connect(lineEdit(), SIGNAL(textEdited(QString)), this, SLOT(makeCompletion(QString))); } }
/* BrowserCanvas::onMouseEvent * Called when a key is pressed within the canvas *******************************************************************/ void BrowserCanvas::onKeyDown(wxKeyEvent& e) { bool handled = true; int num_cols = GetSize().x / fullItemSizeX(); int selected = itemIndex(item_selected); // Down arrow if (e.GetKeyCode() == WXK_DOWN) { selected += num_cols; showItem(selected, false); } // Up arrow else if (e.GetKeyCode() == WXK_UP) { selected -= num_cols; showItem(selected); } // Left arrow else if (e.GetKeyCode() == WXK_LEFT) { selected--; showItem(selected); } // Right arrow else if (e.GetKeyCode() == WXK_RIGHT) { selected++; showItem(selected, false); } else { e.Skip(); handled = false; } if (handled) { // Clamp selection if (selected >= (int)items_filter.size()) selectItem((int)items_filter.size() - 1); if (selected < 0) selectItem(0); // Refresh canvas Refresh(); } }
void NewDoc::itemSelected(QListWidgetItem* ic) { if (ic == 0) return; selectItem(layoutsView->row(ic)); setDocLayout(layoutsView->row(ic)); }
/* BrowserCanvas::lookForSearchEntryFrom * Used by BrowserCanvas::onKeyChar, returns true if an item matching * [search] is found (starting from [from]), false otherwise *******************************************************************/ bool BrowserCanvas::searchItemFrom(int from) { int index = from; bool looped = false; bool gotmatch = false; while ((!looped && index < (int)items_filter.size()) || (looped && index < from)) { string name = items[items_filter[index]]->getName(); if (name.Upper().StartsWith(search)) { // Matches, update selection selectItem(index); showSelectedItem(); return true; } // No match, next item; look in the above entries // if no matches were found below. if (++index == items_filter.size() && !looped) { looped = true; index = 0; } } // Didn't get any match return false; }
//handle mouse release events // void SystemTopologyDrawing::mouseReleaseEvent( QMouseEvent* event ) { if ( event->button() == Qt::LeftButton ) { leftMousePressed = false; //if the left mouse button is pressed and released at the same point //then we select the corresponding tree item if ( firstPoint == event->pos() ) { toSelect = true; draw(); toSelect = false; if ( selectedSystemId >= 0 ) { emit selectItem( selectedSystemId ); } } event->accept(); } else if ( event->button() == Qt::RightButton ) { //remove the info box for the previously right-clicked item rightMousePressed = false; event->accept(); info->hide(); } else { event->ignore(); } data->updateSelection(); draw(); }
void PhraseBookBox::newPhrase() { Phrase ph; ph.setSource( NewPhrase ); QListViewItem *item = new PhraseLVI( lv, ph ); selectItem( item ); }
ThingTypeBrowser::ThingTypeBrowser(wxWindow* parent, int type) : BrowserWindow(parent) { // Set window title SetTitle("Browse Thing Types"); // Add 'Details view' checkbox cb_view_tiles = new wxCheckBox(this, -1, "Details view"); cb_view_tiles->SetValue(browser_thing_tiles); sizer_bottom->Add(cb_view_tiles, 0, wxEXPAND|wxRIGHT, 4); // Populate tree vector<tt_t> types = theGameConfiguration->allThingTypes(); for (unsigned a = 0; a < types.size(); a++) addItem(new ThingBrowserItem(types[a].type->getName(), types[a].type, types[a].number), types[a].type->getGroup()); populateItemTree(); // Set browser options canvas->setItemNameType(BrowserCanvas::NAMES_INDEX); setupViewOptions(); // Select initial item if any if (type >= 0) selectItem(theGameConfiguration->thingType(type)->getName()); else openTree(items_root); // Otherwise open 'all' category // Bind events cb_view_tiles->Bind(wxEVT_CHECKBOX, &ThingTypeBrowser::onViewTilesClicked, this); Layout(); }
selectStatus_t SelectBenchmark(int iterations, int count, int k, CuContext* context, selectEngine_t engine, CuDeviceMem* randomKeys, selectType_t type, double* elapsed, uint* element) { CuEventTimer timer; timer.Start(); for(int i(0); i < iterations; ++i) { selectData_t data; data.keys = randomKeys->Handle(); data.values = 0; data.count = count; data.bit = 0; data.numBits = 32; data.type = type; data.content = SELECT_CONTENT_KEYS; selectStatus_t status = selectItem(engine, data, k, element, 0); if(SELECT_STATUS_SUCCESS != status) return status; } *elapsed = timer.Stop(); return SELECT_STATUS_SUCCESS; }
// ---------------------------------------------------------------------------- // ArchiveEntryList::filterList // // Filters the list to only entries and directories with names matching // [filter], and with type categories matching [category]. // ---------------------------------------------------------------------------- void ArchiveEntryList::filterList(string filter, string category) { // Update variables filter_text = filter; filter_category = category; // Save current selection vector<ArchiveEntry*> selection = getSelectedEntries(); ArchiveEntry* focus = getFocusedEntry(); // Apply the filter clearSelection(); applyFilter(); // Restore selection (if selected entries aren't filtered) ArchiveEntry* entry = nullptr; for (int a = 0; a < GetItemCount(); a++) { entry = getEntry(a, false); for (unsigned b = 0; b < selection.size(); b++) { if (entry == selection[b]) { selectItem(a); break; } } if (entry == focus) { focusItem(a); EnsureVisible(a); } } }
void KWDocStructFormulaItem::editItem() { // TODO: Formula has to be selected first to bring it into view. Bug? selectItem(); gui()->canvasWidget()->editFrameSet(m_form); }
bool Inventory2::handleLeftClick(ExCommand *cmd) { if (!_isInventoryOut) return false; bool res = false; for (uint i = 0; i < _inventoryIcons.size(); i++) { if (cmd->_x >= _inventoryIcons[i]->x1 && cmd->_x <= _inventoryIcons[i]->x2 && cmd->_y >= _inventoryIcons[i]->y1 && cmd->_y <= _inventoryIcons[i]->y2) { if (getSelectedItemId()) { if (getSelectedItemId() != _inventoryIcons[i]->inventoryItemId) unselectItem(0); } if (getItemFlags(_inventoryIcons[i]->inventoryItemId) & 1) { ExCommand *ex = new ExCommand(0, 17, 65, 0, 0, 0, 1, 0, 0, 0); ex->_field_2C = 11; ex->_field_14 = _inventoryIcons[i]->inventoryItemId; ex->_excFlags |= 3; ex->postMessage(); } if (!(getItemFlags(_inventoryIcons[i]->inventoryItemId) & 2)) { selectItem(_inventoryIcons[i]->inventoryItemId); _inventoryIcons[i]->isSelected = true; } res = true; } } if (!res) unselectItem(0); return res; }
bool StringListSelectAndReorderSet::select(int index) { // ############################################################################ list<int>::iterator pos; int number=-1; // ----- if(index<0 || (unsigned)index>=original.size()) { return false; } else { for(pos=possible.begin(); pos!=possible.end(); pos++) { ++number; if(*pos==index) break; } if(pos!=possible.end()) { return selectItem(number); } else { return false; } } enableButtons(0); // ############################################################################ }
void PhraseBookBox::newPhrase() { Phrase *p = new Phrase(); p->setSource(NewPhrase); m_phraseBook->append(p); selectItem(phrMdl->addPhrase(p)); }
void OgreWidget::mouseSelect(QPoint const & pos, bool multiple) { /* Apercu de ce que pourrait donner d'une selection par volume. Ogre::Real x = pos.x() / (float)width(); Ogre::Real y = pos.y() / (float)height(); Ogre::Ray ray = m_camera->getCamera()->getCameraToViewportRay(x, y); Ogre::RaySceneQuery * query = m_sceneManager->createRayQuery(ray); Ogre::RaySceneQueryResult & queryResult = query->execute(); Ogre::RaySceneQueryResult::iterator queryResultIterator = queryResult.begin(); Ogre::PlaneBoundedVolume volume = m_camera->getCameraToViewportBoxVolume(); Ogre::PlaneBoundedVolumeListSceneQuery * query = m_sceneManager->createPlaneBoundedVolumeQuery(volume); Ogre::SceneQueryResult & queryResult = query->execute();*/ Ogre::Entity * selectedEntity = m_selectionBuffer->OnSelectionClick(pos.x(), pos.y()); if (selectedEntity) { Ogre::SceneNode * node = selectedEntity->getParentSceneNode(); while (node->getParentSceneNode() != m_sceneManager->getRootSceneNode()) node = node->getParentSceneNode(); selectItem(Ogre::any_cast<InstItem *>(node->getUserObjectBindings().getUserAny()), multiple); } else unselectItem(); }
void QtFallbackWebPopup::activeChanged(int index) { if (index < 0) return; emit selectItem(index, false, false); }
void XFE_ReadAttachPanel::doubleClickCb(int pos) { // ensure clicked item is selected if (pos!=currentSelectionPos() && _items && pos >=0 && pos < _numItems) selectItem(_items[pos]); openCb(); }
void HistoryView::setupActions() { QAction *selectAction = new QAction(QString("Wybierz"), this); selectAction->setSoftKeyRole(QAction::PositiveSoftKey); this->addAction(selectAction); QAction *backAction = new QAction(QString("Wstecz"), this); backAction->setSoftKeyRole(QAction::NegativeSoftKey); this->addAction(backAction); connect(selectAction, SIGNAL(triggered()), SLOT(selectItem())); connect(backAction, SIGNAL(triggered()), SLOT(goBack())); connect(historyList, SIGNAL(itemActivated(QListWidgetItem*)), SLOT(selectItem(QListWidgetItem*))); connect(this, SIGNAL(itemSelected(QUrl)), SLOT(goBack())); connect(this, SIGNAL(rightSoftKeyPressed()), SLOT(goBack())); connect(this, SIGNAL(leftSoftKeyPressed()), SLOT(selectItem())); }
void InspectTool::mouseReleaseEvent(QMouseEvent *event) { m_mousePosition = event->localPos(); m_pressAndHoldTimer.stop(); if (event->button() == Qt::LeftButton && !m_dragStarted) { selectItem(); m_hoverHighlight->setVisible(false); } }
void XFE_ReadAttachPanel::addAttachments(MSG_Pane *pane,MSG_AttachmentData* data) { // adopt storage of backend attachment list, free in removeAllAttachments _pane=pane; _attachments=data; MSG_AttachmentData* tmp; for (tmp = data ; tmp->url ; tmp++) { char *itemLabel=NULL; // Hack around back-end not naming the sent v-card. Use // description field: "Card for ...", to provide some // uniqueness among received vcards. if (tmp->real_name && XP_STRCASECMP(tmp->real_name,"vcard.vcf")==0 && tmp->description && strlen(tmp->description)>0) { itemLabel=(char*)XP_ALLOC(strlen(tmp->description)+4+1); sprintf(itemLabel,"%s.vcf",tmp->description); } // find a label for the attachment else if (tmp->real_name && strlen(tmp->real_name)>0) { itemLabel=XP_STRDUP(tmp->real_name); } else if (tmp->description && strlen(tmp->description)>0) { itemLabel=XP_STRDUP(tmp->description); } else if (tmp->real_type && strlen(tmp->real_type)>0) { itemLabel=XP_STRDUP(tmp->real_type); } else { itemLabel=XP_STRDUP("attachment"); } // translate problem characters in label to '_' char *s=itemLabel; while (*s) { if (*s==' ' || *s=='/' || *s=='\\') *s='_'; s++; } XFE_AttachPanelItem *item = new XFE_AttachPanelItem(this, tmp->url, itemLabel, tmp->real_type); addItem(item); // add to drag handler if (_attachDrag && item->image()) { _attachDrag->addDragWidget(item->image()); } if (itemLabel) XP_FREE(itemLabel); } // select first attachment by default if (_numItems>0) selectItem(_items[0]); }
SearchViewItem::SearchViewItem(QString t, QWidget *p) : QAbstractButton(p) { this->setFixedHeight(22); this->resize(this->parentWidget()->width(), 0); connect(this, SIGNAL(clicked()), Application::getWindow()->getSearchView(), SLOT(selectItem())); mHover = false; mText = t; }
void PhraseBookBox::removePhrase() { QListViewItem *item = lv->currentItem(); QListViewItem *next = item->itemBelow() != 0 ? item->itemBelow() : item->itemAbove(); delete item; if ( next != 0 ) selectItem( next ); enableDisable(); }
void AddCourseDialog::loadUi() { saleGroupBox->hide(); addButton->setIcon( QIcon(":/TransactionRecord/Resources/add.png") ); delButton->setIcon( QIcon(":/TransactionRecord/Resources/remove.png") ); upButton->setIcon( QIcon(":/TransactionRecord/Resources/up.png") ); downButton->setIcon( QIcon(":/TransactionRecord/Resources/down.png") ); QRegExp regexp("[0-9]{1,100}.[0-9]{0,4}"); cbLineEdit->setValidator(new QRegExpValidator(regexp, this)); connect( addButton, SIGNAL( clicked() ), this, SLOT( addSale() ) ); connect( addButton, SIGNAL( clicked() ), this, SLOT( enableButtons() ) ); connect( delButton, SIGNAL( clicked() ), this, SLOT( removeSale() ) ); connect( delButton, SIGNAL( clicked() ), this, SLOT( enableButtons() ) ); connect( upButton, SIGNAL( clicked() ), this, SLOT( selectItem() ) ); connect( downButton, SIGNAL( clicked() ), this, SLOT( selectItem() ) ); connect( okButton, SIGNAL( clicked() ), this, SLOT( okClicked() ) ); }
void ListWidget::slotClicked() { for(auto& item : items_) { sf::Vector2i mousePosition = qrw::Mouse::getPosition(); mousePosition.y += scrollValue_ * (items_.size() - 1) * ITEM_HEIGHT; if(item->getWidgetArea().contains(mousePosition.x, mousePosition.y)) selectItem(*item); } }
int main(int argc, const char *argv[]) { uint8 i; uint8 track[4]; uint8 player[4]; // Init system clock & disable WDT // CLKPR = 0x80; CLKPR = 0x00; MCUSR &= ~(1 << WDRF); wdt_disable(); srand(12345); // Init LCD // lcdInit(); for ( ; ; ) { if ( PIND & 0x80 ) { initSelector(32); for ( i = 0; i < 4; i++ ) { track[i] = selectItem(); } initSelector(NUM_CHARACTERS); for ( i = 0; i < 4; i++ ) { player[i] = selectItem(); } lcdSetCursor(0,0); for ( i = 0; i < 4; i++ ) { lcdPrintFlashString(selectCharacter(player[i])); lcdPrintFlashString(selectTrack(track[i])); } while ( PIND & 0x80 ); } else { lcdClearScreen(); do { rand(); } while ( !(PIND & 0x80) ); } } }
void TorrentsListWidget::changeSelection(TorrentWidget *item) { if(shiftKeyPressed && !controlKeyPressed) { selectRange(row(torrentWidgetItems.value(item)),row(torrentWidgetItems.value(selectedItems.last()))); return; } if(!controlKeyPressed) clearSelection(item); if(item->isSelected()) { if(controlKeyPressed || shiftKeyPressed) unselectItem(item); } else selectItem(item); };
void ListWidget::addItem(const std::string &content) { ListItem* item = new ListItem(); item->setText(content); item->setRelativePosition(computeItemPosition(items_.size())); item->setSize({this->getSize().x - SCROLLBAR_WIDTH, ITEM_HEIGHT}); items_.push_back(std::unique_ptr<ListItem>(item)); // If this is the first item, select it if(items_.size() == 1) selectItem(*item); }
bool DropDownList::onKey(const unsigned int key, const bool pressed){ if (pressed){ switch (key){ case KEY_UP: if (selectedItem > 0) selectItem(selectedItem - 1); return true; case KEY_DOWN: if (selectedItem + 1 < (int) items.getCount()) selectItem(selectedItem + 1); return true; case KEY_ENTER: case KEY_SPACE: isDroppedDown = !isDroppedDown; return true; case KEY_ESCAPE: if (!isDroppedDown) return false; capture = isDroppedDown = false; return true; } } return false; }
void xQGanttBarViewPort::selectItem(KGanttItem *item, bool f) { item->select(f); for(KGanttItem *subitem = item->getSubItems().first(); subitem != 0; subitem = item->getSubItems().next()) { selectItem(subitem, f); } }
int Archive::getSizeOfItem(int n) { int size = 0; if (n < getNumberOfItems()) { selectItem(n); while (getByte() != EOF) size++; } return size; }
/* MapTextureBrowser::MapTextureBrowser * MapTextureBrowser class constructor *******************************************************************/ MapTextureBrowser::MapTextureBrowser(wxWindow* parent, int type, string texture, SLADEMap* map) : BrowserWindow(parent) { // Init variables this->type = type; this->map = map; this->truncate_names = true; // Init sorting addSortType("Usage Count"); setSortType(map_tex_sort); // Set window title SetTitle("Browse Map Textures"); // Textures if (type == 0 || theGameConfiguration->mixTexFlats()) { addGlobalItem(new MapTexBrowserItem("-", 0, 0)); vector<map_texinfo_t>& textures = theMapEditor->textureManager().getAllTexturesInfo(); for (unsigned a = 0; a < textures.size(); a++) { // Add browser item addItem(new MapTexBrowserItem(textures[a].name, 0, textures[a].index), determineTexturePath(textures[a].archive, textures[a].category, "Textures", textures[a].path)); } } // Flats if (type == 1 || theGameConfiguration->mixTexFlats()) { vector<map_texinfo_t>& flats = theMapEditor->textureManager().getAllFlatsInfo(); for (unsigned a = 0; a < flats.size(); a++) { // Determine tree path string path = determineTexturePath(flats[a].archive, flats[a].category, "Flats", flats[a].path); // Add browser item if (flats[a].category == MapTextureManager::TC_TEXTURES) addItem(new MapTexBrowserItem(flats[a].name, 0, flats[a].index), path); else addItem(new MapTexBrowserItem(flats[a].name, 1, flats[a].index), path); } } populateItemTree(false); // Select initial texture (if any) selectItem(texture); }