Esempio n. 1
0
void FontSet::slotColor()
{
    QColor color = QColorDialog::getColor (Qt::red,this);

    if(color.isValid())
    {
        QTextCharFormat fmt;
        fmt.setForeground(color);
        mergeFormat(fmt);
    }
}
Esempio n. 2
0
// NOTE: This and the following functions are intimately tied to the values in FormatType. Don't change this
//       until you _really_ know what you do!
QTextCharFormat UiStyle::format(quint32 ftype, quint32 label_) const {
  if(ftype == Invalid)
    return QTextCharFormat();

  quint64 label = (quint64)label_ << 32;

  // check if we have exactly this format readily cached already
  QTextCharFormat fmt = cachedFormat(ftype, label_);
  if(fmt.properties().count())
    return fmt;

  mergeFormat(fmt, ftype, label & Q_UINT64_C(0xffff000000000000));

  for(quint64 mask = Q_UINT64_C(0x0000000100000000); mask <= (quint64)Selected << 32; mask <<=1) {
    if(label & mask)
      mergeFormat(fmt, ftype, mask | Q_UINT64_C(0xffff000000000000));
  }

  setCachedFormat(fmt, ftype, label_);
  return fmt;
}
Esempio n. 3
0
void FontSet::slotUnder()
{
    QTextCharFormat fmt;
    fmt.setFontUnderline(underBtn->isChecked());
    mergeFormat(fmt);
}
Esempio n. 4
0
void FontSet::slotItalic()
{
    QTextCharFormat fmt;
    fmt.setFontItalic(italicBtn->isChecked());
    mergeFormat(fmt);
}
Esempio n. 5
0
void FontSet::slotBold()
{
    QTextCharFormat fmt;
    fmt.setFontWeight(boldBtn->isChecked()? QFont::Bold : QFont::Normal);
    mergeFormat(fmt);
}
Esempio n. 6
0
void FontSet::slotSize(QString num)
{
    QTextCharFormat fmt;
    fmt.setFontPointSize(num.toFloat());
    mergeFormat(fmt);
}
Esempio n. 7
0
void FontSet::slotFont(QString f)
{
    QTextCharFormat fmt;
    fmt.setFontFamily(f);
    mergeFormat(fmt);
}