summaryrefslogtreecommitdiff
path: root/src/data/stylelist.h
blob: cf86c0666dc1270d25c5ad411e489217ffaee78c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef NODESTYLELIST_H
#define NODESTYLELIST_H

#include "style.h"

#include <QAbstractListModel>

class StyleList : public QAbstractListModel
{
    Q_OBJECT
public:
    explicit StyleList(bool edgeStyles = false, QObject *parent = nullptr);
    Style *style(QString name);
    Style *style(int i);
    int length() const;
    void addStyle(Style *s);
    void removeNthStyle(int n);
    void clear();
    QString tikz();

    int numInCategory() const;
    int nthInCategory(int n) const;
    Style *styleInCategory(int n) const;

    QVariant data(const QModelIndex &index, int role) const override;
    int rowCount(const QModelIndex &/*parent*/) const override;
    bool moveRows(const QModelIndex &sourceParent,
                  int sourceRow,
                  int /*count*/,
                  const QModelIndex &destinationParent,
                  int destinationChild) override;


    QString category() const;
    void setCategory(const QString &category);

signals:

public slots:

private:
    QVector<Style*> _styles;
    QString _category;
    bool _edgeStyles;
};

#endif // NODESTYLELIST_H