[SailfishDevel] Show limited items in listview
Oleg Linkin
maledictusdemagog at gmail.com
Fri Mar 16 06:56:44 UTC 2018
Hello.
I want to show only limited count of items from in ListView.
I create QSortFilterProxyModel subclass and reimplement rowCount method. But
this doesn't work.
If I return some number from rowCount - view doesn't show anything. If I
return QSortFilterProxyModel::rowCount(parent) - ListView show all elements
from model.
// Show all(7) elements from source model
int LimitProxyModel::rowCount(const QModelIndex& parent) const
{
return QSortFilterProxyModel(parent);
}
// Show all(7) elements from source model
int LimitProxyModel::rowCount(const QModelIndex& parent) const
{
int count = sourceModel()->rowCount(parent);
return count;
}
// Show nothing
int LimitProxyModel::rowCount(const QModelIndex& parent) const
{
int count = sourceModel()->rowCount(parent);
return 7;
}
// Show nothing
int LimitProxyModel::rowCount(const QModelIndex& parent) const
{
return 7;
}
Have you any ideas?
Thank you
More information about the Devel
mailing list