void FontSet::slotColor() { QColor color = QColorDialog::getColor (Qt::red,this); if(color.isValid()) { QTextCharFormat fmt; fmt.setForeground(color); mergeFormat(fmt); } }
// 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; }
void FontSet::slotUnder() { QTextCharFormat fmt; fmt.setFontUnderline(underBtn->isChecked()); mergeFormat(fmt); }
void FontSet::slotItalic() { QTextCharFormat fmt; fmt.setFontItalic(italicBtn->isChecked()); mergeFormat(fmt); }
void FontSet::slotBold() { QTextCharFormat fmt; fmt.setFontWeight(boldBtn->isChecked()? QFont::Bold : QFont::Normal); mergeFormat(fmt); }
void FontSet::slotSize(QString num) { QTextCharFormat fmt; fmt.setFontPointSize(num.toFloat()); mergeFormat(fmt); }
void FontSet::slotFont(QString f) { QTextCharFormat fmt; fmt.setFontFamily(f); mergeFormat(fmt); }