summaryrefslogtreecommitdiff
path: root/src/data
diff options
context:
space:
mode:
authorAleks Kissinger <aleks0@gmail.com>2018-10-01 15:08:42 +0200
committerAleks Kissinger <aleks0@gmail.com>2018-10-01 15:08:42 +0200
commitf448114bc7eaa9b99780c108d5172f649c626a88 (patch)
tree728f6042f7a86dfa6c11d0a37fcaee71b688ec90 /src/data
parent6e40278f58e63adcf6459242219f3a8d282fdebc (diff)
adjusted font sized
Diffstat (limited to 'src/data')
-rw-r--r--src/data/edge.cpp6
-rw-r--r--src/data/node.cpp5
-rw-r--r--src/data/node.h2
-rw-r--r--src/data/nodestyle.cpp11
-rw-r--r--src/data/nodestyle.h1
-rw-r--r--src/data/tikzstyles.cpp2
6 files changed, 20 insertions, 7 deletions
diff --git a/src/data/edge.cpp b/src/data/edge.cpp
index 8b2a851..b4c7ec1 100644
--- a/src/data/edge.cpp
+++ b/src/data/edge.cpp
@@ -277,8 +277,10 @@ void Edge::updateData()
if (_source == _target) _data->setAtom("loop");
if (!isSelfLoop() && !isStraight() && _weight != 0.4f)
_data->setProperty("looseness", QString::number(_weight*2.5f, 'f', 2));
- if (_source->style()->isNone()) _sourceAnchor = "center";
- if (_target->style()->isNone()) _targetAnchor = "center";
+ if (_source->isBlankNode()) _sourceAnchor = "center";
+ else _sourceAnchor = "";
+ if (_target->isBlankNode()) _targetAnchor = "center";
+ else _targetAnchor = "";
}
diff --git a/src/data/node.cpp b/src/data/node.cpp
index 44e3c77..a4ee39b 100644
--- a/src/data/node.cpp
+++ b/src/data/node.cpp
@@ -107,6 +107,11 @@ NodeStyle *Node::style() const
return _style;
}
+bool Node::isBlankNode()
+{
+ return styleName() == "none";
+}
+
int Node::tikzLine() const
{
return _tikzLine;
diff --git a/src/data/node.h b/src/data/node.h
index 2a6627e..111bf19 100644
--- a/src/data/node.h
+++ b/src/data/node.h
@@ -53,6 +53,8 @@ public:
void attachStyle();
NodeStyle *style() const;
+ bool isBlankNode();
+
int tikzLine() const;
void setTikzLine(int tikzLine);
diff --git a/src/data/nodestyle.cpp b/src/data/nodestyle.cpp
index 20245d9..8bdb763 100644
--- a/src/data/nodestyle.cpp
+++ b/src/data/nodestyle.cpp
@@ -20,9 +20,10 @@
#include "tikzit.h"
#include <QPainter>
+#include <QImage>
NodeStyle *noneStyle = new NodeStyle();
-NodeStyle *unknownStyle = new NodeStyle("unknown", new GraphElementData({GraphElementProperty("tikzit fill", "red")}));
+NodeStyle *unknownStyle = new NodeStyle("unknown", new GraphElementData({GraphElementProperty("tikzit fill", "blue")}));
NodeStyle::NodeStyle() : Style()
{
@@ -72,9 +73,12 @@ QPainterPath NodeStyle::palettePath() const
QIcon NodeStyle::icon() const
{
// draw an icon matching the style
- QPixmap px(100,100);
+ QImage px(100,100,QImage::Format_ARGB32_Premultiplied);
px.fill(Qt::transparent);
+
+
QPainter painter(&px);
+ painter.setRenderHint(QPainter::Antialiasing);
QPainterPath pth = path();
pth.translate(50.0f, 50.0f);
@@ -98,7 +102,6 @@ QIcon NodeStyle::icon() const
painter.drawPath(pth);
}
-
- return QIcon(px);
+ return QIcon(QPixmap::fromImage(px));
}
diff --git a/src/data/nodestyle.h b/src/data/nodestyle.h
index 67219db..a3842ff 100644
--- a/src/data/nodestyle.h
+++ b/src/data/nodestyle.h
@@ -43,5 +43,6 @@ public:
};
extern NodeStyle *noneStyle;
+extern NodeStyle *unknownStyle;
#endif // NODESTYLE_H
diff --git a/src/data/tikzstyles.cpp b/src/data/tikzstyles.cpp
index 68b3dcd..a827db5 100644
--- a/src/data/tikzstyles.cpp
+++ b/src/data/tikzstyles.cpp
@@ -33,7 +33,7 @@ NodeStyle *TikzStyles::nodeStyle(QString name) const
{
foreach (NodeStyle *s , _nodeStyles)
if (s->name() == name) return s;
- return noneStyle;
+ return unknownStyle;
}
EdgeStyle *TikzStyles::edgeStyle(QString name) const