File indexing completed on 2024-04-28 07:46:13

0001 /*
0002     SPDX-FileCopyrightText: 2007 David Nolden <david.nolden.kdevelop@art-master.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #ifndef KATEARGUMENTHINTMODEL_H
0008 #define KATEARGUMENTHINTMODEL_H
0009 
0010 #include "katecompletionmodel.h"
0011 #include <QAbstractListModel>
0012 
0013 class KateCompletionWidget;
0014 
0015 class KateArgumentHintModel : public QAbstractListModel
0016 {
0017     Q_OBJECT
0018 public:
0019     explicit KateArgumentHintModel(KateCompletionModel *parent);
0020 
0021     QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
0022 
0023     int rowCount(const QModelIndex &parent = {}) const override;
0024 
0025     void emitDataChanged(const QModelIndex &start, const QModelIndex &end);
0026 
0027     // Returns the index in the source-model for an index within this model
0028     QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
0029 
0030     void buildRows();
0031     void clear();
0032 
0033 public Q_SLOTS:
0034     void parentModelReset();
0035 
0036 Q_SIGNALS:
0037     void contentStateChanged(bool hasContent);
0038 
0039 private:
0040     KateCompletionModel::Group *group() const;
0041 
0042     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
0043     KateCompletionModel *m_parent;
0044 };
0045 
0046 #endif