//! Reload settings. void TraceDock::readSettings() { Settings s("common.trace"); QColor colorD = QColor(s.value("deadlock", defTraceDeadlock).value<QColor>()); QColor colorE = QColor(s.value("error", defTraceError).value<QColor>()); bool changed = colorD != deadlock_ || colorE != error_; deadlock_ = colorD; error_ = colorE; // update if(changed) { QPalette def; for(int i=0; i < trace_->count(); ++i) { QListWidgetItem * item = trace_->item(i); if (!sim_->isValid(i)) { item->setForeground(error_); } else if (sim_->transitionCount(i) == 0) { item->setForeground(deadlock_); } else { item->setForeground(def.color(QPalette::Text)); } } } }
void MainWindow::on_movieConverterThread_finishedConvert(MovieInfo const & movieInfo, bool ok) { ui->statusBar->clearMessage(); QListWidgetItem* item = getListItem(movieInfo); if (item) { if (ok) item->setForeground(QBrush(Qt::green, Qt::SolidPattern)); else item->setForeground(QBrush(Qt::red, Qt::SolidPattern)); } }
void Datoteka::ucitaj() { flag = false; ui->listWidget->clear(); instructions.clear(); QFile file("komande.txt"); if(!file.open(QIODevice::ReadOnly)) { QMessageBox::information(0, "error", file.errorString()); } QTextStream in(&file); while(!in.atEnd()) { QString line = in.readLine(); if(!line.contains(QRegExp("Q[0-9]+ [a-z] [a-z] [R,S,L] Q[0-9]+"))) { QListWidgetItem *item = new QListWidgetItem(line, ui->listWidget); item->setForeground(Qt::red); // sets red text item->setBackground(Qt::white); ui->listWidget->addItem(item); ui->listWidget->show(); flag = true; } else { QListWidgetItem *item = new QListWidgetItem(line, ui->listWidget); instructions.push_back(line); item->setForeground(Qt::black); ui->listWidget->addItem(item); } } if(!flag) { emit upaliNext(); } else { emit losaKomanda(); } instructionLab->setVectorInstruction(instructions); file.close(); }
void MainWindow::on_movieConverterThread_startConvert(MovieInfo const & movieInfo) { ui->statusBar->showMessage("Converting " + movieInfo.name()); QListWidgetItem* item = getListItem(movieInfo); if (item) { item->setForeground(QBrush(Qt::blue, Qt::SolidPattern)); } }
int PartsBinListView::setItemAux(ModelPart * modelPart, int position) { if (modelPart->modelPartShared() == NULL) return position; if (modelPart->itemType() == ModelPart::Unknown) { // don't want the empty root to appear in the view return position; } emit settingItem(); QString moduleID = modelPart->moduleID(); if (contains(moduleID)) { return position; } QListWidgetItem * lwi = new QListWidgetItem(modelPart->title()); if (modelPart->itemType() == ModelPart::Space) { lwi->setBackground(QBrush(SectionHeaderBackgroundColor)); lwi->setForeground(QBrush(SectionHeaderForegroundColor)); lwi->setData(Qt::UserRole, 0); lwi->setFlags(0); lwi->setText(" " + TranslatedCategoryNames.value(modelPart->instanceText(), modelPart->instanceText())); } else { loadImage(modelPart, lwi, moduleID); } if(position > -1 && position < count()) { insertItem(position, lwi); } else { addItem(lwi); position = this->count(); } return position; }
CurveColorPick::CurveColorPick(const std::map<std::string, QColor> &mapped_colors, QWidget *parent) : QDialog(parent), ui(new Ui::CurveColorPick), _any_modified(false), _mapped_colors(mapped_colors) { ui->setupUi(this); for(auto& it : _mapped_colors) { QListWidgetItem* item = new QListWidgetItem( QString::fromStdString( it.first) ); item->setForeground( it.second ); ui->listWidget->addItem( item ); } _color_wheel = new color_widgets::ColorWheel(this); ui->verticalLayoutRight->insertWidget(0, _color_wheel ); _color_wheel->setMinimumWidth(150); _color_wheel->setMinimumHeight(150); _color_preview = new color_widgets::ColorPreview(this); ui->verticalLayoutRight->insertWidget(1, _color_preview ); _color_preview->setMinimumWidth(150); _color_preview->setMinimumHeight(100); connect(_color_wheel, &color_widgets::ColorWheel::colorChanged, _color_preview, &color_widgets::ColorPreview::setColor ); connect(_color_wheel, &color_widgets::ColorWheel::colorChanged, this, &CurveColorPick::on_colorChanged ); }
void UsersDialog::populateList(const QString &filter) { QRegExp nameFilter("*" + filter + "*"); nameFilter.setPatternSyntax(QRegExp::Wildcard); nameFilter.setCaseSensitivity(Qt::CaseInsensitive); ui->listWidget->clear(); if (userList) { for (QList<UserInfo>::iterator it = userList->begin(); it != userList->end(); ++it) { UserInfo &user(*it); if (filter.isEmpty() || nameFilter.exactMatch(user.name)) { if (user.validity == '-' && !ui->checkBox->isChecked()) continue; if (user.expiry.toTime_t() > 0 && user.expiry.daysTo(QDateTime::currentDateTime()) > 0 && !ui->checkBox->isChecked()) continue; QString userText = user.name + "\n" + user.key_id; if (user.created.toTime_t() > 0) { userText += " " + tr("created") + " " + user.created.toString(Qt::SystemLocaleShortDate); } if (user.expiry.toTime_t() > 0) userText += " " + tr("expires") + " " + user.expiry.toString(Qt::SystemLocaleShortDate); QListWidgetItem *item = new QListWidgetItem(userText, ui->listWidget); item->setCheckState(user.enabled ? Qt::Checked : Qt::Unchecked); item->setData(Qt::UserRole, QVariant::fromValue(&user)); if (user.have_secret) { // item->setForeground(QColor(32, 74, 135)); item->setForeground(Qt::blue); QFont font; font.setFamily(font.defaultFamily()); font.setBold(true); item->setFont(font); } else if (user.validity == '-') { item->setBackground(QColor(164, 0, 0)); item->setForeground(Qt::white); } else if (user.expiry.toTime_t() > 0 && user.expiry.daysTo(QDateTime::currentDateTime()) > 0) { item->setForeground(QColor(164, 0, 0)); } ui->listWidget->addItem(item); } } } }
void MainWindow::addSession() { if (!current_db_class) { return; } MTListWidget * lw = new MTListWidget; QDialog * d = createAddSessionDialogue(tr("Add session"), lw); QList<QDateTime> sessions_list; for (int i = 0; i < CLLSSListWidget->count(); ++i) { sessions_list << CLLSSListWidget->item(i)->data(Qt::UserRole).toDateTime(); } QFont font; font.setBold(true); for (int i = 0; i < SVLSListWidget->count(); ++i) { if (sessions_list.contains(SVLSListWidget->item(i)->data(Qt::UserRole).toDateTime())) { continue; } QListWidgetItem * item = new QListWidgetItem(*(SVLSListWidget->item(i))); item->setFont(font); item->setBackground(QBrush(QColor(255, 255, 255))); item->setForeground(QBrush(QColor(0, 0, 0))); lw->addItem(item); } for (int i = 0; i < SVLASListWidget->count(); ++i) { if (sessions_list.contains(SVLASListWidget->item(i)->data(Qt::UserRole).toDateTime())) { continue; } QListWidgetItem * item = new QListWidgetItem(*(SVLASListWidget->item(i))); item->setBackground(QBrush(QColor(255, 255, 255))); item->setForeground(QBrush(QColor(0, 0, 0))); lw->addItem(item); } lw->setCurrentRow(0); if (!d->exec()) { delete d; return; } if (lw->currentItem() == NULL) { delete d; return; } QDateTime datetime = lw->currentItem()->data(Qt::UserRole).toDateTime(); current_db_class->addSession(datetime); QListWidgetItem * item = new QListWidgetItem(*(lw->currentItem())); item->setFont(QFont()); CLLSSListWidget->addItem(item); delete d; setDatabaseModified(); Session * session = current_db_sessions.value(datetime, current_db_archivedsessions.value(datetime, new ArchivedSession(this))); SessionWizard wizard(session, current_db_class, this); wizard.setWindowModality(Qt::WindowModal); wizard.exec(); for (int i = 0; i < wizard.numMatchedPairs(); ++i) { current_db_class->member(wizard.studentNumberInClass(i))->addSession(datetime, wizard.studentNumberInSession(i)); } setCurrentClassMember(CLLSListWidget->highlightedItem()); CLSCAverageLabel->setText(QString("%1%").arg(current_db_class->average(¤t_db_sessions, ¤t_db_archivedsessions))); }
int PartsBinListView::setItemAux(ModelPart * modelPart, int position) { if (modelPart->modelPartShared() == NULL) return position; if (modelPart->itemType() == ModelPart::Unknown) { // don't want the empty root to appear in the view return position; } emit settingItem(); QString moduleID = modelPart->moduleID(); if(contains(moduleID)) { m_partHash[moduleID]->copy(modelPart); // copies into the cached modelPart, but I don't know why return position; } QListWidgetItem * lwi = new QListWidgetItem(modelPart->title()); if (modelPart->itemType() == ModelPart::Space) { lwi->setBackground(QBrush(SectionHeaderBackgroundColor)); lwi->setForeground(QBrush(SectionHeaderForegroundColor)); lwi->setData(Qt::UserRole, 0); lwi->setFlags(0); lwi->setText(" " + TranslatedCategoryNames.value(modelPart->instanceText(), modelPart->instanceText())); } else { ItemBase * itemBase = ItemBaseHash.value(moduleID); if (itemBase == NULL) { itemBase = PartFactory::createPart(modelPart, ViewLayer::ThroughHoleThroughTop_OneLayer, ViewLayer::IconView, ViewGeometry(), ItemBase::getNextID(), NULL, NULL, false); ItemBaseHash.insert(moduleID, itemBase); QString error; LayerAttributes layerAttributes; FSvgRenderer * renderer = itemBase->setUpImage(modelPart, ViewLayer::IconView, ViewLayer::Icon, itemBase->viewLayerSpec(), layerAttributes, error); if (renderer != NULL) { if (itemBase) { itemBase->setFilename(renderer->filename()); } itemBase->setSharedRendererEx(renderer); } } lwi->setData(Qt::UserRole, qVariantFromValue( itemBase ) ); QSize size(HtmlInfoView::STANDARD_ICON_IMG_WIDTH, HtmlInfoView::STANDARD_ICON_IMG_HEIGHT); QPixmap * pixmap = FSvgRenderer::getPixmap(itemBase->renderer(), size); lwi->setIcon(QIcon(*pixmap)); delete pixmap; lwi->setData(Qt::UserRole + 1, itemBase->renderer()->defaultSize()); m_partHash[moduleID] = modelPart; } if(position > -1 && position < count()) { insertItem(position, lwi); } else { addItem(lwi); position = this->count(); } return position; }
void CurveColorPick::on_colorChanged(QColor color) { QListWidgetItem *item = ui->listWidget->currentItem(); if( color != item->foreground().color()) { _any_modified = true; item->setForeground( color ); emit changeColor( item->text(), color ); } }
void ConfigDialog::updateSyntaxFont() { QListWidgetItem *item = shListWidget->currentItem(); QFont font; if(shBoldButton->isChecked()) font.setWeight(QFont::Bold); if(shItalicButton->isChecked()) font.setItalic(true); item->setFont(font); item->setForeground(shColorButton->currentColor()); }
int packagesPage::initPackagesLists() { for (int i =0; i < packages.size(); i++) { //packagesList.clear(); QListWidgetItem* repo = new QListWidgetItem(packages.at(i).first); QVector<QListWidgetItem*> listPackages; repo->setData(Qt::CheckStateRole, Qt::Unchecked); Qt::ItemFlags itemFlags; for (int p=0; p < packages.at(i).second.size(); p++) { //cout << packages.at(i).second.at(p).Name.toUtf8().constData() << endl; QListWidgetItem* packagesListItem = new QListWidgetItem(packages.at(i).second.at(p).Name); //package->setFlags((Qt::ItemFlag)((int)(~(packages.at(i).second.at(p).Critical))*Qt::ItemIsUserCheckable)| // Qt::ItemIsEnabled|); if(packages.at(i).second.at(p).Critical) { //itemFlags = 0; itemFlags = Qt::ItemIsEnabled; //DpackagesListItem->setFlags((Qt::ItemFlag)(~Qt::ItemIsUserCheckable|~Qt::ItemIsEditable)); if(packages.at(i).second.at(p).Remove) { //packagesListItem->setData(Qt::CheckStateRole, Qt::Unchecked); packagesListItem->setCheckState(Qt::Unchecked); packagesListItem->setBackgroundColor(QColor(Qt::darkRed)); } else { //packagesListItem->setData(Qt::CheckStateRole, Qt::Checked); packagesListItem->setCheckState(Qt::Checked); packagesListItem->setBackgroundColor(QColor(Qt::darkBlue)); } packagesListItem->setForeground(QBrush(QColor(Qt::white))); } else { itemFlags = Qt::ItemIsUserCheckable | Qt::ItemIsSelectable | Qt::ItemIsEnabled; //packagesListItem->setData(Qt::CheckStateRole, Qt::Unchecked); packagesListItem->setCheckState(Qt::Unchecked); } packagesListItem->setFlags(itemFlags); listPackages.push_back(packagesListItem); } packagesList.push_back(qMakePair(repo, listPackages)); } return 0; }
void EventView::updateView() { QStringList viewableText = currentEvent->getViewableText(0); clear(); for (int i = 0; i < viewableText.size(); ++i) { QListWidgetItem *item = new QListWidgetItem(viewableText[i]); item->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable); if (viewableText[i].contains("/*")) item->setForeground(QBrush(Qt::darkGreen)); addItem(item); } }
void QtLogger::update() { if( !mLogRecords.size() ) return; boost::mutex::scoped_lock lock( mLogRecordMutex ); QListWidgetItem* item = 0; for( LogRecords::const_iterator i = mLogRecords.begin();i != mLogRecords.end(); ++i ) { const LogMessage& entry = *i; // Send log message to log list widget. item = new QListWidgetItem( QString::fromStdString( entry.mMessage ), EditorGlobals::mMainWindow->mUI.logListWidget ); item->setData( Qt::UserRole, entry.mLogLevel ); // Log level item->setData( Qt::UserRole + 1, QString::fromStdString( entry.mChannel ) ); // Log channel item->setData( Qt::UserRole + 2, EditorGlobals::mMainWindow->isSeverityChecked( entry.mLogLevel ) ); // Shown because of severity? item->setData( Qt::UserRole + 3, EditorGlobals::mMainWindow->isSourceChecked( entry.mChannel ) ); // Shown because of source? EditorGlobals::mMainWindow->checkLogItem( EditorGlobals::mMainWindow->mUI.logListWidget->model()->index( EditorGlobals::mMainWindow->mUI.logListWidget->row( item ), 0 ) ); // Select color switch( entry.mLogLevel ) { case LOG_CRITICAL: item->setForeground( QBrush( Qt::darkRed ) ); break; case LOG_ERROR: item->setForeground( QBrush( Qt::red ) ); break; case LOG_WARNING: item->setForeground( QBrush( Qt::darkYellow ) ); break; case LOG_INFO: item->setForeground( QBrush( Qt::black ) ); break; case LOG_DEBUG: item->setForeground( QBrush( Qt::darkGray ) ); break; case LOG_ENTRYEXIT: item->setForeground( QBrush( Qt::lightGray ) ); break; } // Select icon switch( entry.mLogLevel ) { case LOG_CRITICAL: item->setIcon( QIcon( ":/Icons/Icons/status/dialog-error.png" ) ); break; case LOG_ERROR: item->setIcon( QIcon( ":/Icons/Icons/status/dialog-error.png" ) ); break; case LOG_WARNING: item->setIcon( QIcon( ":/Icons/Icons/status/dialog-warning.png" ) ); break; case LOG_INFO: item->setIcon( QIcon( ":/Icons/Icons/status/dialog-info.png" ) ); break; case LOG_DEBUG: item->setIcon( QIcon( ":/Icons/Icons/status/dialog-question.png" ) );break; case LOG_ENTRYEXIT: item->setIcon( QIcon( ":/Icons/Icons/status/dialog-question.png" ) ); break; } // Send errors to status bar. if( entry.mLogLevel >= LOG_ERROR ) { QPalette palette; palette.setColor( QPalette::WindowText, Qt::red ); EditorGlobals::mMainWindow->mUI.statusBar->setPalette( palette ); EditorGlobals::mMainWindow->mUI.statusBar->showMessage( QString::fromStdString( entry.mMessage ), 8000 ); } } // Scroll to last item if( item ) EditorGlobals::mMainWindow->mUI.logListWidget->scrollToItem( item, QAbstractItemView::PositionAtBottom ); mLogRecords.clear(); }
void TrackSelectionDialog::Init(const SongList& songs) { ui_->song_list->clear(); ui_->stack->setCurrentWidget(ui_->loading_page); data_.clear(); foreach (const Song& song, songs) { Data data; data.original_song_ = song; data_ << data; QListWidgetItem* item = new QListWidgetItem(ui_->song_list); item->setText(QFileInfo(song.url().toLocalFile()).fileName()); item->setForeground(palette().color(QPalette::Disabled, QPalette::Text)); }
void BuildingTilesetDock::setTilesetList() { ui->tilesets->clear(); int width = 64; QFontMetrics fm = ui->tilesets->fontMetrics(); foreach (Tileset *tileset, TileMetaInfoMgr::instance()->tilesets()) { QListWidgetItem *item = new QListWidgetItem(); item->setText(tileset->name()); if (tileset->isMissing()) item->setForeground(Qt::red); ui->tilesets->addItem(item); width = qMax(width, fm.width(tileset->name())); }
void SetupPluginsDialog::onCurrentPluginChanged(QTableWidgetItem *ACurrent, QTableWidgetItem *APrevious) { Q_UNUSED(APrevious); QTableWidgetItem *nameItem = ACurrent==NULL || ACurrent->column()==COL_NAME ? ACurrent : ui.twtPlugins->item(ACurrent->row(), COL_NAME); if (FItemElement.contains(nameItem)) { QDomElement pluginElem = FItemElement.value(nameItem); QString name = pluginElem.firstChildElement("name").text().isEmpty() ? pluginElem.tagName() : pluginElem.firstChildElement("name").text(); ui.lblName->setText(QString("<b>%1</b> %2").arg(Qt::escape(name)).arg(Qt::escape(pluginElem.firstChildElement("version").text()))); ui.lblDescription->setText(pluginElem.firstChildElement("desc").text()); ui.lblError->setText(pluginElem.firstChildElement("error").text()); ui.lblError->setVisible(!ui.lblError->text().isEmpty()); ui.lblLabelError->setVisible(ui.lblError->isVisible()); ui.ltwDepends->clear(); QDomElement dependsElem = pluginElem.firstChildElement("depends").firstChildElement("uuid"); while (!dependsElem.isNull()) { QDomElement dpluginElem = getPluginElement(dependsElem.text()); QListWidgetItem *dItem = new QListWidgetItem(!dpluginElem.isNull() ? dpluginElem.firstChildElement("name").text() : dependsElem.text()); QPalette::ColorGroup cg = FPluginManager->pluginInstance(dependsElem.text())!=NULL ? QPalette::Active : QPalette::Disabled; dItem->setForeground(ui.ltwDepends->palette().color(cg, QPalette::Text)); ui.ltwDepends->addItem(dItem); dependsElem = dependsElem.nextSiblingElement("uuid"); } ui.ltwDepend->clear(); QDomElement dpluginElem = FPluginsSetup.documentElement().firstChildElement(); while (!dpluginElem.isNull()) { QDomElement dependsElem = dpluginElem.firstChildElement("depends").firstChildElement("uuid"); while (!dependsElem.isNull()) { if (pluginElem.attribute("uuid") == dependsElem.text()) { ui.ltwDepend->addItem(dpluginElem.firstChildElement("name").text()); break; } dependsElem = dependsElem.firstChildElement("uuid"); } dpluginElem = dpluginElem.nextSiblingElement(); } const IPluginInfo *info = FPluginManager->pluginInfo(pluginElem.attribute("uuid")); if (info) ui.lblHomePage->setText(QString("<a href='%1'>%2</a>").arg(info->homePage.toString()).arg(Qt::escape(info->homePage.toString()))); } }
void TraceDock::updateState(int index) { QListWidgetItem * item = trace_->item(index); if(!item) return; item->setText(printChildren(sim_->topLevelSymbols(index), index)); // set font QFont fnt = item->font(); fnt.setItalic(sim_->isAccepting(index)); item->setFont(fnt); // and background colour QPalette def; if (!sim_->isValid(index)) { item->setForeground(error_); } else if (sim_->transitionCount(index) == 0) { item->setForeground(deadlock_); } else { item->setForeground(def.color(QPalette::Text)); } }
void CurveColorPick::on_pushButtonUndo_clicked() { for(int row = 0; row < ui->listWidget->count(); row++) { QListWidgetItem *item = ui->listWidget->item(row); const std::string name = item->text().toStdString(); const QColor& color = _mapped_colors.find(name)->second; item->setForeground( color ); emit changeColor( item->text(), color ); } QListWidgetItem *item = ui->listWidget->currentItem(); QColor current_color = item->foreground().color(); _color_wheel->setColor(current_color); }
void BaseWindow::load_plant_inventory() { const CatchChallenger::Player_private_and_public_informations &playerInformations=client->get_player_informations_ro(); #ifdef DEBUG_BASEWINDOWS qDebug() << "BaseWindow::load_plant_inventory()"; #endif if(!haveInventory || !datapackIsParsed) return; ui->listPlantList->clear(); plants_items_graphical.clear(); plants_items_to_graphical.clear(); auto i=playerInformations.items.begin(); while(i!=playerInformations.items.cend()) { if(DatapackClientLoader::datapackLoader.itemToPlants.find(i->first)!= DatapackClientLoader::datapackLoader.itemToPlants.cend()) { const uint8_t &plantId=DatapackClientLoader::datapackLoader.itemToPlants.at(i->first); QListWidgetItem *item; item=new QListWidgetItem(); plants_items_to_graphical[plantId]=item; plants_items_graphical[item]=plantId; if(DatapackClientLoader::datapackLoader.itemsExtra.find(i->first)!= DatapackClientLoader::datapackLoader.itemsExtra.cend()) { item->setIcon(DatapackClientLoader::datapackLoader.itemsExtra[i->first].image); item->setText(QString::fromStdString(DatapackClientLoader::datapackLoader.itemsExtra[i->first].name)+ "\n"+tr("Quantity: %1").arg(i->second)); } else { item->setIcon(DatapackClientLoader::datapackLoader.defaultInventoryImage()); item->setText(QStringLiteral("item id: %1").arg(i->first)+"\n"+tr("Quantity: %1").arg(i->second)); } if(!haveReputationRequirements(CatchChallenger::CommonDatapack::commonDatapack.plants.at(plantId).requirements.reputation)) { item->setText(item->text()+"\n"+tr("You don't have the requirements")); item->setFont(disableIntoListFont); item->setForeground(disableIntoListBrush); } ui->listPlantList->addItem(item); } ++i; } }
static QListWidgetItem* create_header_item(const char *pcTitle) { QListWidgetItem *pHeaderItem = new QListWidgetItem(pcTitle); pHeaderItem->setTextAlignment(Qt::AlignHCenter); QFont fontHeader = pHeaderItem->font(); fontHeader.setBold(1); pHeaderItem->setFont(fontHeader); QBrush brushHeader = pHeaderItem->foreground(); brushHeader.setColor(QColor(0xff, 0xff, 0xff)); pHeaderItem->setForeground(brushHeader); pHeaderItem->setData(Qt::UserRole, 1000); pHeaderItem->setBackgroundColor(QColor(0x65, 0x65, 0x65)); return pHeaderItem; }
// ****************************************************************************************** // Show the list of files to be generated // ****************************************************************************************** void ConfigurationFilesWidget::showGenFiles() { // Display this list in the GUI for (int i = 0; i < gen_files_.size(); ++i) { GenerateFile* file = &gen_files_[i]; // Create a formatted row QListWidgetItem *item = new QListWidgetItem( QString(file->rel_path_.c_str()), action_list_, 0 ); fs::path file_path = config_data_->appendPaths(config_data_->config_pkg_path_, file->rel_path_); // Checkbox if( file->generate_ ) { item->setCheckState(Qt::Checked); } else { item->setCheckState(Qt::Unchecked); item->setForeground( QBrush(QColor(255, 135, 0))); } // Don't allow folders to be disabled if( fs::is_directory(file_path) ) { item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); } // Link the gen_files_ index to this item item->setData(Qt::UserRole, QVariant(i)); // Add actions to list action_list_->addItem( item ); action_desc_.append( QString( file->description_.c_str() )); } // Select the first item in the list so that a description is visible action_list_->setCurrentRow( 0 ); }
void plotWindow::addPlot(const KNDataFile* data) { // Need to query data if (data) { // std::cout << "plotWindow::addPlot 1\n"; data->lockRead(); QFileInfo fi(QString::fromStdString(data->getFileName())); data->unlock(); if (fi.isSymLink()) fi = QFileInfo(fi.symLinkTarget()); if (dataFileInfo != fi) return; // exit if not the same file as before // std::cout << "plotWindow::addPlot 2\n"; data->lockRead(); // make sure that the data is consistent const_cast<KNDataFile*>(data)->initHeaders(); if (!data->isTorus()) { bool added = false; try { added = plotdata.addPlot(data, xvarMap.at(xvar->currentIndex()).value, yvarMap.at(yvar->currentIndex()).value, ptlabel->value(), dim->value()); } catch (KNException ex) { MainWindow::showException(this, ex); } if (added) { QListWidgetItem* item = new QListWidgetItem(QString("%1 : (%2, %3, L%4, D%5)") .arg(shortFileName).arg(xvarMap.at(static_cast<unsigned int>(xvar->currentIndex())).name) .arg(yvarMap.at(static_cast<unsigned int>(yvar->currentIndex())).name) .arg(ptlabel->value()).arg(dim->value()), plotSelect); item->setForeground(QBrush(plotdata.getColor(plotSelect->count()))); plotSelect->addItem(item); } } data->unlock(); } }
void ccConsole::refresh() { m_mutex.lock(); if (m_textDisplay && !m_queue.isEmpty()) { for (QVector<ConsoleItemType>::const_iterator it = m_queue.begin();it!=m_queue.end();++it) { QListWidgetItem* item = new QListWidgetItem(it->first); item->setForeground(QBrush(it->second)); m_textDisplay->addItem(item); } m_textDisplay->scrollToBottom(); } m_queue.clear(); m_mutex.unlock(); }
void MibEditor::ErrorHandler(char *path, int line, int severity, char *msg, char *tag) { QString message = NULL; QListWidgetItem *item; QBrush item_brush; (void)path; switch (severity) { case 0: case 1: case 2: case 3: message += "Error "; num_error++; item_brush.setColor(Qt::red); break; case 4: case 5: message += "Warning "; num_warning++; item_brush.setColor(Qt::darkYellow); break; case 6: case 7: case 8: case 9: message += "Info "; num_info++; item_brush.setColor(Qt::blue); break; } message += QString("(level %1), line %2: [%3] %4") .arg(severity).arg(line).arg(tag).arg(msg); item = new QListWidgetItem(message, s->MainUI()->MIBLog); item->setForeground(item_brush); s->MainUI()->MIBLog->addItem(item); }
void TrackSelectionDialog::Init(const SongList& songs) { ui_->song_list->clear(); ui_->stack->setCurrentWidget(ui_->loading_page); data_.clear(); for (const Song& song : songs) { Data data; data.original_song_ = song; data_ << data; QListWidgetItem* item = new QListWidgetItem(ui_->song_list); item->setText(QFileInfo(song.url().toLocalFile()).fileName()); item->setForeground(palette().color(QPalette::Disabled, QPalette::Text)); } const bool multiple = songs.count() > 1; ui_->song_list->setVisible(multiple); next_button_->setEnabled(multiple); previous_button_->setEnabled(multiple); ui_->song_list->setCurrentRow(0); }
void SongInfoSettingsPage::Load() { QSettings s; s.beginGroup(SongInfoTextView::kSettingsGroup); ui_->song_info_font_size->setValue( s.value("font_size", SongInfoTextView::kDefaultFontSize).toReal()); s.endGroup(); QList<const UltimateLyricsProvider*> providers = dialog()->song_info_view()->lyric_providers(); ui_->providers->clear(); for (const UltimateLyricsProvider* provider : providers) { QListWidgetItem* item = new QListWidgetItem(ui_->providers); item->setText(provider->name()); item->setCheckState(provider->is_enabled() ? Qt::Checked : Qt::Unchecked); item->setForeground( provider->is_enabled() ? palette().color(QPalette::Active, QPalette::Text) : palette().color(QPalette::Disabled, QPalette::Text)); } }
void UsersDialog::populateList(const QString &filter) { QRegExp nameFilter("*"+filter+"*"); nameFilter.setPatternSyntax(QRegExp::Wildcard); nameFilter.setCaseSensitivity(Qt::CaseInsensitive); ui->listWidget->clear(); if (userList) { for (UserInfo &user : *userList) { if (filter.isEmpty() || nameFilter.exactMatch(user.name)) { QListWidgetItem *item = new QListWidgetItem(user.name + "\n" + user.key_id, ui->listWidget); item->setCheckState(user.enabled ? Qt::Checked : Qt::Unchecked); item->setData(Qt::UserRole, QVariant::fromValue(&user)); if (user.have_secret) { item->setForeground(Qt::blue); } else if (user.validity == '-') { item->setBackground(Qt::red); } ui->listWidget->addItem(item); } } } }
static PyObject *meth_QListWidgetItem_setForeground(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; { const QBrush* a0; int a0State = 0; QListWidgetItem *sipCpp; if (sipParseArgs(&sipParseErr, sipArgs, "BJ1", &sipSelf, sipType_QListWidgetItem, &sipCpp, sipType_QBrush, &a0, &a0State)) { sipCpp->setForeground(*a0); sipReleaseType(const_cast<QBrush *>(a0),sipType_QBrush,a0State); Py_INCREF(Py_None); return Py_None; } } /* Raise an exception if the arguments couldn't be parsed. */ sipNoMethod(sipParseErr, sipName_QListWidgetItem, sipName_setForeground, doc_QListWidgetItem_setForeground); return NULL; }
void BaseWindow::on_listCraftingList_itemSelectionChanged() { const CatchChallenger::Player_private_and_public_informations &playerInformations=client->get_player_informations_ro(); ui->listCraftingMaterials->clear(); QList<QListWidgetItem *> displayedItems=ui->listCraftingList->selectedItems(); if(displayedItems.size()!=1) { ui->labelCraftingImage->setPixmap(DatapackClientLoader::datapackLoader.defaultInventoryImage()); ui->labelCraftingDetails->setText(tr("Select a recipe")); ui->craftingUse->setVisible(false); return; } QListWidgetItem *itemMaterials=displayedItems.first(); const CatchChallenger::CrafingRecipe &content=CatchChallenger::CommonDatapack::commonDatapack.crafingRecipes[crafting_recipes_items_graphical[itemMaterials]]; qDebug() << "on_listCraftingList_itemSelectionChanged() load the name"; //load the name QString name; if(DatapackClientLoader::datapackLoader.itemsExtra.find(content.doItemId)!= DatapackClientLoader::datapackLoader.itemsExtra.cend()) { name=QString::fromStdString(DatapackClientLoader::datapackLoader.itemsExtra[content.doItemId].name); ui->labelCraftingImage->setPixmap(DatapackClientLoader::datapackLoader.itemsExtra[content.doItemId].image); } else { name=tr("Unknow item (%1)").arg(content.doItemId); ui->labelCraftingImage->setPixmap(DatapackClientLoader::datapackLoader.defaultInventoryImage()); } ui->labelCraftingDetails->setText(tr("Name: <b>%1</b><br /><br />Success: <b>%2%</b><br /><br />Result: <b>%3</b>").arg(name).arg(content.success).arg(content.quantity)); //load the materials bool haveMaterials=true; unsigned int index=0; QString nameMaterials; QListWidgetItem *item; uint32_t quantity; while(index<content.materials.size()) { //load the material item item=new QListWidgetItem(); if(DatapackClientLoader::datapackLoader.itemsExtra.find(content.materials.at(index).item)!= DatapackClientLoader::datapackLoader.itemsExtra.cend()) { nameMaterials=QString::fromStdString(DatapackClientLoader::datapackLoader.itemsExtra[content.materials.at(index).item].name); item->setIcon(DatapackClientLoader::datapackLoader.itemsExtra[content.materials.at(index).item].image); } else { nameMaterials=tr("Unknow item (%1)").arg(content.materials.at(index).item); item->setIcon(DatapackClientLoader::datapackLoader.defaultInventoryImage()); } //load the quantity into the inventory quantity=0; if(playerInformations.items.find(content.materials.at(index).item)!=playerInformations.items.cend()) quantity=playerInformations.items.at(content.materials.at(index).item); //load the display item->setText(tr("Needed: %1 %2\nIn the inventory: %3 %4").arg(content.materials.at(index).quantity).arg(nameMaterials).arg(quantity).arg(nameMaterials)); if(quantity<content.materials.at(index).quantity) { item->setFont(disableIntoListFont); item->setForeground(disableIntoListBrush); } if(quantity<content.materials.at(index).quantity) haveMaterials=false; ui->listCraftingMaterials->addItem(item); ui->craftingUse->setVisible(haveMaterials); index++; } }