File indexing completed on 2024-04-28 15:30:18
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 "expandingtree/expandingwidgetmodel.h" 0011 #include "katecompletionmodel.h" 0012 #include <QAbstractListModel> 0013 0014 class KateCompletionWidget; 0015 0016 class KateArgumentHintModel : public ExpandingWidgetModel 0017 { 0018 Q_OBJECT 0019 public: 0020 explicit KateArgumentHintModel(KateCompletionWidget *parent); 0021 0022 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 0023 0024 int rowCount(const QModelIndex &parent = {}) const override; 0025 0026 int columnCount(const QModelIndex &parent = {}) const override; 0027 0028 QModelIndex index(int row, int column, const QModelIndex &parent = {}) const override; 0029 0030 QModelIndex parent(const QModelIndex &parent) const override; 0031 0032 QTreeView *treeView() const override; 0033 0034 bool indexIsItem(const QModelIndex &index) const override; 0035 0036 void emitDataChanged(const QModelIndex &start, const QModelIndex &end); 0037 0038 // Returns the index in the source-model for an index within this model 0039 QModelIndex mapToSource(const QModelIndex &proxyIndex) const; 0040 0041 void buildRows(); 0042 void clear(); 0043 0044 protected: 0045 int contextMatchQuality(const QModelIndex &row) const override; 0046 public Q_SLOTS: 0047 void parentModelReset(); 0048 Q_SIGNALS: 0049 void contentStateChanged(bool hasContent); 0050 0051 private: 0052 KateCompletionModel::Group *group() const; 0053 KateCompletionModel *model() const; 0054 0055 QList<int> m_rows; // Maps rows to either a positive row-number in the source group, or to a negative number which indicates a label 0056 0057 KateCompletionWidget *m_parent; 0058 }; 0059 0060 #endif