void FontPanel::updateFamily(const QString &family) { // Update styles and trigger update of point sizes. // Try to maintain selection or select normal const QString oldStyleString = styleString(); const QStringList styles = m_fontDatabase.styles(family); const bool hasStyles = !styles.empty(); m_styleComboBox->setCurrentIndex(-1); m_styleComboBox->clear(); m_styleComboBox->setEnabled(hasStyles); int normalIndex = -1; const QString normalStyle = QLatin1String("Normal"); if (hasStyles) { foreach (const QString &style, styles) { // try to maintain selection or select 'normal' preferably const int newIndex = m_styleComboBox->count(); m_styleComboBox->addItem(style); if (oldStyleString == style) { m_styleComboBox->setCurrentIndex(newIndex); } else { if (oldStyleString == normalStyle) normalIndex = newIndex; } } if (m_styleComboBox->currentIndex() == -1 && normalIndex != -1) m_styleComboBox->setCurrentIndex(normalIndex); } updatePointSizes(family, styleString()); }
QwtGraphFrame::QwtGraphFrame(QWidget *parent) : QwtPlot(parent) { QFile stylesheet("/home/pi/qt/SmartKegerator/qwtStyle.css"); stylesheet.open(QFile::ReadOnly); QString styleString(stylesheet.readAll()); this->setStyleSheet(styleString); curve = new QwtPlotCurve(); //data = new QwtPointArrayData(8igv `); curve->setSamples(data); curve->attach(this); }
QFont FontPanel::selectedFont() const { QFont rc = m_familyComboBox->currentFont(); const QString family = rc.family(); rc.setPointSize(pointSize()); const QString styleDescription = styleString(); if (styleDescription.contains(QLatin1String("Italic"))) rc.setStyle(QFont::StyleItalic); else if (styleDescription.contains(QLatin1String("Oblique"))) rc.setStyle(QFont::StyleOblique); else rc.setStyle(QFont::StyleNormal); rc.setBold(m_fontDatabase.bold(family, styleDescription)); // Weight < 0 asserts... const int weight = m_fontDatabase.weight(family, styleDescription); if (weight >= 0) rc.setWeight(weight); return rc; }
std::string KMLNetOutput::createStyleForLink(int linkIndex, FPType lineWidth){ std::stringstream ss; ss << "\t\t<Style id=\"style" << linkIndex << "\">\n"; std::string styleString(ss.str()); styleString.append("\t\t\t<IconStyle>\n"); styleString.append("\t\t\t\t<Icon></Icon>\n"); styleString.append("\t\t\t</IconStyle>\n"); styleString.append("\t\t\t<LabelStyle>\n"); styleString.append("\t\t\t\t<scale>1.1</scale> \n"); styleString.append("\t\t\t</LabelStyle> \n"); styleString.append("\t\t\t<LineStyle> \n"); styleString.append("\t\t\t\t<color>" + createColorFromLineWidth(lineWidth) + "</color> \n"); styleString.append("\t\t\t\t<width>" + createLineWidth(lineWidth) + "</width> \n"); styleString.append("\t\t\t</LineStyle> \n"); styleString.append("\t\t</Style> \n"); return styleString; };
JSObject* IntlNumberFormat::resolvedOptions(ExecState& state) { VM& vm = state.vm(); auto scope = DECLARE_THROW_SCOPE(vm); // 11.3.5 Intl.NumberFormat.prototype.resolvedOptions() (ECMA-402 2.0) // The function returns a new object whose properties and attributes are set as if // constructed by an object literal assigning to each of the following properties the // value of the corresponding internal slot of this NumberFormat object (see 11.4): // locale, numberingSystem, style, currency, currencyDisplay, minimumIntegerDigits, // minimumFractionDigits, maximumFractionDigits, minimumSignificantDigits, // maximumSignificantDigits, and useGrouping. Properties whose corresponding internal // slots are not present are not assigned. if (!m_initializedNumberFormat) { initializeNumberFormat(state, jsUndefined(), jsUndefined()); scope.assertNoException(); } JSObject* options = constructEmptyObject(&state); options->putDirect(vm, vm.propertyNames->locale, jsString(&state, m_locale)); options->putDirect(vm, Identifier::fromString(&vm, "numberingSystem"), jsString(&state, m_numberingSystem)); options->putDirect(vm, Identifier::fromString(&vm, "style"), jsNontrivialString(&state, styleString(m_style))); if (m_style == Style::Currency) { options->putDirect(vm, Identifier::fromString(&vm, "currency"), jsNontrivialString(&state, m_currency)); options->putDirect(vm, Identifier::fromString(&vm, "currencyDisplay"), jsNontrivialString(&state, currencyDisplayString(m_currencyDisplay))); } options->putDirect(vm, Identifier::fromString(&vm, "minimumIntegerDigits"), jsNumber(m_minimumIntegerDigits)); options->putDirect(vm, Identifier::fromString(&vm, "minimumFractionDigits"), jsNumber(m_minimumFractionDigits)); options->putDirect(vm, Identifier::fromString(&vm, "maximumFractionDigits"), jsNumber(m_maximumFractionDigits)); if (m_minimumSignificantDigits) { ASSERT(m_maximumSignificantDigits); options->putDirect(vm, Identifier::fromString(&vm, "minimumSignificantDigits"), jsNumber(m_minimumSignificantDigits)); options->putDirect(vm, Identifier::fromString(&vm, "maximumSignificantDigits"), jsNumber(m_maximumSignificantDigits)); } options->putDirect(vm, Identifier::fromString(&vm, "useGrouping"), jsBoolean(m_useGrouping)); return options; }
void FontPanel::slotStyleChanged(int) { updatePointSizes(family(), styleString()); delayedPreviewFontUpdate(); }