void WdgGatewayTree::itemSelectionChangedSlot() { if (guard) return; wg->Db().DeselectAll(); registry->ClearSelection(); if (mode == mwmTree) { for (int i = 0; i < topLevelItemCount(); ++i) { QTreeWidgetItem *serviceItem = topLevelItem(i); unsigned serviceId = serviceItem->data(0, Qt::UserRole + 2).toUInt(); if (serviceItem->isSelected()) { if (serviceId % 100 == REPO_TB_IDX) registry->Select(serviceId); else wg->Db().InvertRowSelection(serviceId); } for (int j = 0; j < serviceItem->childCount(); ++j) { QTreeWidgetItem *endpointItem = serviceItem->child(j); unsigned endpointId = endpointItem->data(0, Qt::UserRole + 2).toUInt(); if (endpointItem->isSelected()) { if (endpointId % 100 == REPO_TB_IDX) registry->SelectEndpoint(serviceId, endpointId); else wg->Db().InvertRowSelection(endpointId); } } } } else { for (int i = 0; i < topLevelItemCount(); ++i) { QTreeWidgetItem *endpointItem = topLevelItem(i); unsigned endpointId = endpointItem->data(0, Qt::UserRole + 2).toUInt(); if (endpointItem->isSelected()) { if (endpointId % 100 == REPO_TB_IDX) registry->SelectEndpoint(endpointId); else wg->Db().InvertRowSelection(endpointId); } } } wg->RefreshViews(); }
/*! \brief Called when the Refresh button has been pressed */ bool ApplicationViewWidget::onRefresh() { if(manager.busy()){ return false; } std::vector<int> modulesIDs; std::vector<int> connectionsIDs; std::vector<int> resourcesIDs; for(int i=0;i<ui->moduleList->topLevelItemCount();i++){ QTreeWidgetItem *it = ui->moduleList->topLevelItem(i); if(it->isSelected()){ modulesIDs.push_back(it->text(1).toInt()); it->setText(2,"waiting"); it->setIcon(0,QIcon(":/images/progress_ico.png")); it->setTextColor(2,QColor("#000000")); } } for(int i=0;i<ui->connectionList->topLevelItemCount();i++){ QTreeWidgetItem *it = ui->connectionList->topLevelItem(i); if(it->isSelected()){ connectionsIDs.push_back(it->text(1).toInt()); it->setText(2,"waiting"); it->setIcon(0,QIcon(":/images/progress_ico.png")); it->setTextColor(2,QColor("#000000")); } } for(int i=0;i<ui->resourcesList->topLevelItemCount();i++){ QTreeWidgetItem *it = ui->resourcesList->topLevelItem(i); if(it->isSelected()){ resourcesIDs.push_back(it->text(1).toInt()); it->setText(3,"waiting"); it->setIcon(0,QIcon(":/images/progress_ico.png")); it->setTextColor(3,QColor("#000000")); } } manager.safeRefresh(modulesIDs, connectionsIDs, resourcesIDs); yarp::os::Time::delay(0.1); selectAllConnections(false); selectAllModule(false); selectAllResources(false); }
void FunctionManager::slotFunctionRemoved(t_function_id id) { QTreeWidgetItem* item; // The function manager has its own routines for functions that are // removed with it. if (m_blockRemoveFunctionSignal == true) return; item = getItem(id, m_functionTree); if (item != NULL) { if (item->isSelected() == true) { QTreeWidgetItem* nextItem; // Try to select the closest neighbour if (m_functionTree->itemAbove(item) != NULL) nextItem = m_functionTree->itemAbove(item); else nextItem = m_functionTree->itemBelow(item); if (nextItem != NULL) nextItem->setSelected(true); } delete item; } }
/*! \brief Launch YARPRead Inspection modality*/ void ApplicationViewWidget::onYARPRead() { if(manager.busy()){ return; } yarp::manager::ErrorLogger* logger = yarp::manager::ErrorLogger::Instance(); for(int i=0;i<ui->connectionList->topLevelItemCount();i++){ QTreeWidgetItem *it = ui->connectionList->topLevelItem(i); if(it->isSelected()){ QString from = it->text(3); QString to = QString("/inspect/read%1").arg(from); #if defined(WIN32) QString cmd = "cmd.exe"; QString param; param = QString("/C yarp read %1").arg(to); #else QString cmd = "xterm"; QString param; param = QString("-hold -title %1 -e yarp read %2").arg(from).arg(to); #endif yarp::manager::LocalBroker launcher; launcher.showConsole(true); if(launcher.init(cmd.toLatin1().data(), param.toLatin1().data(), NULL, NULL, NULL, NULL)) { if(!launcher.start() && strlen(launcher.error())) { QString msg; msg = QString("Error while launching yarpread. %1").arg(launcher.error()); logger->addError(msg.toLatin1().data()); reportErrors(); } else { // waiting for the port to get open double base = yarp::os::Time::now(); while(!timeout(base, 3.0)){ if(launcher.exists(to.toLatin1().data())){ break; } } if(!launcher.connect(from.toLatin1().data(), to.toLatin1().data(), "udp")){ QString msg; msg = QString("Cannot inspect '%1' : %2").arg(from).arg(launcher.error()); logger->addError(msg.toLatin1().data()); launcher.stop(); reportErrors(); } } } } } yarp::os::Time::delay(0.1); }
void DOMTreeView::deleteNodes() { // kDebug(90180) ; DOM::Node last; MultiCommand *cmd = new MultiCommand(i18n("Delete Nodes")); QTreeWidgetItemIterator it(m_listView, QTreeWidgetItemIterator::Selected); for (; *it; ++it) { DOMListViewItem *item = static_cast<DOMListViewItem *>(*it); // kDebug(90180) << " item->node " << item->node().nodeName().string() << " clos " << item->isClosing(); if (item->isClosing()) continue; // don't regard node more than once if (item->node() == last) continue; // check for selected parent bool has_selected_parent = false; for (QTreeWidgetItem *p = item->parent(); p; p = p->parent()) { if (p->isSelected()) { has_selected_parent = true; break; } } if (has_selected_parent) continue; // kDebug(90180) << " item->node " << item->node().nodeName().string() << ": schedule for removal"; // remove this node if it isn't already recursively removed by its parent cmd->addCommand(new RemoveNodeCommand(item->node(), item->node().parentNode(), item->node().nextSibling())); last = item->node(); } mainWindow()->executeAndAddCommand(cmd); }
/*! \brief Called when the Disconnect button has been pressed */ bool ApplicationViewWidget::onDisconnect() { if(manager.busy()){ return false; } std::vector<int> MIDs; for(int i=0;i<ui->connectionList->topLevelItemCount();i++){ QTreeWidgetItem *it = ui->connectionList->topLevelItem(i); if(it->isSelected()){ MIDs.push_back(it->text(1).toInt()); manager.updateConnection(it->text(1).toInt(), it->text(3).toLatin1().data(), it->text(4).toLatin1().data(), it->text(5).toLatin1().data()); it->setText(2,"waiting"); it->setIcon(0,QIcon(":/images/progress_ico.png")); it->setTextColor(2,QColor("#000000")); } } manager.safeDisconnect(MIDs); yarp::os::Time::delay(0.1); selectAllConnections(false); return true; }
bool wxListCtrl::GetItem(wxListItem& info) const { const long id = info.GetId(); QTreeWidgetItem *qitem = QtGetItem(id); if ( qitem != NULL ) { if ( !info.m_mask ) // by default, get everything for backwards compatibility info.m_mask = -1; if ( info.m_mask & wxLIST_MASK_TEXT ) info.SetText(wxQtConvertString(qitem->text(info.GetColumn()))); if ( info.m_mask & wxLIST_MASK_DATA ) { QVariant variant = qitem->data(0, Qt::UserRole); info.SetData(variant.value<long>()); } if ( info.m_mask & wxLIST_MASK_STATE ) { info.m_state = wxLIST_STATE_DONTCARE; if ( info.m_stateMask & wxLIST_STATE_FOCUSED ) { if ( m_qtTreeWidget->currentIndex().row() == id ) info.m_state |= wxLIST_STATE_FOCUSED; } if ( info.m_stateMask & wxLIST_STATE_SELECTED ) { if ( qitem->isSelected() ) info.m_state |= wxLIST_STATE_SELECTED; } } return true; } else return false; }
void CFontFileListView::contextMenuEvent(QContextMenuEvent *ev) { QTreeWidgetItem *item(itemAt(ev->pos())); if(item && item->parent()) { if(!item->isSelected()) item->setSelected(true); bool haveUnmarked(false), haveMarked(false); QList<QTreeWidgetItem *> items(selectedItems()); QTreeWidgetItem *item; foreach(item, items) { if(item->parent() && item->isSelected()) { if(isMarked(item)) haveMarked=true; else haveUnmarked=true; } if(haveUnmarked && haveMarked) break; } itsMarkAct->setEnabled(haveUnmarked); itsUnMarkAct->setEnabled(haveMarked); itsMenu->popup(ev->globalPos()); } }
void OutlinePalette::slotRightClick(QPoint point) { if (!m_MainWindow || m_MainWindow->scriptIsRunning()) return; QTreeWidgetItem *ite = reportDisplay->itemAt(point); if (ite == NULL) return; if (!ite->isSelected()) slotMultiSelect(); OutlineTreeItem *item = (OutlineTreeItem*)ite; if (item != NULL) { if ((item->type == 0) || (item->type == 2)) createContextMenu(NULL, point.x(), point.y()); else if ((item->type == 1) || (item->type == 3) || (item->type == 4)) { PageItem *currItem = item->PageItemObject; if (currItem!=NULL) { currentObject = ite; createContextMenu(currItem, point.x(), point.y()); } } } }
void PWMJASPARDialogController::sl_onSelectionChanged() { QTreeWidgetItem* item = jasparTree->currentItem(); if (item == 0) { fileName = ""; return; } if (!item->isSelected()) { fileName = ""; return; } JasparTreeItem* it = static_cast<JasparTreeItem*>(item); QMap<QString, QString> props = it->matrix.getProperties(); fileName = QDir::searchPaths( PATH_PREFIX_DATA ).first() + "/position_weight_matrix/JASPAR/"; fileName.append(it->matrix.getProperty("tax_group")).append("/"); fileName.append(it->matrix.getProperty("id")).append(".pfm"); propertiesTable->clear(); propertiesTable->setRowCount(props.size()); propertiesTable->setColumnCount(2); propertiesTable->verticalHeader()->setVisible(false); propertiesTable->horizontalHeader()->setVisible(false); QMapIterator<QString, QString> iter(props); int pos = 0; while (iter.hasNext()) { iter.next(); propertiesTable->setItem(pos, 0, new QTableWidgetItem(iter.key())); propertiesTable->setItem(pos, 1, new QTableWidgetItem(iter.value())); pos++; } }
void KEquityPriceUpdateDlg::slotQuoteFailed(const QString& _id, const QString& _symbol) { QList<QTreeWidgetItem*> foundItems = lvEquityList->findItems(_id, Qt::MatchExactly, ID_COL); QTreeWidgetItem* item = 0; if (! foundItems.empty()) item = foundItems.at(0); // Give the user some options int result; if (_id.contains(" ")) { result = KMessageBox::warningContinueCancel(this, i18n("Failed to retrieve an exchange rate for %1 from %2. It will be skipped this time.", _symbol, item->text(SOURCE_COL)), i18n("Price Update Failed")); } else { result = KMessageBox::questionYesNoCancel(this, QString("<qt>%1</qt>").arg(i18n("Failed to retrieve a quote for %1 from %2. Press <b>No</b> to remove the online price source from this security permanently, <b>Yes</b> to continue updating this security during future price updates or <b>Cancel</b> to stop the current update operation.", _symbol, item->text(SOURCE_COL))), i18n("Price Update Failed"), KStandardGuiItem::yes(), KStandardGuiItem::no()); } if (result == KMessageBox::No) { // Disable price updates for this security MyMoneyFileTransaction ft; try { // Get this security (by ID) MyMoneySecurity security = MyMoneyFile::instance()->security(_id.toUtf8()); // Set the quote source to blank security.setValue("kmm-online-source", QString()); security.setValue("kmm-online-quote-system", QString()); // Re-commit the security MyMoneyFile::instance()->modifySecurity(security); ft.commit(); } catch (const MyMoneyException &e) { KMessageBox::error(this, QString("<qt>") + i18n("Cannot update security <b>%1</b>: %2", _symbol, e.what()) + QString("</qt>"), i18n("Price Update Failed")); } } // As long as the user doesn't want to cancel, move on! if (result != KMessageBox::Cancel) { QTreeWidgetItem* next = 0; prgOnlineProgress->setValue(prgOnlineProgress->value() + 1); item->setSelected(false); // launch the NEXT one ... in case of m_fUpdateAll == false, we // need to parse the list to find the next selected one next = lvEquityList->invisibleRootItem()->child(lvEquityList->invisibleRootItem()->indexOfChild(item) + 1); if (!m_fUpdateAll) { while (next && !next->isSelected()) { prgOnlineProgress->setValue(prgOnlineProgress->value() + 1); next = lvEquityList->invisibleRootItem()->child(lvEquityList->invisibleRootItem()->indexOfChild(next) + 1); } } if (next) { m_webQuote.launch(next->text(SYMBOL_COL), next->text(ID_COL), next->text(SOURCE_COL)); } else { finishUpdate(); } } else { finishUpdate(); } }
void PrintTreeWidget::printRows(QPainter *p, int sItem, int eItem) { QRect rect; QBrush bbrush; QString tmpSt; int yPos; int xPos = prLeftMargin; int numCols; QTreeWidgetItem *curItem; // Now, draw the report title, centered on the page. p->setFont(QFont("helvetica", 8, QFont::Normal)); numCols = myTree->columnCount(); if (!numCols) return; if (numCols > 20) numCols = 20; yPos = 130; for (int i = sItem; i < eItem; i++) { curItem = myTree->topLevelItem(i); if (curItem) { if (!myPrintSelectedOnly || curItem->isSelected()) { xPos = prLeftMargin; for (int i = 0; i < numCols; i++) { rect.setCoords(xPos+1, yPos, xPos + prColWidths[i] - 1, yPos+11); p->drawText(rect, curItem->textAlignment(i)|Qt::AlignVCenter, curItem->text(i)); xPos += prColWidths[i]; } yPos += 12; } } } }
bool QTreeWidgetItemProto::isSelected() const { QTreeWidgetItem *item = qscriptvalue_cast<QTreeWidgetItem*>(thisObject()); if (item) return item->isSelected(); return false; }
void ApplicationViewWidget::onAttachStdout() { if(manager.busy()) { return; } std::vector<int> MIDs; for(int i=0; i<ui->moduleList->topLevelItemCount(); i++) { QTreeWidgetItem *it = ui->moduleList->topLevelItem(i); if(it->isSelected()) { int id = it->text(1).toInt(); StdoutWindow *stdouWin = qvariant_cast<StdoutWindow *>(it->data(0,Qt::UserRole)); if(stdouWin && stdouWin->getId() == id) { // found continue; } MIDs.push_back(it->text(1).toInt()); QString name = QString("%1").arg(app->getName()); QString strTitle = name + ":" + it->text(0) + ":" + it->text(1); StdoutWindow *stdOutWindow = new StdoutWindow(id,strTitle); connect(stdOutWindow,SIGNAL(closeStdOut(int)),this,SLOT(onCloseStdOut(int))); //stdoutWinList.append(stdOutWindow); it->setData(0,Qt::UserRole,QVariant::fromValue(stdOutWindow)); stdOutWindow->show(); } }
void Multiwin::mainButtonClicked() { QTreeWidgetItem* item;// = tree->topLevelItem(1); QString temp; std::string temp2; int numItems = tree->topLevelItemCount(); for(int i = 0; i < numItems; i++){ item = tree->topLevelItem(i); if(item->isSelected()){ temp = item->text(i); temp2 = temp.toStdString();//temp2 contains the filename that will be displayed break; } else{ item = tree->currentItem(); temp = item->text(i); temp2 = temp.toStdString(); break; } } std::map<std::string, WebPage*> allPages = engine->getPages(); otherWin->setWindowTitle(QString::fromStdString(temp2)); //setting the title to the fileContent->clear();//clear what was once there //outputting the words to the textbox std::stringstream stream; stream << *allPages.find(temp2)->second ; std::string str = stream.str(); fileContent->setPlainText(QString::fromStdString(str)); //fileContent->setWordWrap(true); inList->clear(); outList->clear(); inHits.clear(); outHits.clear(); myset<WebPage*> incominLinks = allPages.find(temp2)->second->incoming_links(); for (myset<WebPage*>::iterator it = incominLinks.begin(); it != incominLinks.end(); ++it) { QTreeWidgetItem* item = new QTreeWidgetItem; //0 = filename, 1 = # incoming, 2 = # outgoing item->setText(0, QString::fromStdString((*it)->filename())); inList->addTopLevelItem(item); inList->setItemWidget(item, 1, new QLabel(QString::number((*it)->incoming_links().size())));//setting colunn 2 inList->setItemWidget(item, 2, new QLabel(QString::number((*it)->outgoing_links().size()))); inHits.push_back((*it)); } myset<WebPage*> outgoinLinks = allPages.find(temp2)->second->outgoing_links(); for (myset<WebPage*>::iterator it = outgoinLinks.begin(); it != outgoinLinks.end(); ++it) { QTreeWidgetItem* item = new QTreeWidgetItem; //0 = filename, 1 = # incoming, 2 = # outgoing item->setText(0, QString::fromStdString((*it)->filename())); outList->addTopLevelItem(item); outList->setItemWidget(item, 1, new QLabel(QString::number((*it)->incoming_links().size())));//setting colunn 2 outList->setItemWidget(item, 2, new QLabel(QString::number((*it)->outgoing_links().size()))); outHits.push_back((*it)); } otherWin->show(); }
void Tree::searchTree(QString qStr) { qStr = qStr.toLower(); unsigned int max = this->topLevelItemCount(); unsigned int max2; QTreeWidgetItem *child; // Etat initial _displayedElements.clear(); bool isDisplayed = qStr.isEmpty(); for (unsigned int i = 0; i < max; i ++) { child = this->topLevelItem(i); max2 = child->childCount(); // Niveau 1: en-têtes "échantillons", "instruments", "presets" for (unsigned int j = 0; j < max2; j++) { // Niveau 2: sample, instrument ou preset for (int k = 0; k < child->child(j)->childCount(); k++) { QTreeWidgetItem * item = child->child(j)->child(k); if (item->text(6) == "0") // Si l'élément n'est pas masqué par une suppression non définitive item->setHidden(!isDisplayed); } } } if (isDisplayed) return; for (unsigned int i = 0; i < max; i ++) { child = this->topLevelItem(i); max2 = child->childCount(); // Niveau 1: en-têtes "échantillons", "instruments", "presets" for (unsigned int j = 0; j < max2; j++) { // Niveau 2: sample, instrument ou preset for (int k = 0; k < child->child(j)->childCount(); k++) { QTreeWidgetItem * item = child->child(j)->child(k); if (item->text(6) == "0") // Si l'élément n'est pas masqué par une suppression non définitive { if (item->text(0).toLower().indexOf(qStr) != -1 || item->isSelected()) { if (item->text(2) == "smpl") displaySample(item->text(1).toInt(), item->text(3).toInt()); else if (item->text(2) == "inst") displayInstrument(item->text(1).toInt(), item->text(3).toInt()); else if (item->text(2) == "prst") displayPreset(item->text(1).toInt(), item->text(3).toInt()); } } } } } }
void CFontFileListView::selectionChanged() { QList<QTreeWidgetItem *> items(selectedItems()); QTreeWidgetItem *item; foreach(item, items) if(!item->parent() && item->isSelected()) item->setSelected(false); }
/*! \brief Launch YARPScope Inspection modality*/ void ApplicationViewWidget::onYARPScope() { if(manager.busy()){ return; } yarp::manager::ErrorLogger* logger = yarp::manager::ErrorLogger::Instance(); YscopeWindow dlg; dlg.setModal(true); if(dlg.exec() != QDialog::Accepted){ return; } int strIndex = dlg.getIndex(); for(int i=0;i<ui->connectionList->topLevelItemCount();i++){ QTreeWidgetItem *it = ui->connectionList->topLevelItem(i); if(it->isSelected()){ QString from = it->text(3); QString to = QString("/inspect").arg(from); QString env = QString("YARP_PORT_PREFIX=%1").arg(to); to += "/yarpscope"; QString param; param = QString("--title %1:%2 --bgcolor white --color blue --graph_size 2 --index %2").arg(from).arg(strIndex); yarp::manager::LocalBroker launcher; if(launcher.init("yarpscope", param.toLatin1().data(), NULL, NULL, NULL, env.toLatin1().data())){ if(!launcher.start() && strlen(launcher.error())){ QString msg; msg = QString("Error while launching yarpscope. %1").arg(launcher.error()); logger->addError(msg.toLatin1().data()); reportErrors(); } else{ // waiting for the port to get open double base = yarp::os::Time::now(); while(!timeout(base, 3.0)) if(launcher.exists(to.toLatin1().data())) break; if(!launcher.connect(from.toLatin1().data(), to.toLatin1().data(), "udp")){ QString msg; msg = QString("Cannot inspect '%1' : %2").arg(from).arg(launcher.error()); logger->addError(msg.toLatin1().data()); launcher.stop(); reportErrors(); } } } } } yarp::os::Time::delay(0.1); }
void QCustomTreeWidget::mousePressEvent(QMouseEvent *e) { QTreeWidgetItem *item = itemAt(e->pos()); switch (e->button()) { case Qt::LeftButton: if (item !=NULL) { bNewlySelected = !item->isSelected(); // the item will be selected (and not be unselected by mouseReleaseEvent) } QTreeWidget::mousePressEvent(e); break; case Qt::RightButton: if (item != NULL) { setCurrentItem(item); QCustomTreeWidgetItem *qItem = dynamic_cast<QCustomTreeWidgetItem*>(item); Item *treeItem = qItem->branch()->item(); QAction* action = menuIcons->exec(e->globalPos()); if (action == actionNone) { item->setIcon(1,QIcon()); treeItem->setState(Item::sNone); } else if (action == actionProgress) { item->setIcon(1,action->icon()); treeItem->setState(Item::sProgress); } else if (action == actionFailure) { item->setIcon(1,action->icon()); treeItem->setState(Item::sFailure); } else if (action == actionSuccess) { item->setIcon(1,action->icon()); treeItem->setState(Item::sSuccess); } else if (action == actionDelete) { deleteItem(item); } else if (action == actionAdd) { addItem(qItem); } } else if (topLevelItemCount()==0) { addItem(NULL); } break; default: break; } }
void KoRdfSemanticTreePrivate::buildSelectedSet(QTreeWidgetItem *parent, QSet<QString> &ret) { for (int i = 0; i < parent->childCount(); ++i) { QTreeWidgetItem *c = parent->child(i); if (c->isSelected()) { if (KoRdfSemanticTreeWidgetItem *item = dynamic_cast<KoRdfSemanticTreeWidgetItem*>(c)) { ret << item->semanticItem()->name(); } } } }
void InputSettingsWindow::assignKey() { int index = device->currentIndex(); if(index < deviceItem.size()) { InputGroup &group = *deviceItem[index]; QTreeWidgetItem *item = list->currentItem(); if(item && item->isSelected()) { signed i = listItem.find(item); if(i >= 0) winInputCapture->activate(group[i]); } } }
void ServerViewWidget::addRoom( const std::shared_ptr<RoomConfigAdapter>& roomConfigAdapter ) { const unsigned int chairCount = roomConfigAdapter->getChairCount(); const bool passwordProtected = roomConfigAdapter->isPasswordProtected(); const unsigned int roomId = roomConfigAdapter->getRoomId(); const QString roomName = QString::fromStdString( roomConfigAdapter->getName() ); QStringList roomSetCodes; for( const auto& setCode : roomConfigAdapter->getSetCodes() ) { roomSetCodes.push_back( QString::fromStdString( setCode ) ); } // Set codes for grid draft are too unwieldly. if( roomConfigAdapter->isGridDraft() ) { roomSetCodes.clear(); roomSetCodes.push_back( "cube" ); } const QString roomType = roomConfigAdapter->isBoosterDraft() ? "booster" : roomConfigAdapter->isSealedDraft() ? "sealed" : roomConfigAdapter->isGridDraft() ? "grid" : "custom"; QString playersStr = QString( "0/%1" ).arg( chairCount ); QString passwordProtectedStr = passwordProtected ? "yes" : "no"; int treeRowIndex = mRoomTreeWidget->topLevelItemCount(); // last item bool itemSelected = false; // Delete the item if it exists, and set up to insert at same index. if( mRoomIdToRoomDataMap.contains( roomId ) ) { mLogger->warn( "addRoom: roomId {} already exists, overwriting", roomId ); treeRowIndex = mRoomIdToRoomDataMap[roomId].treeRowIndex; QTreeWidgetItem* item = mRoomTreeWidget->takeTopLevelItem( treeRowIndex ); itemSelected = item->isSelected(); delete item; } QTreeWidgetItem* item = new QTreeWidgetItem( { roomName, roomType, roomSetCodes.join( "/" ), playersStr, passwordProtectedStr } ); mRoomTreeWidget->insertTopLevelItem( treeRowIndex, item ); item->setSelected( itemSelected ); mRoomTreeRowToRoomIdMap[treeRowIndex] = roomId; mRoomIdToRoomDataMap[roomId] = { chairCount, passwordProtected, treeRowIndex }; }
/*! \brief Launch YARPView Inspection modality*/ void ApplicationViewWidget::onYARPView() { if(manager.busy()){ return; } yarp::manager::ErrorLogger* logger = yarp::manager::ErrorLogger::Instance(); for(int i=0;i<ui->connectionList->topLevelItemCount();i++){ QTreeWidgetItem *it = ui->connectionList->topLevelItem(i); if(it->isSelected()){ QString from = it->text(3); QString to = QString("/inspect").arg(from); QString env = QString("YARP_PORT_PREFIX=%1").arg(to); to += "/yarpview/img:i"; yarp::manager::LocalBroker launcher; if(launcher.init("yarpview", NULL, NULL, NULL, NULL, env.toLatin1().data())) { if(!launcher.start() && strlen(launcher.error())) { QString msg; msg = QString("Error while launching yarpview. %1").arg(launcher.error()); logger->addError(msg.toLatin1().data()); reportErrors(); } else { // waiting for the port to get open double base = yarp::os::Time::now(); while(!timeout(base, 3.0)){ if(launcher.exists(to.toLatin1().data())){ break; } } if(!launcher.connect(from.toLatin1().data(), to.toLatin1().data(), "udp")){ QString msg; msg = QString("Cannot inspect '%1' : %2").arg(from).arg(launcher.error()); logger->addError(msg.toLatin1().data()); launcher.stop(); reportErrors(); } } } } } yarp::os::Time::delay(0.1); }
void InputSettingsWindow::unassignKey() { int index = device->currentIndex(); if(index < deviceItem.size()) { InputGroup &group = *deviceItem[index]; QTreeWidgetItem *item = list->currentItem(); if(item && item->isSelected()) { signed i = listItem.find(item); if(i >= 0) { group[i]->id = "none"; inputManager.bind(); //update key bindings to reflect object ID change above item->setText(2, (const char*)group[i]->id); } } } }
void GroupObjectDialog::listViewSelectionChanged() { if (fwbdebug) qDebug("GroupObjectDialog::listViewSelectionChanged()"); selectedObjects.clear(); for (int it=0; it<listView->topLevelItemCount(); ++it) { QTreeWidgetItem *itm = listView->topLevelItem(it); if (itm->isSelected()) { int obj_id = itm->data(0, Qt::UserRole).toInt(); if (fwbdebug) qDebug("obj_id=%d", obj_id); selectedObjects.push_back(obj_id); } } }
void BlocksTree::mouseMoveEvent( QMouseEvent *event ) { if ( event->buttons() & Qt::LeftButton ) { QTreeWidgetItem *tWI = itemAt( event->pos() ); if ( tWI && tWI->parent() && tWI->isSelected() ) { QMimeData *mimeData = new QMimeData; Block *block = ( Block * )tWI->data( 0, Qt::UserRole ).value< quintptr >(); mimeData->setData( "Block", QByteArray( ( const char * )&block, sizeof block ) ); QDrag *drag = new QDrag( this ); drag->setPixmap( tWI->data( 0, Qt::DecorationRole ).value< QPixmap >() ); drag->setMimeData( mimeData ); drag->exec(); } } QTreeWidget::mouseMoveEvent( event ); }
void custom_tree::remove_selected() { QList<QString> nn; friend_record fr; const LinphoneFriend *lf; for (int i = 0; i < topLevelItemCount(); i++) { QTreeWidgetItem* ti = topLevelItem(i); if (ti->isSelected()) { fr = ti->data(1, c_friend_role).value<friend_record>(); nn.append(fr.name()); lf = fr.frienddata(); linphone_core_remove_friend(linphone_qt_get_core(), (LinphoneFriend *)lf); } } friends_->remove(nn); w->show_friends(); }
void KEquityPriceUpdateDlg::slotUpdateSelectedClicked() { // disable sorting while the update is running to maintain the current order of items on which // the update process depends and which could be changed with sorting enabled due to the updated values lvEquityList->setSortingEnabled(false); QTreeWidgetItem* item = lvEquityList->invisibleRootItem()->child(0); int skipCnt = 1; while (item && !item->isSelected()) { item = lvEquityList->invisibleRootItem()->child(skipCnt); ++skipCnt; } if (item) { prgOnlineProgress->setMaximum(1 + lvEquityList->invisibleRootItem()->childCount()); prgOnlineProgress->setValue(skipCnt); m_webQuote.launch(item->text(SYMBOL_COL), item->text(ID_COL), item->text(SOURCE_COL)); } else { logErrorMessage("No security selected."); } }
void StaffTextProperties::saveChannel(int channel) { QList<ChannelActions>* ca = _staffText->channelActions(); int n = ca->size(); for (int i = 0; i < n; ++i) { ChannelActions* a = &(*ca)[i]; if (a->channel == channel) { ca->removeAt(i); break; } } ChannelActions a; a.channel = channel; for (int i = 0; i < actionList->topLevelItemCount(); ++i) { QTreeWidgetItem* item = actionList->topLevelItem(i); if (item->isSelected()) a.midiActionNames.append(item->text(0)); } ca->append(a); }
/*! \brief Called when the Kill button has been pressed */ bool ApplicationViewWidget::onKill() { if(manager.busy()){ return false; } if(QMessageBox::question(this,"Killing modules!","Are you sure?") != QMessageBox::Yes){ return true; } std::vector<int> MIDs; for(int i=0;i<ui->moduleList->topLevelItemCount();i++){ QTreeWidgetItem *it = ui->moduleList->topLevelItem(i); if(it->isSelected()){ //moduluesIDs.append(it->text(1).toInt()); MIDs.push_back(it->text(1).toInt()); manager.updateExecutable(it->text(1).toInt(), it->text(4).toLatin1().data(), it->text(3).toLatin1().data(), it->text(5).toLatin1().data(), it->text(6).toLatin1().data(), it->text(7).toLatin1().data()); it->setText(2,"waiting"); it->setIcon(0,QIcon(":/images/progress_ico.png")); it->setTextColor(2,QColor("#000000")); } } manager.safeKill(MIDs); yarp::os::Time::delay(0.1); selectAllModule(false); return true; }