diff options
author | Aleks Kissinger <aleks0@gmail.com> | 2018-10-06 15:49:50 +0200 |
---|---|---|
committer | Aleks Kissinger <aleks0@gmail.com> | 2018-10-06 15:49:50 +0200 |
commit | 6359b28b155355e0be67961cc21eccdbd2c61cc2 (patch) | |
tree | 94992fb08ffedf2b1481e97e7af34fbdfc076408 /src/data/style.h | |
parent | e61fb864ec68a58abdb9cc9df047b4b75801c5e7 (diff) |
unified node and edge syles
Diffstat (limited to 'src/data/style.h')
-rw-r--r-- | src/data/style.h | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/src/data/style.h b/src/data/style.h index cef7c7b..ca2e604 100644 --- a/src/data/style.h +++ b/src/data/style.h @@ -22,34 +22,53 @@ #include "graphelementdata.h"
+#include <QObject>
#include <QColor>
#include <QPen>
#include <QBrush>
#include <QPainterPath>
#include <QIcon>
-class Style
+class Style : public QObject
{
+ Q_OBJECT
public:
+ enum ArrowTipStyle {
+ Flat, Pointer, NoTip
+ };
+
+ enum DrawStyle {
+ Solid, Dotted, Dashed
+ };
+
Style();
Style(QString name, GraphElementData *data);
- bool isNone();
+ bool isNone() const;
+ bool isEdgeStyle() const;
- // properties that both edges and nodes have
+ // for node and edge styles
GraphElementData *data() const;
QString name() const;
QColor strokeColor(bool tikzitOverride=true) const;
int strokeThickness() const;
-
- // methods that are implemented differently for edges and nodes
- virtual QPen pen() const;
- virtual QPainterPath path() const = 0;
- virtual QPainterPath palettePath() const = 0;
- virtual QIcon icon() const = 0;
+ QPen pen() const;
+ QPainterPath path() const;
+ QIcon icon() const;
void setName(const QString &name);
QString propertyWithDefault(QString prop, QString def, bool tikzitOverride=true) const;
-
QString tikz() const;
+
+ // only relevant for node styles
+ QColor fillColor(bool tikzitOverride=true) const;
+ QBrush brush() const;
+ QString shape(bool tikzitOverride=true) const;
+
+ // only relevant for edge styles
+ Style::ArrowTipStyle arrowHead() const;
+ Style::ArrowTipStyle arrowTail() const;
+ Style::DrawStyle drawStyle() const;
+ QString category() const;
+
protected:
QString _name;
GraphElementData *_data;
|