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
|
// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
#ifndef ERRORLISTMODEL_H
#define ERRORLISTMODEL_H
#include <QAbstractListModel>
class QQmlError;
class ErrorListModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit ErrorListModel(QObject *parent = nullptr);
void setErrorList(const QList<QQmlError> &errorList);
Q_INVOKABLE void selectRow(int row);
private:
bool isIndexValid(const QModelIndex &index) const;
// QAbstractItemModel interface
int rowCount(const QModelIndex &parent = QModelIndex{}) const final;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const final;
signals:
void errorPositionSelected(int line, int column);
public slots:
void selectIndex(const QModelIndex &index);
private:
QList<QQmlError> m_errorList;
};
#endif // ERRORLISTMODEL_H
|