summaryrefslogtreecommitdiff
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
parent6e40278f58e63adcf6459242219f3a8d282fdebc (diff)
adjusted font sized
-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
-rw-r--r--src/gui/styleeditor.ui168
-rw-r--r--src/gui/stylepalette.ui11
-rw-r--r--src/gui/tikzview.cpp8
-rw-r--r--src/gui/tikzview.h1
10 files changed, 197 insertions, 18 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
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 @@
<height>20</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>Name</string>
</property>
@@ -52,6 +57,11 @@
<height>20</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>Category</string>
</property>
@@ -71,6 +81,11 @@
<height>20</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>Fill Color</string>
</property>
@@ -90,6 +105,11 @@
<height>20</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>Draw Color</string>
</property>
@@ -109,6 +129,11 @@
<height>20</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
</widget>
<widget class="QComboBox" name="category">
<property name="geometry">
@@ -119,6 +144,11 @@
<height>22</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="editable">
<bool>true</bool>
</property>
@@ -172,12 +202,13 @@
<rect>
<x>390</x>
<y>110</y>
- <width>61</width>
+ <width>71</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
+ <pointsize>9</pointsize>
<italic>false</italic>
</font>
</property>
@@ -190,12 +221,13 @@
<rect>
<x>390</x>
<y>140</y>
- <width>61</width>
+ <width>71</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
+ <pointsize>9</pointsize>
<italic>false</italic>
</font>
</property>
@@ -206,7 +238,7 @@
<widget class="QPushButton" name="tikzitFillColor">
<property name="geometry">
<rect>
- <x>450</x>
+ <x>460</x>
<y>110</y>
<width>31</width>
<height>18</height>
@@ -225,7 +257,7 @@
<widget class="QPushButton" name="tikzitDrawColor">
<property name="geometry">
<rect>
- <x>450</x>
+ <x>460</x>
<y>140</y>
<width>31</width>
<height>18</height>
@@ -250,6 +282,11 @@
<height>20</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>Shape</string>
</property>
@@ -269,6 +306,11 @@
<height>22</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="editable">
<bool>true</bool>
</property>
@@ -293,12 +335,13 @@
<rect>
<x>290</x>
<y>200</y>
- <width>61</width>
+ <width>71</width>
<height>17</height>
</rect>
</property>
<property name="font">
<font>
+ <pointsize>9</pointsize>
<italic>false</italic>
</font>
</property>
@@ -309,12 +352,17 @@
<widget class="QComboBox" name="tikzitShape">
<property name="geometry">
<rect>
- <x>350</x>
+ <x>370</x>
<y>200</y>
- <width>131</width>
+ <width>111</width>
<height>22</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<item>
<property name="text">
<string/>
@@ -340,6 +388,11 @@
<height>20</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>Arrowhead</string>
</property>
@@ -359,6 +412,11 @@
<height>22</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="editable">
<bool>false</bool>
</property>
@@ -405,6 +463,11 @@
<height>22</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="editable">
<bool>false</bool>
</property>
@@ -433,6 +496,11 @@
<height>20</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>Properties</string>
</property>
@@ -452,6 +520,11 @@
<height>18</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>+</string>
</property>
@@ -465,6 +538,11 @@
<height>18</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>+a</string>
</property>
@@ -478,6 +556,11 @@
<height>18</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>-</string>
</property>
@@ -491,6 +574,11 @@
<height>18</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>^</string>
</property>
@@ -504,6 +592,11 @@
<height>18</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>v</string>
</property>
@@ -517,6 +610,12 @@
<height>251</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>8</pointsize>
+ <italic>true</italic>
+ </font>
+ </property>
</widget>
<widget class="QListView" name="edgeStyleListView">
<property name="geometry">
@@ -527,6 +626,12 @@
<height>151</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>8</pointsize>
+ <italic>true</italic>
+ </font>
+ </property>
</widget>
<widget class="QToolButton" name="addStyle">
<property name="geometry">
@@ -537,6 +642,11 @@
<height>18</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>+</string>
</property>
@@ -550,6 +660,11 @@
<height>18</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>-</string>
</property>
@@ -563,6 +678,11 @@
<height>18</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>^</string>
</property>
@@ -576,6 +696,11 @@
<height>18</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>v</string>
</property>
@@ -589,6 +714,11 @@
<height>18</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>-</string>
</property>
@@ -602,6 +732,11 @@
<height>18</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>+</string>
</property>
@@ -615,6 +750,11 @@
<height>18</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>^</string>
</property>
@@ -628,6 +768,11 @@
<height>18</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>v</string>
</property>
@@ -635,12 +780,17 @@
<widget class="QPushButton" name="save">
<property name="geometry">
<rect>
- <x>489</x>
+ <x>479</x>
<y>490</y>
- <width>81</width>
+ <width>91</width>
<height>20</height>
</rect>
</property>
+ <property name="font">
+ <font>
+ <pointsize>9</pointsize>
+ </font>
+ </property>
<property name="text">
<string>Save and Close</string>
</property>
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 @@
<property name="minimumSize">
<size>
<width>130</width>
- <height>218</height>
+ <height>268</height>
</size>
</property>
<property name="maximumSize">
@@ -134,7 +134,14 @@
</widget>
</item>
<item>
- <widget class="QListView" name="edgeStyleListView"/>
+ <widget class="QListView" name="edgeStyleListView">
+ <property name="font">
+ <font>
+ <pointsize>8</pointsize>
+ <italic>true</italic>
+ </font>
+ </property>
+ </widget>
</item>
</layout>
</widget>
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;
};