File indexing completed on 2024-05-12 16:02:09

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2007 Jan Hambrecht <jaham@gmx.net>
0003  *
0004  * SPDX-License-Identifier: LGPL-2.0-or-later
0005  */
0006 #ifndef KOLINESTYLEMODEL_H
0007 #define KOLINESTYLEMODEL_H
0008 
0009 #include <QAbstractListModel>
0010 
0011 #include <QVector>
0012 
0013 /// The line style model managing the style data
0014 class KoLineStyleModel : public QAbstractListModel
0015 {
0016 public:
0017     explicit KoLineStyleModel(QObject *parent = 0);
0018     ~KoLineStyleModel() override {}
0019     int rowCount(const QModelIndex &parent = QModelIndex()) const override;
0020     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
0021 
0022     /// adds the given style to the model
0023     bool addCustomStyle(const QVector<qreal> &style);
0024     /// selects the given style
0025     int setLineStyle(Qt::PenStyle style, const QVector<qreal> &dashes);
0026 private:
0027     QList<QVector<qreal> > m_styles; ///< the added styles
0028     QVector<qreal> m_tempStyle; ///< a temporary added style
0029     bool m_hasTempStyle;        ///< state of the temporary style
0030 };
0031 
0032 #endif