QString QFontProto::key() const { QFont *item = qscriptvalue_cast<QFont*>(thisObject()); if (item) return item->key(); return QString(); }
void Dialog::setFont() { bool ok; QFont font = QFontDialog::getFont(&ok, QFont(fontLabel->text()), this); if (ok) { fontLabel->setText(font.key()); fontLabel->setFont(font); } }
void Dialog::setFont() { const QFontDialog::FontDialogOptions options = QFlag(fontDialogOptionsWidget->value()); bool ok; QFont font = QFontDialog::getFont(&ok, QFont(fontLabel->text()), this, "Select Font", options); if (ok) { fontLabel->setText(font.key()); fontLabel->setFont(font); } }
QString QTextFormat::getKey( const QFont &fn, const QColor &col, bool misspelled, VerticalAlignment a ) { QString k = fn.key(); k += '/'; k += QString::number( (uint)col.rgb() ); k += '/'; k += QString::number( (int)misspelled ); k += '/'; k += QString::number( (int)a ); return k; }
void SettingsDialog::onFontButton() { if (ui->fontPushButton->text().isEmpty()) { bool ok; QFont font = QFontDialog::getFont(&ok, this); if (ok) ui->fontPushButton->setText(font.key().section(',', 0, 0)); } else ui->fontPushButton->setText(""); }
int effectiveAscent( const QFont &font ) const { const QString fontKey = font.key(); QMap<QString, int>::const_iterator it = d_ascentCache.find( fontKey ); if ( it == d_ascentCache.end() ) { int ascent = findAscent( font ); it = d_ascentCache.insert( fontKey, ascent ); } return ( *it ); }
void GetAppearance(QApplication *a, AppearanceAttributes *aa) { const char *mName = "GetAppearance: "; // get system default style QStyle *style = a->style(); QString style_class(style->metaObject()->className()); std::string styleName = "windows"; if(style_class == "QWindowsStyle") styleName = "windows"; else if(style_class == "QWindowsVistaStyle") styleName = "windowsvista"; else if(style_class == "QWindowsXPStyle") styleName = "windowsxp"; else if(style_class == "QMotifStyle") styleName = "motif"; else if(style_class == "QCleanlooksStyle") styleName = "cleanlooks"; else if(style_class == "QPlastiqueStyle") styleName = "plastique"; else if(style_class == "QCDEStyle") styleName = "cde"; else if(style_class == "QMacStyle") styleName = "macintosh"; debug1 << mName << "Default System Style is: " << styleName << endl; aa->SetDefaultStyle(styleName); // get system default font QFont font = a->font(); std::string font_name = font.key().toStdString(); debug1 << mName << "Default system font is:" << font_name << endl; aa->SetDefaultFontName(font_name); //set aa colors from defaults QColor bg = a->palette().window().color(); QColor fg = a->palette().windowText().color(); char tmp[20]; SNPRINTF(tmp, 20, "#%02x%02x%02x", bg.red(), bg.green(), bg.blue()); debug1 << mName << "Default background color is:" << tmp << endl; aa->SetDefaultBackground(tmp); SNPRINTF(tmp, 20, "#%02x%02x%02x", fg.red(), fg.green(), fg.blue()); debug1 << mName << "Default foreground color is:" << tmp << endl; aa->SetDefaultForeground(tmp); debug1 << mName << "Default orientation:" << 0 << endl; aa->SetDefaultOrientation(0); }