mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-27 05:28:48 +03:00
17 lines
486 B
C
17 lines
486 B
C
|
#pragma once
|
||
|
|
||
|
// Class for showing a limited amount of completions at a time
|
||
|
|
||
|
#include <QSortFilterProxyModel>
|
||
|
|
||
|
class CompletionModel : public QSortFilterProxyModel {
|
||
|
public:
|
||
|
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;
|
||
|
}
|
||
|
};
|