From 20e06dd885819f7b16711ac5359fcdcfb8d26c86 Mon Sep 17 00:00:00 2001 From: Aleks Kissinger Date: Sat, 4 Aug 2018 18:16:18 +0200 Subject: style editor --- src/data/nodestyle.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/data/nodestyle.cpp') diff --git a/src/data/nodestyle.cpp b/src/data/nodestyle.cpp index aec899f..9c38dfd 100644 --- a/src/data/nodestyle.cpp +++ b/src/data/nodestyle.cpp @@ -45,20 +45,21 @@ QBrush NodeStyle::brush() const return QBrush(fillColor()); } -NodeStyle::Shape NodeStyle::shape(bool tikzitOverride) const +QString NodeStyle::shape(bool tikzitOverride) const { - if (_data == 0) return NodeStyle::Circle; - - QString sh = propertyWithDefault("shape", "circle", tikzitOverride); - if (sh == "circle") return NodeStyle::Circle; - else if (sh == "rectangle") return NodeStyle::Rectangle; - else return NodeStyle::Circle; + return propertyWithDefault("shape", "circle", tikzitOverride); } QPainterPath NodeStyle::path() const { QPainterPath pth; - pth.addEllipse(QPointF(0.0f,0.0f), 30.0f, 30.0f); + QString sh = shape(); + + if (sh == "rectangle") { + pth.addRect(-30.0f, -30.0f, 60.0f, 60.0f); + } else { // default is 'circle' + pth.addEllipse(QPointF(0.0f,0.0f), 30.0f, 30.0f); + } return pth; } -- cgit v1.2.3