From d24f813f3f2a05c112e803e4256b53535895fc98 Mon Sep 17 00:00:00 2001 From: Jedidiah Barber Date: Wed, 14 Jul 2021 11:49:10 +1200 Subject: Initial mirror commit --- src/field-styles/FieldStyle.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/field-styles/FieldStyle.cpp (limited to 'src/field-styles/FieldStyle.cpp') 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; +} -- cgit