diff options
Diffstat (limited to 'src/field-styles/FieldStyle.cpp')
-rw-r--r-- | src/field-styles/FieldStyle.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/field-styles/FieldStyle.cpp b/src/field-styles/FieldStyle.cpp new file mode 100644 index 0000000..4e710f8 --- /dev/null +++ b/src/field-styles/FieldStyle.cpp @@ -0,0 +1,38 @@ +#include "FieldStyle.h" + +FieldStyle::FieldStyle(): + FieldStyle("", 0) {} + +FieldStyle::FieldStyle(const QString& family, int size, + bool bold, bool italic, const QString& colorName, + const QString& prefix, const QString& suffix, + bool hasKeyword, const QString& keywordColorName): + color(Qt::black), + prefix(prefix), suffix(suffix), + hasKeyword(hasKeyword), + keywordBold(false), + keywordItalic(false) +{ + font.setFamily("Times New Roman"); + font.setPointSize(18); + if(!family.isEmpty()) + font.setFamily(family); + if(size > 0) + font.setPointSize(size); + font.setBold(bold); + font.setItalic(italic); + if(!colorName.isEmpty()) + color.setNamedColor(colorName); + keywordColor.setNamedColor(keywordColorName); +} + +FieldStyle FieldStyle::getKeywordStyle() const +{ + if(!hasKeyword) + return *this; + FieldStyle keywordStyle = *this; + keywordStyle.font.setBold(keywordBold); + keywordStyle.font.setItalic(keywordItalic); + keywordStyle.color = keywordColor; + return keywordStyle; +} |