summaryrefslogtreecommitdiff
path: root/src/field-styles/FieldStyle.cpp
diff options
context:
space:
mode:
authorJedidiah Barber <contact@jedbarber.id.au>2021-07-14 11:49:10 +1200
committerJedidiah Barber <contact@jedbarber.id.au>2021-07-14 11:49:10 +1200
commitd24f813f3f2a05c112e803e4256b53535895fc98 (patch)
tree601e6ae9a1cd44bcfdcf91739a5ca36aedd827c9 /src/field-styles/FieldStyle.cpp
Initial mirror commitHEADmaster
Diffstat (limited to 'src/field-styles/FieldStyle.cpp')
-rw-r--r--src/field-styles/FieldStyle.cpp38
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;
+}