int main(int argc, char *argv[]) { QApplication a(argc, argv); QWidget window; QLabel* title = new QLabel("Custom widgets on a QListWidget"); title->setAlignment(Qt::AlignHCenter); QListWidget* list = new QListWidget; list->addItem("foo"); for (int i = 0; i < 5; i++){ QListWidgetItem* item; item = new QListWidgetItem(list); list->addItem(item); // QPushButton* button = new QPushButton("hey"); Form *f = new Form; item->setSizeHint(f->minimumSizeHint()); list->setItemWidget(item, f); } list->addItem("bar"); QVBoxLayout* layout = new QVBoxLayout(&window); layout->addWidget(title); layout->addWidget(list); window.setLayout(layout); window.show(); return a.exec(); }
QWidget* ProjectWindow::setupParametersWidget() { ParametersWidget* parameters = new ParametersWidget(projectData.projectParameterData(), projectData.projectParameterData()->getLookupTable().keys(), 1); QGridLayout* mainLayout = new QGridLayout(); QHBoxLayout* headerLayout = new QHBoxLayout; headerLayout->addStretch(0); QLabel* searchLabel = new QLabel("Search Parameters:"); QLineEdit* searchEditBox = new QLineEdit(); searchEditBox->setFrame(false); searchLabel->setBuddy(searchEditBox); searchEditBox->setPlaceholderText("Search Parameters"); searchEditBox->setFixedWidth(200); connect(searchEditBox, &QLineEdit::editingFinished, [=]() { parameters->searchParams(searchEditBox->text()); }); headerLayout->addWidget(searchLabel, 0); headerLayout->addWidget(searchEditBox, 0); headerLayout->addStretch(1); QListWidget* imagesBox = new QListWidget(); imagesBox->setSelectionMode(QAbstractItemView::SingleSelection); imagesBox->addItem("Project Parameters"); imagesBox->setCurrentRow(0); for (ProjectImage* image : projectData.projectImageList()) { imagesList_.append(image); imagesBox->addItem(image->toString()); } connect(&projectData, &ProjectData::imageAdded, [ = ](ProjectImage * image){ imagesList_.append(image); imagesBox->addItem(image->toString()); }); connect(&projectData, &ProjectData::imageMoved, [ = ](ProjectImage* image) { int idx = imagesList_.indexOf(image) + 1; if(idx > 0) { imagesBox->item(idx)->setText(image->toString()); } }); connect(imagesBox, &QListWidget::currentRowChanged, [ = ](int id) { if(id == 0) parameters->resetConf(projectData.projectParameterData()); else parameters->resetConf(imagesList_[id -1]->parameters()); }); BlockContainer* imagesBoxContainer = new BlockContainer("Select the scope of parameters", imagesBox); imagesBoxContainer->setMaximumWidth(300); mainLayout->addLayout(headerLayout, 0, 0, 1, 1); mainLayout->addWidget(parameters, 1, 0, 1, 1); mainLayout->addWidget(imagesBoxContainer, 0, 1, 2, 1); QWidget* mainWid = new QWidget; mainWid->setLayout(mainLayout); return mainWid; }
void KListWidgetSearchLineTest::testAddItems() { QListWidget listWidget; listWidget.addItem("Matching test item"); listWidget.addItem("Another test item"); KListWidgetSearchLine searchLine(0, &listWidget); searchLine.setText("match"); // The initial filtering is delayed; we have to wait while(!listWidget.item(1)->isHidden()) { QTest::qWait(50); } QVERIFY(!listWidget.item(0)->isHidden()); QVERIFY(listWidget.item(1)->isHidden()); // Add two items listWidget.addItem("Another item that matches the search pattern"); listWidget.addItem("This item should be hidden"); QVERIFY(!listWidget.item(0)->isHidden()); QVERIFY(listWidget.item(1)->isHidden()); QVERIFY(!listWidget.item(2)->isHidden()); QVERIFY(listWidget.item(3)->isHidden()); // Modify an item listWidget.item(3)->setText("Now this item matches"); QVERIFY(!listWidget.item(0)->isHidden()); QVERIFY(listWidget.item(1)->isHidden()); QVERIFY(!listWidget.item(2)->isHidden()); QVERIFY(!listWidget.item(3)->isHidden()); }
MainWindow::MainWindow(QWidget *parent, QFlag flags) : QMainWindow(parent, flags) { // Set window title setWindowTitle("3D Computergrafik I - SS2015 - Aufgabenblatt 4"); // Create main container QWidget *container = new QWidget(); setCentralWidget(container); // Add list (on the left) QListWidget *list = new QListWidget(container); list->addItem("Aufgabe 12"); list->addItem("Aufgabe 13"); list->addItem("Aufgabe 14"); list->setMaximumWidth(150); // Add stack of exercise windows (on the right) QStackedWidget *stack = new QStackedWidget(container); // Add exercises to widget stack->addWidget(new GLViewer(new Exercise12())); stack->addWidget(new GLViewer(new Exercise13())); stack->addWidget(new GLViewer(new Exercise14())); // Create layout QHBoxLayout *layout = new QHBoxLayout; layout->addWidget(list); layout->addWidget(stack); container->setLayout(layout); // Connect selection-event of list to select the current visible window connect(list, SIGNAL(currentRowChanged(int)), stack, SLOT(setCurrentIndex(int))); }
void HistoryElementModifyEvent::doEventPlace() { if(!m_scene) return; LvlScene* lvlScene; if(!(lvlScene = qobject_cast<LvlScene*>(m_scene))) return; LevelSMBX64Event rmEvents = m_event; MainWinConnect::pMainWin->dock_LvlEvents->setEventToolsLocked(true); QListWidgetItem * item; item = new QListWidgetItem; item->setText(rmEvents.name); item->setFlags(Qt::ItemIsEditable); item->setFlags(item->flags() | Qt::ItemIsEnabled); item->setFlags(item->flags() | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsSelectable); item->setData(Qt::UserRole, QString::number(rmEvents.meta.array_id) ); QListWidget* evList = MainWinConnect::pMainWin->dock_LvlEvents->getEventList(); LevelSMBX64Event NewEvent = rmEvents; lvlScene->m_data->events.push_back(NewEvent); evList->addItem(item); lvlScene->m_data->meta.modified = true; MainWinConnect::pMainWin->EventListsSync(); MainWinConnect::pMainWin->dock_LvlEvents->setEventToolsLocked(false); }
void MessageHandlerWidget::fatalMessageReceived(const QString &app, const QString &message, const QTime &time, const QStringList &backtrace) { if (Endpoint::isConnected() && !qobject_cast<MessageHandlerClient*>(ObjectBroker::object<MessageHandlerInterface*>())) { // only show on remote side return; } QDialog dlg; dlg.setWindowTitle(tr("QFatal in %1 at %2").arg(app).arg(time.toString())); QGridLayout *layout = new QGridLayout; QLabel *iconLabel = new QLabel; QIcon icon = dlg.style()->standardIcon(QStyle::SP_MessageBoxCritical, 0, &dlg); int iconSize = dlg.style()->pixelMetric(QStyle::PM_MessageBoxIconSize, 0, &dlg); iconLabel->setPixmap(icon.pixmap(iconSize, iconSize)); iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); layout->addWidget(iconLabel, 0, 0); QLabel *errorLabel = new QLabel; errorLabel->setTextFormat(Qt::PlainText); errorLabel->setWordWrap(true); errorLabel->setText(message); layout->addWidget(errorLabel, 0, 1); QDialogButtonBox *buttons = new QDialogButtonBox; if (!backtrace.isEmpty()) { QListWidget *backtraceWidget = new QListWidget; foreach (const QString &frame, backtrace) { backtraceWidget->addItem(frame); }
/** Loads the settings for this page */ void DirectoriesDialog::load() { /* get the shared directories */ rsiface->lockData(); /* Lock Interface */ std::list<std::string>::const_iterator it; const std::list<std::string> &dirs = rsiface->getConfig().sharedDirList; /* get a link to the table */ QListWidget *listWidget = ui.dirList; /* remove old items ??? */ listWidget->clear(); for(it = dirs.begin(); it != dirs.end(); it++) { /* (0) Dir Name */ listWidget->addItem(QString::fromStdString(*it)); } ui.incomingDir->setText(QString::fromStdString(rsiface->getConfig().incomingDir)); rsiface->unlockData(); /* UnLock Interface */ listWidget->update(); /* update display */ }
void CQReportDefinition::btnItemClicked() { assert(CCopasiRootContainer::getDatamodelList()->size() > 0); CModel* pModel = (*CCopasiRootContainer::getDatamodelList())[0]->getModel(); if (!pModel) return; std::vector< const CCopasiObject * > SelectedVector = // CCopasiSelectionDialog::getObjectVector(this, CQSimpleSelectionTree::NO_RESTRICTION); CCopasiSelectionDialog::getObjectVector(this, CQSimpleSelectionTree::AnyObject); CQReportListItem * pItem; if (SelectedVector.size() != 0) { QListWidget * pList = static_cast< QListWidget * >(mpReportSectionTab->currentPage()); std::vector< const CCopasiObject * >::const_iterator it = SelectedVector.begin(); std::vector< const CCopasiObject * >::const_iterator end = SelectedVector.end(); for (; it != end; ++it) { pItem = new CQReportListItem(*it); pList->addItem(pItem); } mChanged = true; } return; }
void MainWindow::fillLists(DisplayData *display) { QListWidget* list; unsigned char rowsCount = display->getRowCount(); if(font != nullptr) for(int i=1;i<=4;i++) { switch(i) { case 1:list = listOfRows1;break; case 2:list = listOfRows2;break; case 3:list = listOfRows3;break; case 4:list = listOfRows4;break; } if(rowsCount>=i) { list->clear(); for(int j=0;j<display->getCountOfLinesInRow(i-1);j++) { QString text = QString::number(j) + ")" + display->getLine(i-1,j)->getAsString(font); list->addItem(text); } } quint16 num = lcd->getCurrentLineNumber(i-1); if(num<list->count()) list->setCurrentRow(num,QItemSelectionModel::SelectCurrent); } }
QWidget* OperationsDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const { const QVariant value = index.data(Qt::EditRole); if (value.type() == QVariant::StringList) { // list of possible values const QStringList list = qvariant_cast<QStringList>(value); if (!list.isEmpty()) { QWidget *editor = nullptr; if (list[0] == "__MultiValue__") { MultiValueEditor *mv = new MultiValueEditor(list, parent); connect(mv, SIGNAL(okClicked()), this, SLOT(commitAndCloseEditor())); editor = mv; } else if (list[0] == "__TimeSig__") { TimeSigEditor *ts = new TimeSigEditor(list, parent); connect(ts, SIGNAL(okClicked()), this, SLOT(commitAndCloseEditor())); editor = ts; } else { QListWidget *lw = new QListWidget(parent); for (const auto &item: list) lw->addItem(item); connect(lw, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(commitAndCloseEditor())); editor = lw; } return editor; } }
void HistoryLog::undo() { int size = ui->HistoryLogList->count(); if(size > 0) { QString last = historyLog.back(); QListWidgetItem* it = ui->HistoryLogList->takeItem(size-1); delete it; QStringList pieces = last.split( ":" ); QString itemPiece = pieces[0].mid(0,pieces[0].count()-4).trimmed(); QString fromPiece = pieces[1].mid(0,pieces[1].count()-4).trimmed(); QString toPiece = pieces[2].trimmed(); QListWidget* from = findWidgetByName(fromPiece); QListWidget* to = findWidgetByName(toPiece); QListWidgetItem* item; for(int idx = 0; idx< to->count(); idx++) { if(to->item(idx)->text() == itemPiece) { item = to->takeItem(idx); from->addItem(item); break; } } historyLog.erase(historyLog.end()-1); } }
void ConfigPage::createPage() { QGroupBox* configGroup = new QGroupBox(tr("Provider Configuration")); QListWidget* providerList = new QListWidget; QDir dir("/usr/local/lib/Filu/provider"); int loop; for (loop = 2; loop < (int) dir.count(); loop++) { QString provider = dir[loop]; //providerList->addItem(dir[loop]); QListWidgetItem* providerItem = new QListWidgetItem(providerList); if(isProviderInstalled(provider)) providerItem->setIcon(QIcon(":/icons/ok.xpm")); else providerItem->setIcon(QIcon(":/icons/disable_gray.xpm")); providerItem->setText(dir[loop]); providerList->addItem(providerItem); } QPushButton* togleProviderBtn = new QPushButton; togleProviderBtn->setText(tr("Activate")); QHBoxLayout* serverLayout = new QHBoxLayout; serverLayout->addWidget(providerList); serverLayout->addWidget(togleProviderBtn); QVBoxLayout* configLayout = new QVBoxLayout; configLayout->addLayout(serverLayout); configGroup->setLayout(configLayout); QVBoxLayout* mainLayout = new QVBoxLayout; mainLayout->addWidget(configGroup); mainLayout->addStretch(1); setLayout(mainLayout); }
bool Configurator::loadSectionItem( QDomNode sectionItem, QListWidget& listWidget ) { if( false == sectionItem.hasChildNodes() ) return false; if( sectionItem.nodeName() != c_sectionItemNodeName ) return false; QDomNamedNodeMap sectionItemAttributes = sectionItem.attributes(); if( false == sectionItemAttributes.contains(c_attributeName) ) return false; if( false == sectionItemAttributes.contains(c_attributeText) ) return false; // add the item to the section QString sectionItemName = sectionItemAttributes.namedItem(c_attributeName).nodeValue(); QString sectionItemText = sectionItemAttributes.namedItem(c_attributeText).nodeValue(); QListWidgetItem* listWidgetItem = new QListWidgetItem(); listWidgetItem->setText( sectionItemText ); listWidgetItem->setData( Qt::UserRole, sectionItemName ); listWidget.addItem( listWidgetItem ); return true; }
void MainWindow::formChannelList(){ if (m_availableChannelsQuery->getChannels().size() == 0 ) return; else { m_availableChannels = m_availableChannelsQuery->getChannels(); } m_subscribedChannels = m_subscribedChannelsQuery->getChannels(); QListWidget * listWidget = ui->channelsListWidget; QListWidget * subscribedListWidget = ui->subscribedListWidget; // Tab - channels while(listWidget->count()>0) { listWidget->takeItem(0); } foreach (Channel s, m_availableChannels){ QListWidgetItem * item = new QListWidgetItem(s.getName()); if (isSubscribed(s.getName())){ item->setBackgroundColor(Qt::lightGray); } listWidget->addItem(item); }
void CReportDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const { const QAbstractItemModel* model = index.model(); QVariant data = index.data(Qt::DisplayRole); //Populate the editor if(data.type() != QVariant::List) QStyledItemDelegate::setEditorData(editor,index); QVariantList validReports = index.data(Qt::EditRole).toList(); QVariantList currentReportsList = data.toList(); QListWidget* listWidget = static_cast<QListWidget*>(editor); // Prepare the items in the list foreach(QVariant dataElement,validReports) { QString outString = dataElement.toString(); if(m_reportNameModel!=(QAbstractItemModel*)NULL) { outString+=":"+searchReportColumnForId(dataElement.toInt()); } QListWidgetItem* item = new QListWidgetItem(outString); item->setData(Qt::UserRole,dataElement); //Now, determine if the ítem SHOULD be checked if(currentReportsList.contains(dataElement)) { item->setCheckState(Qt::Checked); } else { item->setCheckState(Qt::Unchecked); } listWidget->addItem(item); }
void PreferencesDialog::moveSelectedListWidgetItems(QListWidget &from, QListWidget &to) { for (auto const &item : from.selectedItems()) { auto actualItem = from.takeItem(from.row(item)); if (actualItem) to.addItem(actualItem); } }
void MainWindow::readVesselsToViews() { QString injectFromPath = findChild<QTextEdit*>("fileToInjectTextEdit")->toPlainText(); QString coreSavePath = findChild<QTextEdit*>("SavePathTextEdit")->toPlainText(); if(!isSFSFile(coreSavePath) || !isSFSFile(injectFromPath)) QMessageBox::warning(0, QString("File error"), QString("One or more of your paths have become invalid, please re-check them!")); KSPS3::SaveFormater coreSave(coreSavePath); std::vector<QSharedPointer<KSPS3::VesselData>> savedVessels; importSave(&coreSave, &savedVessels); QListWidget* savesList = findChild<QListWidget*>("vesselsInSaveListView"); for(std::size_t i = 0; i < savedVessels.size(); i++) { VesselListWidgetItem* element = new VesselListWidgetItem(savedVessels[i], savesList); element->setText(savedVessels[i]->GetName()); m_diagnosticsWindow->append(*element->GetVesselData()->AccessFullText()); savesList->addItem(element); } KSPS3::SaveFormater injectionFile(injectFromPath); std::vector<QSharedPointer<KSPS3::VesselData>> vesselsToInject; importSave(&injectionFile, &vesselsToInject); QListWidget* injectionList = findChild<QListWidget*>("InjectableVesselsListView"); for(std::size_t i = 0; i < vesselsToInject.size(); i++) { VesselListWidgetItem* element = new VesselListWidgetItem(vesselsToInject[i], injectionList); element->setText(vesselsToInject[i]->GetName()); m_diagnosticsWindow->append(*element->GetVesselData()->AccessFullText()); savesList->addItem(element); } std::stringstream stringBuilder; for(std::size_t i = 0; i < vesselsToInject.size(); i++) { stringBuilder << "vessel " << i << std::endl << vesselsToInject[i]->GetName().toStdString() << std::endl << "PID: " << vesselsToInject[i]->GetPID().toStdString(); } findChild<QTextEdit*>("saveFileTextEdit")->setText(QString(stringBuilder.str().c_str())); }
void FireTrackWidgetPrivate::update_waveform_list() { m_waveform_list->clear(); int N=m_waveforms.N3(); for (int i=0; i<N; i++) { QListWidgetItem *it=new QListWidgetItem(); it->setText(QString("Neuron %1").arg(i+1)); it->setData(Qt::UserRole,i); m_waveform_list->addItem(it); } }
//! Creates the widgets, especially the list of available data sources, which is filled from the dataSources parameter DataSourceDialog(const std::vector<DataSourceDescription *> &dataSources) { QVBoxLayout *layout = new QVBoxLayout(this); layout->addWidget(new QLabel(tr("Please select the desired data source"))); dataSourceList = new QListWidget(); for (size_t i = 0; i < dataSources.size(); i++) dataSourceList->addItem(dataSources[i]->name()); connect(dataSourceList, SIGNAL(itemDoubleClicked(QListWidgetItem *)), SLOT(accept())); layout->addWidget(dataSourceList); }
void MainWindow::ProcessAdded(Process* _process) { QListWidget* list = this->ui.procListWidget; list->addItem(QString::number(_process->id, 10)); QListWidgetItem* item = this->GetProcessItem(_process); if(item != NULL) { int row = list->row(item); list->setCurrentRow(row); } }
void Assessment::listDetail(QWidget* wgtDetail) { QListWidget* listTitles = wgtDetail->findChild<QListWidget*>("lwgtTitles"); QListWidget* listValues = wgtDetail->findChild<QListWidget*>("lwgtValues"); wgtDetail->findChild<QDoubleSpinBox*>("sedMark")->hide(); wgtDetail->findChild<QLabel*>("lblName")->show(); wgtDetail->findChild<QLabel*>("lblMark")->hide(); wgtDetail->findChild<QLabel*>("lblTotal")->hide(); wgtDetail->findChild<QLabel*>("lblName")->setText(QString::fromStdString(getAssessName())); stringstream outString; listTitles->clear(); listValues->clear(); listTitles->addItem(QString::fromStdString("Current Mark:")); outString << fixed << setprecision(2) << getPercentage() << "%"; listValues->addItem(QString::fromStdString(outString.str())); listTitles->addItem(QString::fromStdString("Weighted:")); outString.str(""); outString << fixed << setprecision(2) << getWeightedMark() << "/" << getWeight(); listValues->addItem(QString::fromStdString(outString.str())); }
/** * Adds a Peer to the list of contacts, if it doesnt exist from before. * @brief MainWindow::addLocalContact * @param peer Peer to add * @return false if Peer already is in contact list, else true */ bool MainWindow::addLocalContact(Peer* peer) { QListWidget* list = ui->lstContacts; QString str(peer->getName() + "/" + peer->getIp()); for (int i = 0; i < list->count(); ++i) { if (list->item(i)->data(Qt::DisplayRole).toString().compare(str) == 0) return false; } list->addItem(str); return true; }
int main(int argc, char *argv[]) { QApplication a(argc, argv); QLabel *label = new QLabel; label->setFixedWidth(100); QListWidget *listWidget = new QListWidget; listWidget->addItem(new QListWidgetItem(QIcon(QObject::tr("1.png")), QObject::tr("China"))); listWidget->addItem(new QListWidgetItem(QIcon(QObject::tr("2.png")), QObject::tr("Hong Kong"))); listWidget->addItem(new QListWidgetItem(QIcon(QObject::tr("3.png")), QObject::tr("Macau"))); QHBoxLayout *mainlayout = new QHBoxLayout; mainlayout->addWidget(listWidget); mainlayout->addWidget(label); QObject::connect(listWidget, SIGNAL(currentTextChanged(QString)), label, SLOT(setText(QString))); QWidget *widget = new QWidget; widget->setLayout(mainlayout); widget->setWindowTitle(QObject::tr("QListWidget Demo")); widget->show(); return a.exec(); }
void LairTool::addBuilding() { QString text = nameBuildingForm->getName(); if (text.isEmpty()) return; QListWidget* list = getCurrentBuildingList(); if (list == NULL) return; list->addItem(text); }
GLInfoDialog::GLInfoDialog(GLInfo& glInfos, QWidget *parent) : QDialog(parent), _glInfo(glInfos) { QVBoxLayout* layout = new QVBoxLayout; QFormLayout* versionLayout = new QFormLayout; QGroupBox* versionsBox = new QGroupBox(tr("General")); QListWidget* extensionsList = new QListWidget; QVBoxLayout* extensionslayout = new QVBoxLayout; QGroupBox* extensionsBox = new QGroupBox(tr("Supported extensions")); QLabel* label; QFont font = this->font(); font.setBold(true); label = new QLabel(_glInfo.getVendorString().c_str()); label->setFont(font); versionLayout->addRow(tr("Vendor:"), label); label = new QLabel(_glInfo.getRendererString().c_str()); label->setFont(font); versionLayout->addRow(tr("Renderer:"), label); label = new QLabel(_glInfo.getOpenGLVersionString().c_str()); label->setFont(font); versionLayout->addRow(tr("GL Version:"), label); label = new QLabel(_glInfo.getGLSLVersionString().c_str()); label->setFont(font); versionLayout->addRow(tr("GLSL Version:"), label); versionsBox->setLayout(versionLayout); const std::vector< std::string >& ext = _glInfo.getExtensions(); for (std::vector<std::string>::const_iterator it = ext.begin(); it != ext.end(); ++it) { extensionsList->addItem((*it).c_str()); } extensionslayout->addWidget(extensionsList); extensionslayout->addWidget(new QLabel(QString("Total: %1").arg(_glInfo.getExtensions().size())), 0, Qt::AlignRight); extensionsBox->setLayout(extensionslayout); layout->addWidget(versionsBox); layout->addWidget(extensionsBox); setLayout(layout); setWindowTitle(tr("OpenGL Info")); }
void ACLController::buildList() { QListWidget *lw = m_ui->listWidget; lw->clear(); m_hash.clear(); VersionControl::UserAccessSeq *users = m_model->getUsers(); for (unsigned int i = 0; i < users->length(); i++) { VersionControl::UserAccess user = (*users)[i]; QString name = QString::fromUtf8(user.grantee->getName()); QListWidgetItem *lwi = new QListWidgetItem(name); lwi->setCheckState(user.level == VersionControl::ReadWrite ? Qt::Checked : Qt::Unchecked); lw->addItem(lwi); m_hash[lwi] = user; } }
void LSQFitDialog::ListTarget() { if (m_target) { Residue *res = m_target->residuesBegin(); QListWidget *list = targetListWidget; list->clear(); while (res != NULL) { list->addItem(resid(res).c_str()); res = res->next(); } } }
void SceneDockWidget::rebuildMeshList() { SceneData* data = controller->getSceneData(); QListWidget* meshList = ui->listWidgetMeshes; meshList->clear(); for(unsigned int i = 0; i < data->meshes.size(); ++i) { //Mesh* mesh = data->meshes.at(i).get(); meshList->addItem(QString("Mesh%1").arg(i)); } }
void SceneDockWidget::rebuildMaterialList() { SceneData* data = controller->getSceneData(); QListWidget* materialList = ui->listWidgetMaterials; materialList->clear(); for(unsigned int i = 0; i < data->materials.size(); ++i) { Material* mat = data->materials.at(i).get(); materialList->addItem(QString::fromStdString(mat->name)); } }
void MainWindow::on_removeVesselPushButton_clicked() { QListWidget* injectionList = findChild<QListWidget*>("InjectableVesselsListView"); QListWidget* savesList = findChild<QListWidget*>("vesselsInSaveListView"); QList<QListWidgetItem*> selected = savesList->selectedItems(); for(QList<QListWidgetItem*>::Iterator it = selected.begin(); it != selected.end(); it++) { QListWidgetItem* item = (*it); savesList->takeItem(savesList->row(item)); injectionList->addItem(item); } }