mirror of https://github.com/Nheko-Reborn/nheko
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
580 B
21 lines
580 B
5 years ago
|
#pragma once
|
||
|
|
||
|
// Class for showing a limited amount of completions at a time
|
||
|
|
||
|
#include <QSortFilterProxyModel>
|
||
|
|
||
|
class CompletionProxyModel : public QSortFilterProxyModel
|
||
|
{
|
||
|
public:
|
||
|
CompletionProxyModel(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;
|
||
|
}
|
||
|
};
|