Cutelyst  1.5.0
Public Member Functions | List of all members
Cutelyst::Pagination Class Reference
Inheritance diagram for Cutelyst::Pagination:
Inheritance graph

Public Member Functions

 Pagination (int numberOfItems, int itemsPerPage, int currentPage, int pageLinks=10)
int currentPage () const
int lastPage () const
int limit () const
int offset () const
QVector< int > pages () const

Detailed Description

Definition at line 27 of file pagination.h.

Constructor & Destructor Documentation

Cutelyst::Pagination::Pagination ( int  numberOfItems,
int  itemsPerPage,
int  currentPage,
int  pageLinks = 10 

Contructs a pagination object

numberOfItemsshould be set to the total of items to be displayed
itemsPerPagethe desired number of items per page
currentPagethe current 1 indexed page (first page is 1) usually from the query url
pageLinksthe number of page links that should be generated, for example 3 -> 11, 12, 13

Member Function Documentation

int Cutelyst::Pagination::currentPage ( ) const

Returns the current page number

int Cutelyst::Pagination::lastPage ( ) const

Returns the number of the last page

int Cutelyst::Pagination::limit ( ) const

Returns the number os items per page

int Cutelyst::Pagination::offset ( ) const

Returns the current page offset for use in SQL

QVector<int> Cutelyst::Pagination::pages ( ) const

Returns the list of pages, with each page number as the integer