Exemplo n.º 1
0
QString QFontProto::key() const
{
  QFont *item = qscriptvalue_cast<QFont*>(thisObject());
  if (item)
    return item->key();
  return QString();
}
Exemplo n.º 2
0
void Dialog::setFont()
{
    bool ok;
    QFont font = QFontDialog::getFont(&ok, QFont(fontLabel->text()), this);
    if (ok) {
        fontLabel->setText(font.key());
        fontLabel->setFont(font);
    }
}
Exemplo n.º 3
0
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);
    }
}
Exemplo n.º 4
0
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;
}
Exemplo n.º 5
0
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("");
}
Exemplo n.º 6
0
    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 );
    }
Exemplo n.º 7
0
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);
}