mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-28 22:53:09 +00:00
quicksettings: fix PaginateModel
This commit is contained in:
parent
2eb495a66b
commit
c07aa84f63
2 changed files with 5 additions and 5 deletions
|
|
@ -170,12 +170,15 @@ void PaginateModel::previousPage()
|
|||
|
||||
int PaginateModel::currentPage() const
|
||||
{
|
||||
if (d->m_pageSize == 0)
|
||||
return 0;
|
||||
|
||||
return d->m_firstItem / d->m_pageSize;
|
||||
}
|
||||
|
||||
int PaginateModel::pageCount() const
|
||||
{
|
||||
if (!d->m_sourceModel)
|
||||
if (!d->m_sourceModel || d->m_pageSize == 0)
|
||||
return 0;
|
||||
const int rc = d->m_sourceModel->rowCount();
|
||||
const int r = (rc % d->m_pageSize == 0) ? 1 : 0;
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
* SPDX-License-Identifier: LGPL-2.0-or-later
|
||||
*/
|
||||
|
||||
#ifndef PAGINATEMODEL_H
|
||||
#define PAGINATEMODEL_H
|
||||
#pragma once
|
||||
|
||||
#include <QAbstractListModel>
|
||||
|
||||
|
|
@ -118,5 +117,3 @@ private:
|
|||
class PaginateModelPrivate;
|
||||
QScopedPointer<PaginateModelPrivate> d;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue