| 1 | /* |
| 2 | SPDX-FileCopyrightText: 2007 David Nolden <david.nolden.kdevelop@art-master.de> |
| 3 | |
| 4 | SPDX-License-Identifier: LGPL-2.0-or-later |
| 5 | */ |
| 6 | |
| 7 | #ifndef KATEARGUMENTHINTMODEL_H |
| 8 | #define KATEARGUMENTHINTMODEL_H |
| 9 | |
| 10 | #include "katecompletionmodel.h" |
| 11 | #include <QAbstractListModel> |
| 12 | |
| 13 | class KateCompletionWidget; |
| 14 | |
| 15 | class KateArgumentHintModel : public QAbstractListModel |
| 16 | { |
| 17 | Q_OBJECT |
| 18 | public: |
| 19 | explicit KateArgumentHintModel(KateCompletionModel *parent); |
| 20 | |
| 21 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; |
| 22 | |
| 23 | int rowCount(const QModelIndex &parent = {}) const override; |
| 24 | |
| 25 | void emitDataChanged(const QModelIndex &start, const QModelIndex &end); |
| 26 | |
| 27 | // Returns the index in the source-model for an index within this model |
| 28 | QModelIndex mapToSource(const QModelIndex &proxyIndex) const; |
| 29 | |
| 30 | void buildRows(); |
| 31 | void clear(); |
| 32 | |
| 33 | public Q_SLOTS: |
| 34 | void parentModelReset(); |
| 35 | |
| 36 | Q_SIGNALS: |
| 37 | void contentStateChanged(bool hasContent); |
| 38 | |
| 39 | private: |
| 40 | KateCompletionModel::Group *group() const; |
| 41 | |
| 42 | std::vector<int> m_rows; // Maps rows to either a positive row-number in the source group, or to a negative number which indicates a label |
| 43 | KateCompletionModel *m_parent; |
| 44 | }; |
| 45 | |
| 46 | #endif |
| 47 | |