Esempio n. 1
0
bool QFontProto::overline() const
{
  QFont *item = qscriptvalue_cast<QFont*>(thisObject());
  if (item)
    return item->overline();
  return false;
}
Esempio n. 2
0
TextSettingsDialog::TextSettingsDialog(QWidget *parent, const OptionsMap& settings)
: BaseSettingsDialog(parent) {

    setupUi(this);
    new HelpButton(this, buttonBox, "17467707");

    curColor = qvariant_cast<QColor>(settings[LABEL_COLOR]);

#if (QT_VERSION < 0x050000) //Qt 5
    QStyle *buttonStyle = new QPlastiqueStyle;
#else
    QStyle *buttonStyle = new QProxyStyle(QStyleFactory::create("fusion"));
#endif
    buttonStyle->setParent(colorButton);
    colorButton->setStyle(buttonStyle);

    updateColorButton();
    QFont curFont = qvariant_cast<QFont>(settings[LABEL_FONT]);
    fontComboBox->setCurrentFont(curFont);
    sizeSpinBox->setValue(curFont.pointSize());

    boldToolButton->setChecked(curFont.bold());
    italicToolButton->setChecked(curFont.italic());
    underlineToolButton->setChecked(curFont.underline());
    overlineToolButton->setChecked(curFont.overline());

    overlineToolButton->setVisible(false);

    connect(colorButton, SIGNAL(clicked()), SLOT(sl_colorButton()));
}
void tst_QFont::resolve()
{
    QFont font;
    font.setPointSize(font.pointSize() * 2);
    font.setItalic(false);
    font.setWeight(QFont::Normal);
    font.setUnderline(false);
    font.setStrikeOut(false);
    font.setOverline(false);
    font.setStretch(QFont::Unstretched);

    QFont font1;
    font1.setWeight(QFont::Bold);
    QFont font2 = font1.resolve(font);

    QVERIFY(font2.weight() == font1.weight());

    QVERIFY(font2.pointSize() == font.pointSize());
    QVERIFY(font2.italic() == font.italic());
    QVERIFY(font2.underline() == font.underline());
    QVERIFY(font2.overline() == font.overline());
    QVERIFY(font2.strikeOut() == font.strikeOut());
    QVERIFY(font2.stretch() == font.stretch());

    QFont font3;
    font3.setStretch(QFont::UltraCondensed);
    QFont font4 = font3.resolve(font1).resolve(font);

    QVERIFY(font4.stretch() == font3.stretch());

    QVERIFY(font4.weight() == font.weight());
    QVERIFY(font4.pointSize() == font.pointSize());
    QVERIFY(font4.italic() == font.italic());
    QVERIFY(font4.underline() == font.underline());
    QVERIFY(font4.overline() == font.overline());
    QVERIFY(font4.strikeOut() == font.strikeOut());


    QFont f1,f2,f3;
    f2.setPointSize(45);
    f3.setPointSize(55);

    QFont f4 = f1.resolve(f2);
    QCOMPARE(f4.pointSize(), 45);
    f4 = f4.resolve(f3);
    QCOMPARE(f4.pointSize(), 55);
}
Esempio n. 4
0
void QSGTextNode::addTextLayout(const QPointF &position, QTextLayout *textLayout, const QColor &color,
                                QSGText::TextStyle style, const QColor &styleColor)
{
    QList<QGlyphRun> glyphsList(textLayout->glyphRuns());

    QSGGlyphNode *prevNode = 0;

    QFont font = textLayout->font();
    qreal underlinePosition, ascent, lineThickness;
    int decorations = NoDecoration;
    decorations |= (font.underline() ? Underline : 0);
    decorations |= (font.overline()  ? Overline  : 0);
    decorations |= (font.strikeOut() ? StrikeOut : 0);

    underlinePosition = ascent = lineThickness = 0;
    for (int i=0; i<glyphsList.size(); ++i) {
        QGlyphRun glyphs = glyphsList.at(i);
        QRawFont rawfont = glyphs.rawFont();
        prevNode = addGlyphs(position + QPointF(0, rawfont.ascent()), glyphs, color, style, styleColor);

        if (decorations) {
            qreal rawAscent = rawfont.ascent();
            if (decorations & Underline) {
                ascent = qMax(ascent, rawAscent);
                qreal pos = rawfont.underlinePosition();
                if (pos > underlinePosition) {
                    underlinePosition = pos;
                    // take line thickness from the rawfont with maximum underline
                    // position in this case
                    lineThickness = rawfont.lineThickness();
                }
            } else {
                // otherwise it's strike out or overline, we take line thickness
                // from the rawfont with maximum ascent
                if (rawAscent > ascent) {
                    ascent = rawAscent;
                    lineThickness = rawfont.lineThickness();
                }
            }
        }
    }

    if (decorations) {
        addTextDecorations(Decoration(decorations), position + QPointF(0, ascent), color,
                           textLayout->boundingRect().width(),
                           lineThickness, underlinePosition, ascent);
    }
}
Esempio n. 5
0
static QString describeFont(const QFont &f)
{
    QString res = "'" + f.family() + "' ";

    if(f.pointSize() > 0)
        res += QString::number(f.pointSize()) + "pt";
    else
        res += QString::number(f.pixelSize()) + "px";

    if(f.bold())
        res += " bold";
    if(f.italic())
        res += " italic";
    if(f.underline())
        res += " underline";
    if(f.overline())
        res += " overline";
    if(f.strikeOut())
        res += " strikeout";
    return res;
}
Esempio n. 6
0
void SlideShowConfig::saveSettings()
{
    if (!d->config) return;

    d->sharedData->mainPage->saveSettings();

    d->sharedData->captionPage->saveSettings();

    d->sharedData->soundtrackPage->saveSettings();

    d->sharedData->advancedPage->saveSettings();

    KConfigGroup grp = d->config->group("Advanced Slideshow Settings");

    grp.writeEntry("OpenGL", d->sharedData->opengl);

    grp.writeEntry("Delay", d->sharedData->delay);

    grp.writeEntry("Print Filename", d->sharedData->printFileName);

    grp.writeEntry("Print Progress Indicator", d->sharedData->printProgress);

    grp.writeEntry("Print Comments", d->sharedData->printFileComments);

    grp.writeEntry("Loop", d->sharedData->loop);

    grp.writeEntry("Shuffle", d->sharedData->shuffle);

    grp.writeEntry("Show Selected Files Only", d->sharedData->showSelectedFilesOnly);

    grp.writeEntry("Use Milliseconds", d->sharedData->useMilliseconds);

    grp.writeEntry("Enable Mouse Wheel", d->sharedData->enableMouseWheel);

    // Comments tab settings
    QFont* commentsFont = d->sharedData->captionFont;

    grp.writeEntry("Comments Font Family", commentsFont->family());

    grp.writeEntry("Comments Font Size", commentsFont->pointSize());

    grp.writeEntry("Comments Font Bold", commentsFont->bold());

    grp.writeEntry("Comments Font Italic", commentsFont->italic());

    grp.writeEntry("Comments Font Underline", commentsFont->underline());

    grp.writeEntry("Comments Font Overline", commentsFont->overline());

    grp.writeEntry("Comments Font StrikeOut", commentsFont->strikeOut());

    grp.writeEntry("Comments Font FixedPitch", commentsFont->fixedPitch());

    grp.writeEntry("Comments Font Color", d->sharedData->commentsFontColor);

    grp.writeEntry("Comments Bg Color", d->sharedData->commentsBgColor);

    grp.writeEntry("Transparent Bg", d->sharedData->transparentBg);

    grp.writeEntry("Comments Lines Length", d->sharedData->commentsLinesLength);

    grp.writeEntry("Effect Name (OpenGL)", d->sharedData->effectNameGL);

    grp.writeEntry("Effect Name", d->sharedData->effectName);

    // Sountrack tab
    grp.writeEntry("Sountrack Loop", d->sharedData->soundtrackLoop);

    grp.writeEntry("Sountrack Path", d->sharedData->soundtrackPath.path());

    // Advanced settings
    grp.writeEntry("KB Disable FadeInOut", d->sharedData->kbDisableFadeInOut);

    grp.writeEntry("KB Disable Crossfade", d->sharedData->kbDisableCrossFade);

    grp.writeEntry("Enable Cache", d->sharedData->enableCache);

    grp.writeEntry("Cache Size", d->sharedData->cacheSize);

    d->config->sync();
}