From f448114bc7eaa9b99780c108d5172f649c626a88 Mon Sep 17 00:00:00 2001 From: Aleks Kissinger Date: Mon, 1 Oct 2018 15:08:42 +0200 Subject: adjusted font sized --- src/data/edge.cpp | 6 +- src/data/node.cpp | 5 ++ src/data/node.h | 2 + src/data/nodestyle.cpp | 11 ++-- src/data/nodestyle.h | 1 + src/data/tikzstyles.cpp | 2 +- src/gui/styleeditor.ui | 168 +++++++++++++++++++++++++++++++++++++++++++++--- src/gui/stylepalette.ui | 11 +++- src/gui/tikzview.cpp | 8 +++ src/gui/tikzview.h | 1 + 10 files changed, 197 insertions(+), 18 deletions(-) (limited to 'src') 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 +#include 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 diff --git a/src/gui/styleeditor.ui b/src/gui/styleeditor.ui index 697a084..f2c2437 100644 --- a/src/gui/styleeditor.ui +++ b/src/gui/styleeditor.ui @@ -33,6 +33,11 @@ 20 + + + 9 + + Name @@ -52,6 +57,11 @@ 20 + + + 9 + + Category @@ -71,6 +81,11 @@ 20 + + + 9 + + Fill Color @@ -90,6 +105,11 @@ 20 + + + 9 + + Draw Color @@ -109,6 +129,11 @@ 20 + + + 9 + + @@ -119,6 +144,11 @@ 22 + + + 9 + + true @@ -172,12 +202,13 @@ 390 110 - 61 + 71 17 + 9 false @@ -190,12 +221,13 @@ 390 140 - 61 + 71 17 + 9 false @@ -206,7 +238,7 @@ - 450 + 460 110 31 18 @@ -225,7 +257,7 @@ - 450 + 460 140 31 18 @@ -250,6 +282,11 @@ 20 + + + 9 + + Shape @@ -269,6 +306,11 @@ 22 + + + 9 + + true @@ -293,12 +335,13 @@ 290 200 - 61 + 71 17 + 9 false @@ -309,12 +352,17 @@ - 350 + 370 200 - 131 + 111 22 + + + 9 + + @@ -340,6 +388,11 @@ 20 + + + 9 + + Arrowhead @@ -359,6 +412,11 @@ 22 + + + 9 + + false @@ -405,6 +463,11 @@ 22 + + + 9 + + false @@ -433,6 +496,11 @@ 20 + + + 9 + + Properties @@ -452,6 +520,11 @@ 18 + + + 9 + + + @@ -465,6 +538,11 @@ 18 + + + 9 + + +a @@ -478,6 +556,11 @@ 18 + + + 9 + + - @@ -491,6 +574,11 @@ 18 + + + 9 + + ^ @@ -504,6 +592,11 @@ 18 + + + 9 + + v @@ -517,6 +610,12 @@ 251 + + + 8 + true + + @@ -527,6 +626,12 @@ 151 + + + 8 + true + + @@ -537,6 +642,11 @@ 18 + + + 9 + + + @@ -550,6 +660,11 @@ 18 + + + 9 + + - @@ -563,6 +678,11 @@ 18 + + + 9 + + ^ @@ -576,6 +696,11 @@ 18 + + + 9 + + v @@ -589,6 +714,11 @@ 18 + + + 9 + + - @@ -602,6 +732,11 @@ 18 + + + 9 + + + @@ -615,6 +750,11 @@ 18 + + + 9 + + ^ @@ -628,6 +768,11 @@ 18 + + + 9 + + v @@ -635,12 +780,17 @@ - 489 + 479 490 - 81 + 91 20 + + + 9 + + Save and Close diff --git a/src/gui/stylepalette.ui b/src/gui/stylepalette.ui index 681d83e..abba648 100644 --- a/src/gui/stylepalette.ui +++ b/src/gui/stylepalette.ui @@ -19,7 +19,7 @@ 130 - 218 + 268 @@ -134,7 +134,14 @@ - + + + + 8 + true + + + diff --git a/src/gui/tikzview.cpp b/src/gui/tikzview.cpp index 6cdb17c..0f1dc30 100644 --- a/src/gui/tikzview.cpp +++ b/src/gui/tikzview.cpp @@ -126,3 +126,11 @@ void TikzView::drawBackground(QPainter *painter, const QRectF &rect) painter->drawLine(0, rect.top(), 0, rect.bottom()); } +void TikzView::wheelEvent(QWheelEvent *event) +{ + if (event->modifiers() & Qt::ShiftModifier) { + event->setModifiers(Qt::NoModifier); + QGraphicsView::wheelEvent(event); + } +} + diff --git a/src/gui/tikzview.h b/src/gui/tikzview.h index 4ec9f3d..e13fe72 100644 --- a/src/gui/tikzview.h +++ b/src/gui/tikzview.h @@ -45,6 +45,7 @@ public slots: void setScene(QGraphicsScene *scene); protected: void drawBackground(QPainter *painter, const QRectF &rect); + void wheelEvent(QWheelEvent *event) override; private: float _scale; }; -- cgit v1.2.3