From c0b8dea3d3b93fd4b87e5311b6c6422a7ccdb723 Mon Sep 17 00:00:00 2001 From: Aleks Kissinger Date: Sat, 6 Oct 2018 16:06:06 +0200 Subject: removed EdgeStyle and NodeStyle classes --- src/data/nodestylelist.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/data/nodestylelist.cpp') 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)]; } -- cgit v1.2.3