8 TPaginator(
int itemsTotal = 0,
int itemsPerPage = 10,
int midRange = 5);
15 void setItemTotalCount(
int total);
16 void setItemCountPerPage(
int count);
17 void setMidRange(
int range);
18 void setCurrentPage(
int page);
24 int itemCountOfCurrentPage()
const;
27 virtual QList<int> range()
const;
28 int currentPage()
const;
30 int previousPage()
const {
return std::max(currentPage() - 1, 1); }
31 int nextPage()
const {
return qMin(currentPage() + 1, _numPages); }
34 bool hasNext()
const {
return (currentPage() < _numPages); }
35 bool hasPage(
int page)
const {
return (page > 0 && page <= _numPages); }
38 void calculateNumPages();
42 int _itemsPerPage {10};
The TPaginator class provides simple functionality for a pagination bar.
Definition: tpaginator.h:6
int lastPage() const
Returns the last page number.
Definition: tpaginator.h:32
int midRange() const
Returns the number of page numbers to be shown on a pagination bar.
Definition: tpaginator.h:26
bool hasPage(int page) const
Returns true if page is a valid page; otherwise returns false.
Definition: tpaginator.h:35
virtual ~TPaginator()
Definition: tpaginator.h:10
int itemTotalCount() const
Returns the total number of items.
Definition: tpaginator.h:21
int previousPage() const
Returns the page number before the current page.
Definition: tpaginator.h:30
int numPages() const
Returns the total number of pages.
Definition: tpaginator.h:22
int firstPage() const
Returns the first page number, always 1.
Definition: tpaginator.h:29
int nextPage() const
Returns the page number after the current page.
Definition: tpaginator.h:31
int itemCountPerPage() const
Returns the maximum number of items to be shown per page.
Definition: tpaginator.h:23
bool hasNext() const
Returns true if there is at least one page after the current page; otherwise returns false.
Definition: tpaginator.h:34
bool hasPrevious() const
Returns true if there is at least one page before the current page; otherwise returns false.
Definition: tpaginator.h:33
#define T_CORE_EXPORT
Definition: tdeclexport.h:28