cutelyst 3.9.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
Cutelyst::Pagination Class Reference
Inheritance diagram for Cutelyst::Pagination:

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

Static Public Member Functions

static int offset (int itemsPerPage, int currentPage)

Properties

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

Detailed Description

Definition at line 14 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 13 of file pagination.cpp.

References QVariant::fromValue().

◆ ~Pagination()

Pagination::~Pagination ( )
virtual

Definition at line 59 of file pagination.cpp.

Member Function Documentation

◆ currentPage()

int Pagination::currentPage ( ) const

Returns the current page number

Definition at line 87 of file pagination.cpp.

◆ enableFirst()

bool Pagination::enableFirst ( ) const

Returns true if the first page link should be enabled

Definition at line 102 of file pagination.cpp.

◆ enableLast()

bool Pagination::enableLast ( ) const

Returns true if the last page link should be enabled

Definition at line 107 of file pagination.cpp.

◆ lastPage()

int Pagination::lastPage ( ) const

Returns the number of the last page

Definition at line 92 of file pagination.cpp.

◆ limit()

int Pagination::limit ( ) const

Returns the number os items per page

Definition at line 63 of file pagination.cpp.

◆ numberOfItems()

int Pagination::numberOfItems ( ) const

Returns the total number of items

Definition at line 97 of file pagination.cpp.

◆ offset() [1/2]

int Pagination::offset ( ) const

Returns the current page offset for use in SQL

Definition at line 68 of file pagination.cpp.

◆ offset() [2/2]

int Pagination::offset ( int itemsPerPage,
int currentPage )
static

Returns the current page offset for use in SQL taking the number of items per page and the current page

Definition at line 73 of file pagination.cpp.

◆ pages()

QVector< int > Pagination::pages ( ) const

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

Definition at line 112 of file pagination.cpp.

References QVector::value().

Property Documentation

◆ currentPage

int Cutelyst::Pagination::currentPage
read

Definition at line 19 of file pagination.h.

◆ enableFirst

bool Cutelyst::Pagination::enableFirst
read

Definition at line 22 of file pagination.h.

◆ enableLast

bool Cutelyst::Pagination::enableLast
read

Definition at line 23 of file pagination.h.

◆ lastPage

int Cutelyst::Pagination::lastPage
read

Definition at line 20 of file pagination.h.

◆ limit

int Cutelyst::Pagination::limit
read

Definition at line 17 of file pagination.h.

◆ numberOfItems

int Cutelyst::Pagination::numberOfItems
read

Definition at line 21 of file pagination.h.

◆ offset

int Cutelyst::Pagination::offset
read

Definition at line 18 of file pagination.h.

◆ pages

QVector<int> Cutelyst::Pagination::pages
read

Definition at line 24 of file pagination.h.