60 GroupCommentOrString = QTextFormat::UserObject,
61 GroupNumber = QTextFormat::UserObject + 1
102 StyleItem(StyleType type,
const QTextCharFormat &format);
108 bool isValid()
const {
return m_valid; }
109 QString name()
const {
return m_name; }
110 StyleType type()
const {
return m_type; }
111 QTextCharFormat& rformat() {
return m_format; }
112 QTextCharFormat format()
const {
return m_format; }
114 static QMetaEnum styleTypeEnum();
116 static QList<StyleItem::StyleType> availableStyleTypes();
118 static QTextCharFormat createFormat(
const QBrush &color,
const QBrush &bgcolor = QBrush(), \
119 bool bold =
false,
bool italic =
false,
bool underline =
false, \
120 QFont::StyleHint styleHint = QFont::SansSerif);
122 static QTextCharFormat createFormat(
const QString &familyName,
int pointSize,
const QColor &color, \
123 const QColor &bgcolor = QColor(),
bool bold =
false, QFont::StyleHint styleHint = QFont::SansSerif);
125 void setObjectType(
int type) { m_format.setObjectType(type); }
130 QTextCharFormat m_format;
143 int numStyles()
const {
return m_formats.size(); }
144 QList<int> styleKeys()
const {
return m_formats.keys(); }
145 StyleItem operator[](StyleItem::StyleType type)
const;
146 StyleItem& operator[](StyleItem::StyleType type);
147 StyleItem at(StyleItem::StyleType type)
const {
return (*
this)[type]; }
148 StyleItem& at(StyleItem::StyleType type) {
return (*
this)[type]; }
149 QTextCharFormat format(StyleItem::StyleType type)
const;
150 QTextCharFormat& rformat(StyleItem::StyleType type);
152 QColor background()
const;
153 void setBackground(
const QColor &color);
156 QMap<int, StyleItem> m_formats;