2020-08-28 23:32:23 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
// Class for showing a limited amount of completions at a time
|
|
|
|
|
|
|
|
#include <QSortFilterProxyModel>
|
|
|
|
|
2020-08-28 23:59:27 +03:00
|
|
|
class CompletionModel : public QSortFilterProxyModel
|
|
|
|
{
|
2020-08-28 23:32:23 +03:00
|
|
|
public:
|
2020-08-28 23:59:27 +03:00
|
|
|
CompletionModel(QAbstractItemModel *model, QObject *parent = nullptr)
|
|
|
|
: QSortFilterProxyModel(parent)
|
|
|
|
{
|
|
|
|
setSourceModel(model);
|
|
|
|
}
|
|
|
|
int rowCount(const QModelIndex &parent) const override
|
|
|
|
{
|
|
|
|
auto row_count = QSortFilterProxyModel::rowCount(parent);
|
|
|
|
return (row_count < 7) ? row_count : 7;
|
|
|
|
}
|
2020-08-28 23:32:23 +03:00
|
|
|
};
|