-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwingsquiggleinfomodel.h
More file actions
60 lines (48 loc) · 1.9 KB
/
wingsquiggleinfomodel.h
File metadata and controls
60 lines (48 loc) · 1.9 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
/****************************************************************************
**
** Copyright (C) 2025-2028 WingSummer
**
** This file may be used under the terms of the GNU General Public License
** version 3 as published by the Free Software Foundation.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** You should have received a copy of the GNU General Public License version 3
** along with this program. If not, see <https://www.gnu.org/licenses/>.
**
****************************************************************************/
#ifndef WINGSQUIGGLEINFOMODEL_H
#define WINGSQUIGGLEINFOMODEL_H
#include <QAbstractListModel>
#include <QIcon>
#include <QVector>
class WingCodeEdit;
class WingSquiggleInfoModel : public QAbstractListModel {
Q_OBJECT
public:
enum class SeverityLevel { Hint, Information, Warning, Error, MAX_LEVEL };
Q_ENUM(SeverityLevel)
public:
explicit WingSquiggleInfoModel(WingCodeEdit *editor,
QObject *parent = nullptr);
explicit WingSquiggleInfoModel(QObject *parent = nullptr);
public:
WingCodeEdit *editor() const;
void setEditor(WingCodeEdit *newEditor);
void setSeverityLevelIcon(SeverityLevel level, const QIcon &icon);
QIcon severityLevelIcon(SeverityLevel level) const;
public:
SeverityLevel squiggleInfoSeverityLevel(qsizetype index) const;
QPair<int, int> squiggleInfoPosStart(qsizetype index) const;
QPair<int, int> squiggleInfoPosStop(qsizetype index) const;
QString squiggleInfoText(qsizetype index) const;
// QAbstractItemModel interface
public:
virtual int rowCount(const QModelIndex &parent) const override;
virtual QVariant data(const QModelIndex &index, int role) const override;
private:
WingCodeEdit *_editor;
QVector<QIcon> _icons;
};
#endif // WINGSQUIGGLEINFOMODEL_H