bool Tracker::searchFromItems(std::vector<item> * itemsToSearch, const int selectITEMS){ bool found = 0; for(unsigned i = 0; i < itemsToSearch->size(); i++){ if(searchLine->text().toStdString().compare((*itemsToSearch)[i].getName()) == 0){ QString nameToAdd = filingIn(QString::fromStdString((*itemsToSearch)[i].getName()), 17); QString cateToAdd = filingIn(QString::fromStdString((*itemsToSearch)[i].getLabel()), 14); QString amountToAdd = QString::number((*itemsToSearch)[i].getAmount()); QString _itemToAdd; if(selectITEMS == 0){ _itemToAdd = nameToAdd + cateToAdd + "-" + amountToAdd; } else{ _itemToAdd = nameToAdd + cateToAdd + "+" + amountToAdd; } QListWidgetItem * itemToAdd = new QListWidgetItem; itemToAdd->setText(_itemToAdd); itemToAdd->setFont(QFont("Monaco", 10, QFont::Bold)); //std::cout<<itemToAdd->text().toStdString().c_str()<<std::endl; detailList->addItem(itemToAdd); QString _dateToAdd; _dateToAdd = QString::number((*itemsToSearch)[i].getDate().month) + "/" + QString::number((*itemsToSearch)[i].getDate().day) + "/" +QString::number((*itemsToSearch)[i].getDate().year); QListWidgetItem * dateToAdd = new QListWidgetItem; dateToAdd->setText(_dateToAdd); dateToAdd->setFont(QFont("Monaco", 10, QFont::Bold)); //std::cout<<dateToAdd->text().toStdString().c_str()<<std::endl; detailList->addItem(dateToAdd); found = 1; } } return found; }
void TraceDock::setCurrentState(int index) { // nothing to do if(index == state_) return; // update previous QListWidgetItem * item = trace_->item(state_); if(item) { QFont fnt = item->font(); fnt.setWeight(QFont::Normal); item->setFont(fnt); } // update new current item = trace_->item(index); if(item) { QFont fnt = item->font(); fnt.setWeight(QFont::Bold); item->setFont(fnt); } state_ = index; trace_->setCurrentRow(index); trace_->scrollToItem(trace_->item(index)); }
/** * @brief Displays the list of available filters * @param text Current text in the filter line edit */ void FilterWidget::onFilterTextChanged(QString text) { if (text.length() < 3) { m_list->hide(); return; } int height = 0; m_list->clear(); foreach (Filter *filter, m_filters) { if (!filter->accepts(text)) continue; if ((filter->info() == MovieFilters::Title || filter->info() == ConcertFilters::Title || filter->info() == TvShowFilters::Title) && !m_activeFilters.contains(filter)) { filter->setText(tr("Title contains \"%1\"").arg(text)); filter->setShortText(text); } if ((filter->info() == MovieFilters::Path) && !m_activeFilters.contains(filter)) { filter->setText(tr("Filename contains \"%1\"").arg(text)); filter->setShortText(text); } QListWidgetItem *item = new QListWidgetItem(filter->text(), m_list); item->setData(Qt::UserRole, QVariant::fromValue(filter)); item->setBackgroundColor(QColor(255, 255, 255, 200)); m_list->addItem(item); height += m_list->sizeHintForRow(m_list->count()-1); } if (m_list->count() > 0) { QFont font; font.setPixelSize(2); QListWidgetItem *topItem = new QListWidgetItem(""); topItem->setFont(font); topItem->setBackgroundColor(QColor(255, 255, 255, 200)); m_list->insertItem(0, topItem); height += m_list->sizeHintForRow(0); QListWidgetItem *bottomItem = new QListWidgetItem(""); bottomItem->setBackgroundColor(QColor(255, 255, 255, 200)); bottomItem->setFont(font); m_list->addItem(bottomItem); height += m_list->sizeHintForRow(m_list->count()-1); m_list->setFixedHeight(qMin(300, height)); m_list->setFixedWidth(m_list->sizeHintForColumn(0)+5); m_list->move(ui->lineEdit->mapToGlobal(QPoint(ui->lineEdit->paddingLeft(), ui->lineEdit->height()))); m_list->show(); } else { m_list->hide(); } }
void BearerEx::showConfigurations() { listWidget->clear(); QListWidgetItem* listItem; QNetworkConfiguration defaultConfig = m_NetworkConfigurationManager.defaultConfiguration(); if (defaultConfig.type() == QNetworkConfiguration::UserChoice) { listItem = new QListWidgetItem(); QFont font = listItem->font(); font.setBold(true); font.setUnderline(true); listItem->setFont(font); listItem->setText(" UserChoice"); listItem->setData(Qt::UserRole, qVariantFromValue(defaultConfig)); listWidget->addItem(listItem); } QList<QNetworkConfiguration> configurations = m_NetworkConfigurationManager.allConfigurations(); for (int i=0; i<configurations.count(); i++) { listItem = new QListWidgetItem(); QString text; if (configurations[i].type() == QNetworkConfiguration::InternetAccessPoint) { text.append("(IAP,"); } else if (configurations[i].type() == QNetworkConfiguration::ServiceNetwork) { text.append("(SNAP,"); } if ((configurations[i].state() & QNetworkConfiguration::Active) == QNetworkConfiguration::Active) { text.append("Act) "); } else if ((configurations[i].state() & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { text.append("Disc) "); } else { text.append("Def) "); } text.append(configurations[i].name()); if (defaultConfig.isValid() && defaultConfig == configurations[i]) { QFont font = listItem->font(); font.setBold(true); font.setUnderline(true); listItem->setFont(font); } listItem->setText(text); listItem->setData(Qt::UserRole, qVariantFromValue(configurations[i])); listWidget->addItem(listItem); } }
void Tracker::updateTable(std::vector<item> * itemsToAdd, const int selectITEMS){ for(unsigned i = 0; i < itemsToAdd->size(); i++){ if((*itemsToAdd)[i].getDate().month == calendar->selectedDate().month() && (*itemsToAdd)[i].getDate().day == calendar->selectedDate().day() && (*itemsToAdd)[i].getDate().year == calendar->selectedDate().year()){ QString nameToAdd = filingIn(QString::fromStdString((*itemsToAdd)[i].getName()), 17); QString cateToAdd = filingIn(QString::fromStdString((*itemsToAdd)[i].getLabel()), 14); QString amountToAdd = QString::number((*itemsToAdd)[i].getAmount()); QString _itemToAdd; if(selectITEMS == 0){ _itemToAdd = nameToAdd + cateToAdd + "-" + amountToAdd; } else{ _itemToAdd = nameToAdd + cateToAdd + "+" + amountToAdd; } QListWidgetItem * itemToAdd = new QListWidgetItem; itemToAdd->setText(_itemToAdd); itemToAdd->setFont(QFont("Monaco", 10, QFont::Bold)); //std::cout<<itemToAdd->text().toStdString().c_str()<<std::endl; detailList->addItem(itemToAdd); } } }
bool AnnotationConfigurationHandler::startElement( const QString & /* namespaceURI */, const QString & /* localName */, const QString &qName, const QXmlAttributes &attributes ) { if ( !metAnnotationConfigurationTag && qName != "annotationConfiguration" ) { errorStr = QObject::tr( "The file is not an Annotation Configuration file." ); return false; } if ( qName == "annotationConfiguration" ) { metAnnotationConfigurationTag = true; } else if ( qName == "entity" ) { QListWidgetItem *item = new QListWidgetItem(listWidget); item->setFlags( item->flags() | Qt::ItemIsEditable ); if (m_isEditor) { item->setFlags( item->flags() | Qt::ItemIsUserCheckable); } item->setText( attributes.value( "name" ) ); QColor color( attributes.value( "color" ) ); QColor white( Qt::white ); QBrush brush( color ); colors->push_back( QColor( attributes.value( "color" ).toLower() ) ); (*colorNames2EntityTypes)[attributes.value( "color" ).toLower()] = attributes.value( "name" ); /// @todo setBackgroundColor is deprecated in QT 4.2, replace by /// setBackground below after upgrading. /// item->setBackgroundColor ( QColor( attributes.value( "color" ) ) ); if (attributes.value("recursive") == "true") { m_recursiveEntityTypes->push_back(attributes.value( "name" )); QFont font = item->font(); font.setItalic(true); font.setBold(true); item->setFont(font); if (m_isEditor) { item->setCheckState(Qt::Checked); } } else { if (m_isEditor) { item->setCheckState(Qt::Unchecked); } } item->setBackground ( brush ); item->setTextColor ( white ); } return true; }
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))); }
void Radio::addGroup(const QString &groupName) { QFont groupFont; groupFont.setBold(true); groupFont.setPointSize(groupFont.pointSize() + 2); QListWidgetItem *lWI = new QListWidgetItem("\n-- " + groupName + " --\n", lW); lWI->setData(Qt::TextAlignmentRole, Qt::AlignCenter); lWI->setIcon(QIcon(":/radio")); lWI->setFont(groupFont); }
/*! Constructs a VkOptionsDialog */ VkOptionsDialog::VkOptionsDialog( QWidget* parent ) : QDialog( parent ) { // ------------------------------------------------------------ // basic dialog setup setObjectName( QString::fromUtf8( "VkOptionsDialog" ) ); setWindowTitle( "[*]Valkyrie Options Dialog" ); // [*] == 'windowModified' placeholder setupLayout(); // ------------------------------------------------------------ // Add categories, and the pages // Note: both the pages and categories list use the same 'index', // which is how we keep them in sync. // TODO: if any complaints re speed, load the pages on demand. VkObjectList objList = (( MainWindow* )parent )->getValkyrie()->vkObjList(); for ( int i = 0; i < objList.size(); ++i ) { // Allow the VkObject to create the appropriate options page // Pass 'this' so constructor widgets auto-size correctly. VkObject* obj = objList.at( i ); VkOptionsPage* page = obj->createVkOptionsPage(); vk_assert( page != 0 ); page->init(); connect( page, SIGNAL( modified() ), this, SLOT( pageModified() ) ); // handle e.g. user pressing return in an ledit connect( page, SIGNAL( apply() ), this, SLOT( apply() ) ); // Set list item entry QListWidgetItem* item = new QListWidgetItem( contentsListWidget ); QString itemName = obj->objectName(); itemName[0] = itemName[0].toUpper(); item->setText( itemName ); QFont font = item->font(); font.setBold( true ); font.setPointSize( font.pointSize() * 1.2 ); item->setFont( font ); // insert into stack (takes ownership) optionPages->addWidget( page ); } contentsListWidget->setCurrentRow( 0 ); contentsListWidget->setFocus(); optionPages->setCurrentIndex( 0 ); // Give a max to our contentsList, based on hints from the list-items. // TODO: surely this can be done automatically? // - QSizePolicy::* don't seem to do the job :-( contentsListWidget->setMaximumWidth( 40 + contentsListWidget->sizeHintForColumn( 0 ) ); ContextHelp::addHelp( this, urlValkyrie::optsDlg ); }
void UIPlaylist::setBold(unsigned int row, bool b) { QListWidgetItem* item = widgetPlaylist->item(row); if (item) { QFont tmp; tmp.setBold(b); item->setFont(tmp); } }
//----------------------------------------------------------------------------------------------------------------------------- void Console::addItem(QString texte, QColor couleur, bool gras) { QListWidgetItem *item = new QListWidgetItem(texte); QFont grasFont; grasFont.setBold(gras); item->setFont(grasFont); item->setTextColor(couleur); liste->addItem(item); emit newItem(liste->item(liste->count()-1)); }
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()); }
GuiDelimiter::GuiDelimiter(GuiView & lv) : GuiDialog(lv, "mathdelimiter", qt_("Math Delimiter")) { setupUi(this); connect(closePB, SIGNAL(clicked()), this, SLOT(accept())); setFocusProxy(leftLW); leftLW->setViewMode(QListView::IconMode); rightLW->setViewMode(QListView::IconMode); leftLW->setDragDropMode(QAbstractItemView::NoDragDrop); rightLW->setDragDropMode(QAbstractItemView::NoDragDrop); initMathSymbols(); typedef map<char_type, QListWidgetItem *> ListItems; ListItems list_items; // The last element is the empty one. int const end = nr_latex_delimiters - 1; for (int i = 0; i < end; ++i) { string const delim = latex_delimiters[i]; MathSymbol const & ms = mathSymbol(delim); QString symbol(ms.fontcode? QChar(ms.fontcode) : toqstr(docstring(1, ms.unicode))); QListWidgetItem * lwi = new QListWidgetItem(symbol); lwi->setToolTip(toqstr(delim)); FontInfo lyxfont; lyxfont.setFamily(ms.fontfamily); lwi->setFont(frontend::getFont(lyxfont)); list_items[ms.unicode] = lwi; leftLW->addItem(lwi); } for (int i = 0; i != leftLW->count(); ++i) { MathSymbol const & ms = mathSymbol( fromqstr(leftLW->item(i)->toolTip())); rightLW->addItem(list_items[doMatch(ms.unicode)]->clone()); } // The last element is the empty one. leftLW->addItem(qt_("(None)")); rightLW->addItem(qt_("(None)")); sizeCO->addItem(qt_("Variable")); for (int i = 0; *biggui[i]; ++i) sizeCO->addItem(qt_(biggui[i])); on_leftLW_currentRowChanged(0); bc().setPolicy(ButtonPolicy::IgnorantPolicy); }
void BearerEx::onlineStateChanged(bool isOnline) { QListWidgetItem* listItem = new QListWidgetItem(); QFont font = listItem->font(); font.setBold(true); listItem->setFont(font); if (isOnline) { listItem->setText(QString("> Online")); } else { listItem->setText(QString("< Offline")); } eventListWidget->addItem(listItem); }
QListWidgetItem *BlackBerryDeviceConfigurationWizardSetupPage::createDeviceListItem( const QString &displayName, ItemKind itemKind) const { QListWidgetItem *item = new QListWidgetItem(displayName); if (itemKind == PleaseWait || itemKind == Note) { item->setFlags(item->flags() & ~Qt::ItemIsSelectable); QFont font = item->font(); font.setItalic(true); item->setFont(font); } item->setData(ItemKindRole, QVariant::fromValue(itemKind)); return item; }
void DatabaseListWidget::refreshList(const QStringList &databases, const QString& current) { m_view->clear(); for(const QString &db : databases) { QListWidgetItem *item = new QListWidgetItem(db, m_view); if(db == current) { QFont font = item->font(); font.setBold(true); item->setFont(font); } m_view->addItem(item); } }
void QtHighlightEditor::onNewButtonClicked() { int row = getSelectedRow() + 1; populateList(); HighlightRule newRule; newRule.setMatchMUC(true); highlightManager_->insertRule(row, newRule); QListWidgetItem *item = new QListWidgetItem(); item->setText(P2QSTRING(formatShortDescription(newRule))); QFont font; font.setItalic(true); item->setFont(font); ui_.listWidget->insertItem(row, item); selectRow(row); }
void ListingClients::fillListingClients() { ui->listWidget->clear(); DbConnection connection("listing_clients"); QSqlQuery query; query.exec("SELECT NAME, ID FROM clients"); while(query.next()) { QListWidgetItem* qwi = new QListWidgetItem(QIcon(":profile.png"), query.value(0).toString()); QVariant var(query.value(1).toInt()); qwi->setData(Qt::UserRole, var); QFont fnt("Times New Roman", 14); qwi->setFont(fnt); ui->listWidget->addItem(qwi); } }
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 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; }
/** * \brief Set the guider * * This triggers the dialog to retrieve the list of tracks for this * particular guider. */ void trackselectiondialog::setGuider( snowstar::GuiderDescriptor guiderdescriptor, snowstar::GuiderFactoryPrx guiderfactory) { debug(LOG_DEBUG, DEBUG_LOG, 0, "set the track selection %s", guiderdescriptor.instrumentname.c_str()); _guiderdescriptor = guiderdescriptor; _guiderfactory = guiderfactory; // update the title std::string title = astro::stringprintf("Select Track %s", _guiderdescriptor.instrumentname.c_str()); setWindowTitle(QString(title.c_str())); // empty the track list and also the contents of the tracklistWidget _tracks.clear(); ui->tracklistWidget->blockSignals(true); while (ui->tracklistWidget->count() > 0) { QListWidgetItem *lwi = ui->tracklistWidget->item(0); ui->tracklistWidget->removeItemWidget(lwi); } // Font QFont font("Fixed"); font.setStyleHint(QFont::Monospace); // read all tracks for that guider snowstar::idlist trackids = _guiderfactory->getTracks(_guiderdescriptor); snowstar::idlist::const_iterator i; for (i = trackids.begin(); i != trackids.end(); i++) { snowstar::TrackingSummary track = _guiderfactory->getTrackingSummary(*i); _tracks.push_back(track); std::string label = formatlabel(track); QString ls(label.c_str()); QListWidgetItem *item = new QListWidgetItem(ls); item->setFont(font); ui->tracklistWidget->addItem(item); } ui->tracklistWidget->blockSignals(false); debug(LOG_DEBUG, DEBUG_LOG, 0, "track selection initialized"); }
void TikzCommandInserter::addListWidgetItems(QListWidget *listWidget, const TikzCommandList &commandList, bool addChildren) { QFont titleFont = qApp->font(); titleFont.setBold(true); // QColor titleBg(QApplication::style()->standardPalette().color(QPalette::Normal, QPalette::Highlight)); // titleBg = titleBg.lighter(120); QColor titleBg(QApplication::style()->standardPalette().color(QPalette::Normal, QPalette::Window)); titleBg = titleBg.darker(200); QColor titleFg(QApplication::style()->standardPalette().color(QPalette::Normal, QPalette::HighlightedText)); QColor separatorBg(QApplication::style()->standardPalette().color(QPalette::Normal, QPalette::AlternateBase)); if (separatorBg == QApplication::style()->standardPalette().color(QPalette::Normal, QPalette::Base)) separatorBg = separatorBg.darker(110); for (int i = 0; i < commandList.commands.size(); ++i) { if (commandList.commands.at(i).type == -1) // if we have an empty command corresponding to a submenu, then don't add the command, the submenus will be added later continue; QListWidgetItem *item = new QListWidgetItem(listWidget); QString itemText = commandList.commands.at(i).name; item->setText(itemText.remove('&')); if (itemText.isEmpty()) item->setBackgroundColor(separatorBg); else item->setData(Qt::UserRole, commandList.commands.at(i).number); // link to the corresponding item in m_tikzCommandsList } if (!addChildren) return; for (int i = 0; i < commandList.children.size(); ++i) { QListWidgetItem *item = new QListWidgetItem(listWidget); QString itemText = commandList.children.at(i).title; item->setText(itemText.remove('&')); item->setBackgroundColor(titleBg); item->setTextColor(titleFg); item->setFont(titleFont); addListWidgetItems(listWidget, commandList.children.at(i)); } }
void ListringAuthors::fillListingAuthors() { this->setWindowTitle("Авторы"); ui->createAuthor->setToolTip("Добавить автора"); ui->deleteAuthor->setToolTip("Удалить автора"); ui->searchLine->setToolTip("Введите Ф.И.О автора для поиска"); ui->label_2->setText("Список авторов:"); DbConnection* connection = new DbConnection(); QSqlQuery query; query.exec("SELECT NAME, ID FROM authors"); while(query.next()) { QListWidgetItem* qwi = new QListWidgetItem(QIcon(":author.png"), query.value(0).toString()); QVariant var(query.value(1).toInt()); qwi->setData(Qt::UserRole, var); QFont fnt("Times New Roman", 14); qwi->setFont(fnt); ui->listWidget->addItem(qwi); } }
void Application::chooseSourceOH() { vector<UPnPClient::OHProduct::Source> srcs; if (!m_ohpro->getSources(srcs)) { return; } qDebug() << "Application::chooseSource: got " << srcs.size() << " sources"; int cur = -1; m_ohpro->sourceIndex(&cur); vector<int> rowtoidx; SourceChooseDLG dlg(m_player); for (unsigned int i = 0; i < srcs.size(); i++) { if (!srcs[i].visible) continue; QString stype = u8s2qs(srcs[i].type + "\t(" + srcs[i].name + ")"); if (int(i) == cur) { QListWidgetItem *item = new QListWidgetItem(stype); QFont font = dlg.rndsLW->font(); font.setBold(true); item->setFont(font); dlg.rndsLW->addItem(item); } else { dlg.rndsLW->addItem(stype); } rowtoidx.push_back(i); } if (!dlg.exec()) { return; } int row = dlg.rndsLW->currentRow(); if (row < 0 || row >= int(rowtoidx.size())) { qDebug() << "Internal error: bad row after source choose dlg"; return; } int idx = rowtoidx[row]; if (idx != cur) { m_ohpro->setSourceIndex(idx); } }
static PyObject *meth_QListWidgetItem_setFont(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; { const QFont* a0; QListWidgetItem *sipCpp; if (sipParseArgs(&sipParseErr, sipArgs, "BJ9", &sipSelf, sipType_QListWidgetItem, &sipCpp, sipType_QFont, &a0)) { sipCpp->setFont(*a0); Py_INCREF(Py_None); return Py_None; } } /* Raise an exception if the arguments couldn't be parsed. */ sipNoMethod(sipParseErr, sipName_QListWidgetItem, sipName_setFont, doc_QListWidgetItem_setFont); return NULL; }
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)); } }
//XML //Parse XML into tasklist form int TaskList_Main::parseXML(QDomDocument &domTree){ QDomElement set = domTree.namedItem("listset").toElement(); QMessageBox msgBox; //If tree doesn't exist, stop if(set.isNull()){ msgBox.setText("No <listset> element at top level"); msgBox.setWindowTitle("Erorr parsing XML"); msgBox.exec(); return -1; } //Iterate through all "list" items QDomElement n = set.firstChildElement("list"); for( ; !n.isNull(); n = n.nextSiblingElement("list")){ emit createList(n.namedItem("list_title").toElement().text()); delListAction->setEnabled(true); printAction->setEnabled(true); printAllAction->setEnabled(true); //Iterate through all "task" items part of "list" QDomElement o = n.firstChildElement("task"); for( ; !o.isNull(); o = o.nextSiblingElement("task")){ my_listwidget *currList = notePane->listMap[notePane->currList]; QListWidgetItem *currItem; QString tempStr; //If task is 'main' (not subtext/subnote) if(o.attribute("task_type") == "main"){ //Change task name notePane->addItemAction(o.namedItem("task_title").toElement().text(), false); currItem = currList->currentItem(); //Change task check state tempStr = o.namedItem("task_check").toElement().text(); if(tempStr == "unchecked") currItem->setCheckState(Qt::Unchecked); else if (tempStr == "checked") currItem->setCheckState(Qt::Checked); else if (tempStr == "part_check") currItem->setCheckState(Qt::PartiallyChecked); else{ msgBox.setText("Unknown check state"); msgBox.setWindowTitle("Erorr parsing XML"); msgBox.exec(); return -1; } //Change task subnote currItem->setData(32, QVariant( o.namedItem("task_note").toElement().text())); //Change if task subnote is displayed tempStr = o.namedItem("task_display").toElement().text(); if(tempStr == "false"){ currItem->setData(33, QVariant(false)); currItem->setData(35, QVariant(false)); } else if(tempStr == "true"){ currItem->setData(33, QVariant(true)); currItem->setData(35, QVariant(true)); } else{ msgBox.setText("Unknown bool type - display"); msgBox.setWindowTitle("Erorr parsing XML"); msgBox.exec(); return -1; } //Change the task due date tempStr = o.namedItem("task_date").toElement().text(); qDebug((const char *)tempStr.toAscii().data()); QDate tempDate; int year = tempStr.left(4).toInt(); int month = tempStr.mid(5, 2).toInt(); int day = tempStr.right(2).toInt(); tempDate.setDate(year, month, day); if(!tempDate.isValid()){ msgBox.setText("Unknown date type"); msgBox.setWindowTitle("Erorr parsing XML"); msgBox.exec(); return -1; } currItem->setData(34, QVariant(tempDate)); //Change the task font tempStr = o.namedItem("task_font").toElement().text(); QFont tempFont; if(!tempFont.fromString(tempStr)){ msgBox.setText("Unknown font"); msgBox.setWindowTitle("Erorr parsing XML"); msgBox.exec(); return -1; } currItem->setFont(tempFont); } //Else if it is a subtext/subnote for a 'main' else if (o.attribute("task_type") == "sub"){ //Change note's text notePane->addItemAction(o.namedItem("task_title").toElement().text(), true); currItem = currList->currentItem(); currItem->setFlags(0); //Change note's font tempStr = o.namedItem("task_font").toElement().text(); QFont tempFont; if(!tempFont.fromString(tempStr)){ msgBox.setText("Unknown font"); msgBox.setWindowTitle("Erorr parsing XML"); msgBox.exec(); return -1; } currItem->setFont(tempFont); } //Else, exit gracefully else{ msgBox.setText("Unknown list type"); msgBox.setWindowTitle("Erorr parsing XML"); msgBox.exec(); return -1; } //Synchronize the option pane optionPane->itemSelectDataIn(*currItem); } } return 0; }
void Home::addContact(UserInfo *added) { QListWidgetItem *item; QFont font; QPushButton *but; QString name; QPixmap *pixmap = NULL; QPalette palette; t_contact *ptr = new t_contact; std::string tmp; int state; state = added->get_status(); if (state < 1 && state > 4) state = 4; item = new QListWidgetItem(); tmp = added->get_name() + " " + added->get_surname(); name = tmp.c_str(); item->setText(name); item->setTextAlignment(21); item->setBackgroundColor(QColor(255, 255, 255)); font.setPointSize(12); font.setFamily("calibri"); item->setFont(font); font.setPointSize(8); ui->_listContact->addItem(item); but = new QPushButton(added->get_nickname().c_str()); but->setFlat(true); switch (state) { case 2: pixmap = new QPixmap("./Images/BabelHD_0001s_0005s_0002_status.png"); break; case 3: pixmap = new QPixmap("./Images/BabelHD_0001s_0003s_0000_status.png"); break; case 4: pixmap = new QPixmap("./Images/BabelHD_0001s_0000s_0000_status.png"); break; case 1: pixmap = new QPixmap("./Images/BabelHD_0001s_0002s_0000_status.png"); break; default: break; } if (pixmap != NULL) palette.setBrush(but->backgroundRole(), QBrush(*pixmap)); but->setFlat(true); but->setAutoFillBackground(true); but->setPalette(palette); but->setFont(font); but->setMinimumSize(250, 42); but->setMaximumSize(250, 42); std::stringstream ss; ss << added->get_id(); ss >> tmp; but->setObjectName(tmp.c_str()); but->setStyleSheet("text-align: middle"); connect(but, SIGNAL(clicked()), this, SLOT(contactClick())); QHBoxLayout *layout = new QHBoxLayout(); layout->addWidget(but); layout->alignment(); ptr->but = but; ptr->item = item; _bcontact[added->get_id()] = ptr; QWidget *widget = new QWidget(); widget->setLayout(layout); item->setSizeHint(widget->sizeHint()); ui->_listContact->setItemWidget(item, widget); }
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++; } }