Pages
API Documentation
On this page

KPageView Class

A base class which can handle multiple pages. More...

  • Header: #include <KPageView>
  • CMake: find_package(KF6 REQUIRED COMPONENTS WidgetsAddons)
    target_link_libraries(mytarget PRIVATE KF6::WidgetsAddons)
  • Inherits: QWidget
  • Inherited By: KPageWidget

List of all members, including inherited members

Public Types

Properties

Public Functions

Signals

Protected Functions

Detailed Description

This class provides a widget base class which handles multiple pages and allows the user to switch between these pages in different ways.

Currently, Auto, Plain, List, Tree, FlatList and Tabbed face types are available (cmp. KPageWidget).

Example:

KPageModel *model = new MyPageModel();

auto view = new KPageView(this);
view->setModel(model);

view->setFaceType(KPageView::List);

Member Type Documentation

enum KPageView::FaceType

This enum is used to decide which type of navigation view shall be used in the page view.

Constant Value Description
KPageView::Auto 0 Depending on the number of pages in the model, the Plain (one page), the List (several pages) the Tree face (nested pages) will be used. This is the default face type.
KPageView::Plain 1 No navigation view will be visible and only the first page of the model will be shown.
KPageView::List 2 An icon list is used as navigation view
KPageView::Tree 3 A tree list is used as navigation view
KPageView::Tabbed 4 A tab widget is used as navigation view
KPageView::FlatList 5 A flat list with small icons is used as navigation view

Property Documentation

faceType : FaceType

Access functions:

Access functions:

pageHeader : QWidget*

Access functions:

Member Function Documentation

[explicit] KPageView::KPageView(QWidget *parent = nullptr)

Creates a page view with given parent.

[virtual protected] QAbstractItemView *KPageView::createView()

Returns the navigation view, depending on the current face type.

This method can be reimplemented to provide custom navigation views.

QModelIndex KPageView::currentPage() const

Returns the index for the current page or an invalid index if no current page exists.

See also setCurrentPage()

[signal] void KPageView::currentPageChanged(const QModelIndex &current, const QModelIndex &previous)

This signal is emitted whenever the current page changes. The previous page index is replaced by the current index.

KPageView::FaceType KPageView::faceType() const

Returns the face type of the page view.

Note: Getter function for property faceType.

See also setFaceType()

QAbstractItemDelegate *KPageView::itemDelegate() const

Returns the item delegate of the page view.

See also setItemDelegate()

QAbstractItemModel *KPageView::model() const

Returns the model of the page view.

See also setModel()

Widget of the footer for this page view

Note: Getter function for property pageFooter.

See also setPageFooter()

Widget of the header for this page view

Note: Getter function for property pageHeader.

See also setPageHeader()

void KPageView::setCurrentPage(const QModelIndex &index)

Sets the page with index to be the current page and emits the signal currentPageChanged.

See also currentPage()

void KPageView::setDefaultWidget(QWidget *widget)

Sets the widget which will be shown when a page is selected that has no own widget set.

void KPageView::setFaceType(KPageView::FaceType faceType)

Sets the face type of the page view.

Note: Setter function for property faceType.

See also faceType()

void KPageView::setItemDelegate(QAbstractItemDelegate *delegate)

Sets the item delegate which can be used customize the page view.

See also itemDelegate()

void KPageView::setModel(QAbstractItemModel *model)

Sets the model of the page view.

The model has to provide data for the roles defined in KPageModel::Role.

See also model()

void KPageView::setPageFooter(QWidget *footer)

Set a widget as the footer for this Page view

Note: Setter function for property pageFooter.

See also pageFooter()

void KPageView::setPageHeader(QWidget *header)

Set a widget as the header for this Page view It will replace the standard page title

Note: Setter function for property pageHeader.

See also pageHeader()

[virtual protected] bool KPageView::showPageHeader() const

Returns whether the page header should be visible.

This method can be reimplemented for adapting custom views.

[virtual protected] Qt::Alignment KPageView::viewPosition() const

Returns the position where the navigation view should be located according to the page stack.

This method can be reimplemented for adapting custom views.

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.