#include <tpaginator.h>
The TPaginator class provides simple functionality for a pagination bar.
◆ TPaginator() [1/2]
TPaginator::TPaginator |
( |
int |
itemsTotal = 0 , |
|
|
int |
itemsPerPage = 10 , |
|
|
int |
midRange = 5 |
|
) |
| |
Constructs a TPaginator object using the parameters.
itemsTotal specifies the total number of items. itemsPerPage specifies the maximum number of items to be shown per page. midRange specifies the number of pages to show ‘around’ the current page on a pagination bar, and should be an odd number.
◆ TPaginator() [2/2]
TPaginator::TPaginator |
( |
const TPaginator & |
other | ) |
|
◆ ~TPaginator()
virtual TPaginator::~TPaginator |
( |
| ) |
|
|
inlinevirtual |
◆ calculateNumPages()
void TPaginator::calculateNumPages |
( |
| ) |
|
|
protected |
Calculates the total number of pages.
Internal use only.
◆ currentPage()
int TPaginator::currentPage |
( |
| ) |
const |
Returns the current page number.
◆ firstPage()
int TPaginator::firstPage |
( |
| ) |
const |
|
inline |
Returns the first page number, always 1.
◆ hasNext()
bool TPaginator::hasNext |
( |
| ) |
const |
|
inline |
Returns true if there is at least one page after the current page; otherwise returns false.
◆ hasPage()
bool TPaginator::hasPage |
( |
int |
page | ) |
const |
|
inline |
Returns true if page is a valid page; otherwise returns false.
◆ hasPrevious()
bool TPaginator::hasPrevious |
( |
| ) |
const |
|
inline |
Returns true if there is at least one page before the current page; otherwise returns false.
◆ itemCountOfCurrentPage()
int TPaginator::itemCountOfCurrentPage |
( |
| ) |
const |
Returns the number of items of current page.
◆ itemCountPerPage()
int TPaginator::itemCountPerPage |
( |
| ) |
const |
|
inline |
Returns the maximum number of items to be shown per page.
◆ itemTotalCount()
int TPaginator::itemTotalCount |
( |
| ) |
const |
|
inline |
Returns the total number of items.
◆ lastPage()
int TPaginator::lastPage |
( |
| ) |
const |
|
inline |
Returns the last page number.
◆ midRange()
int TPaginator::midRange |
( |
| ) |
const |
|
inline |
Returns the number of page numbers to be shown on a pagination bar.
◆ nextPage()
int TPaginator::nextPage |
( |
| ) |
const |
|
inline |
Returns the page number after the current page.
◆ numPages()
int TPaginator::numPages |
( |
| ) |
const |
|
inline |
Returns the total number of pages.
◆ offset()
int TPaginator::offset |
( |
| ) |
const |
Returns the number of items before the first item of the current page.
◆ operator=()
◆ previousPage()
int TPaginator::previousPage |
( |
| ) |
const |
|
inline |
Returns the page number before the current page.
◆ range()
QList< int > TPaginator::range |
( |
| ) |
const |
|
virtual |
Returns a list of page numbers to be shown on a pagination bar.
◆ setCurrentPage()
void TPaginator::setCurrentPage |
( |
int |
page | ) |
|
Sets the current page to page and recalculates other parameters.
◆ setItemCountPerPage()
void TPaginator::setItemCountPerPage |
( |
int |
count | ) |
|
Sets the maximum number of items to be shown per page to count, and recalculates other parameters.
◆ setItemTotalCount()
void TPaginator::setItemTotalCount |
( |
int |
total | ) |
|
Sets the total number of items to total and recalculates other parameters.
◆ setMidRange()
void TPaginator::setMidRange |
( |
int |
range | ) |
|
Sets the number of page numbers to range and recalculates other parameters.
The documentation for this class was generated from the following files: