summaryrefslogtreecommitdiff
path: root/src/data/style.cpp
diff options
context:
space:
mode:
authorAleks Kissinger <aleks0@gmail.com>2018-08-03 23:22:11 +0200
committerAleks Kissinger <aleks0@gmail.com>2018-08-03 23:22:11 +0200
commit247d9e6b004b2920d696245838b9969690637fd2 (patch)
treec5120e553ed37ddd1ed899f61eaba141af57f9b2 /src/data/style.cpp
parent31a78ae551b781eccc47546a2f6d4bf121af24cf (diff)
support for RGB colors, edit color and name in style editor
Diffstat (limited to 'src/data/style.cpp')
-rw-r--r--src/data/style.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/data/style.cpp b/src/data/style.cpp
index 61c86d6..2e19c4f 100644
--- a/src/data/style.cpp
+++ b/src/data/style.cpp
@@ -17,6 +17,7 @@
*/
#include "style.h"
+#include "tikzit.h"
Style::Style() : _name("none"), _data(0)
{
@@ -43,17 +44,10 @@ QString Style::name() const
QColor Style::strokeColor(bool tikzitOverride) const
{
- if (_data == 0) return Qt::black;
+ if (_data == 0) return QColor(Qt::black);
QString col = propertyWithDefault("draw", "black", tikzitOverride);
-
- QColor namedColor(col);
- if (namedColor.isValid()) {
- return namedColor;
- } else {
- // TODO: read RGB colors
- return QColor(Qt::black);
- }
+ return tikzit->colorByName(col);
}
// TODO
@@ -81,3 +75,8 @@ QString Style::propertyWithDefault(QString prop, QString def, bool tikzitOverrid
if (val.isNull()) val = def;
return val;
}
+
+void Style::setName(const QString &name)
+{
+ _name = name;
+}