Cutelyst  2.5.0
Public Member Functions | Properties | List of all members
Cutelyst::Pagination Class Reference
Inheritance diagram for Cutelyst::Pagination:
Inheritance graph
[legend]

Public Member Functions

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

Properties

int currentPage
 
bool enableFirst
 
bool enableLast
 
int lastPage
 
int limit
 
int numberOfItems
 
int offset
 
QVector< int > pages
 

Detailed Description

Definition at line 26 of file pagination.h.

Constructor & Destructor Documentation

◆ Pagination()

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

Contructs a pagination object

Parameters
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

Definition at line 31 of file pagination.cpp.

References currentPage(), enableFirst(), enableLast(), lastPage(), limit(), numberOfItems(), offset(), and pages().

Member Function Documentation

◆ currentPage()

int Cutelyst::Pagination::currentPage ( ) const

Returns the current page number

Referenced by Pagination().

◆ enableFirst()

bool Cutelyst::Pagination::enableFirst ( ) const

Returns true if the first page link should be enabled

Referenced by Pagination().

◆ enableLast()

bool Cutelyst::Pagination::enableLast ( ) const

Returns true if the last page link should be enabled

Referenced by Pagination().

◆ lastPage()

int Cutelyst::Pagination::lastPage ( ) const

Returns the number of the last page

Referenced by Pagination().

◆ limit()

int Cutelyst::Pagination::limit ( ) const

Returns the number os items per page

Referenced by Pagination().

◆ numberOfItems()

int Cutelyst::Pagination::numberOfItems ( ) const

Returns the total number of items

Referenced by Pagination().

◆ offset()

int Cutelyst::Pagination::offset ( ) const

Returns the current page offset for use in SQL

Referenced by Pagination().

◆ pages()

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

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

Referenced by Pagination().