diff options
Diffstat (limited to 'src/data')
-rw-r--r-- | src/data/edge.cpp | 6 | ||||
-rw-r--r-- | src/data/node.cpp | 5 | ||||
-rw-r--r-- | src/data/node.h | 2 | ||||
-rw-r--r-- | src/data/nodestyle.cpp | 11 | ||||
-rw-r--r-- | src/data/nodestyle.h | 1 | ||||
-rw-r--r-- | src/data/tikzstyles.cpp | 2 |
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
|