broulik added inline comments.

INLINE COMMENTS

> slidefiltermodel.cpp:51
> +    if(sourceModel) {
> +        connect(sourceModel, &QAbstractItemModel::rowsInserted, this, 
> &SlideFilterModel::invalidate);
> +        connect(sourceModel, &QAbstractItemModel::rowsRemoved, this, 
> &SlideFilterModel::invalidate);

Perhaps only `invalidate` if order is actually set to random?

I am actually not sure we need to invalidate at all when inserting items, 
unless you want to shuffle every time that happens? Perhaps all we need to do 
is shrink/grow the random vector when new items are added?

> slidefiltermodel.cpp:121
> +{
> +    m_randomOrder.resize(sourceModel()->rowCount());
> +    std::iota(m_randomOrder.begin(), m_randomOrder.end(), 0);

Can `sourceModel()` be null here?

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D24723

To: davidre, #plasma
Cc: broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, 
GB_2, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, 
jensreuterberg, abetts, sebas, apol, ahiemstra, mart

Reply via email to