diff options
author | Aleks Kissinger <aleks0@gmail.com> | 2018-10-06 16:06:06 +0200 |
---|---|---|
committer | Aleks Kissinger <aleks0@gmail.com> | 2018-10-06 16:06:06 +0200 |
commit | c0b8dea3d3b93fd4b87e5311b6c6422a7ccdb723 (patch) | |
tree | 7bea34c2d86c2d68a6c6d4d9e003c8573dc77449 /src/data/nodestylelist.cpp | |
parent | 6359b28b155355e0be67961cc21eccdbd2c61cc2 (diff) |
removed EdgeStyle and NodeStyle classes
Diffstat (limited to 'src/data/nodestylelist.cpp')
-rw-r--r-- | src/data/nodestylelist.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/data/nodestylelist.cpp b/src/data/nodestylelist.cpp index 41749db..7f17ff0 100644 --- a/src/data/nodestylelist.cpp +++ b/src/data/nodestylelist.cpp @@ -6,14 +6,14 @@ NodeStyleList::NodeStyleList(QObject *parent) : QAbstractListModel(parent) { } -NodeStyle *NodeStyleList::style(QString name) +Style *NodeStyleList::style(QString name) { - foreach (NodeStyle *s, _styles) + foreach (Style *s, _styles) if (s->name() == name) return s; return nullptr; } -NodeStyle *NodeStyleList::style(int i) +Style *NodeStyleList::style(int i) { return _styles[i]; } @@ -23,8 +23,9 @@ int NodeStyleList::length() const return _styles.length(); } -void NodeStyleList::addStyle(NodeStyle *s) +void NodeStyleList::addStyle(Style *s) { + s->setParent(this); if (s->category() == _category) { int n = numInCategory(); beginInsertRows(QModelIndex(), n, n); @@ -53,7 +54,7 @@ QString NodeStyleList::tikz() { QString str; QTextStream code(&str); - foreach (NodeStyle *s, _styles) code << s->tikz() << "\n"; + foreach (Style *s, _styles) code << s->tikz() << "\n"; code.flush(); return str; } @@ -61,7 +62,7 @@ QString NodeStyleList::tikz() int NodeStyleList::numInCategory() const { int c = 0; - foreach (NodeStyle *s, _styles) { + foreach (Style *s, _styles) { if (_category == "" || s->category() == _category) { ++c; } @@ -81,7 +82,7 @@ int NodeStyleList::nthInCategory(int n) const return -1; } -NodeStyle *NodeStyleList::styleInCategory(int n) const +Style *NodeStyleList::styleInCategory(int n) const { return _styles[nthInCategory(n)]; } |