KDE 4.9 PyKDE API Reference

- KDE's Python API

# KPageView Class Reference

`from PyKDE4.kdeui import *`

Inherits: QWidget → QObject
Subclasses: KPageWidget

## Detailed Description

A base class which can handle multiple pages.

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 and Tabbed face types are available.

See also:
  KPageWidget

Example:\n

      KPageModel *model = new MyPageModel();

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

      view->setFaceType( KPageView.List );

Author:
  Tobias Koenig (tokoe@kde.org)

## Enumerations
FaceType | { Auto, Plain, List, Tree, Tabbed }
## Signals
| currentPageChanged (QModelIndex current, QModelIndex previous)
## Methods
| __init__ (self, QWidget parent=0)
QAbstractItemView | createView (self)
QModelIndex | currentPage (self)
KPageView.FaceType | faceType (self)
QAbstractItemDelegate | itemDelegate (self)
QAbstractItemModel | model (self)
| setCurrentPage (self, QModelIndex index)
| setDefaultWidget (self, QWidget widget)
| setFaceType (self, KPageView.FaceType faceType)
| setItemDelegate (self, QAbstractItemDelegate delegate)
| setModel (self, QAbstractItemModel model)
bool | showPageHeader (self)
Qt::Alignment | viewPosition (self)

## Signal Documentation

currentPageChanged | ( | QModelIndex | current,
|  | QModelIndex | previous
| ) |  |  |

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

Signal syntax:
  `QObject.connect(source, SIGNAL("currentPageChanged(const QModelIndex&, const QModelIndex&)"), target_slot)`

## Method Documentation

__init__ | ( | self, |
|  | QWidget | parent=0
| ) |  |  |

Creates a page view with given parent.

QAbstractItemView createView | ( |  | self ) |

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

This method can be reimplemented to provide custom navigation views.

QModelIndex currentPage | ( |  | self ) |

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

KPageView.FaceType faceType | ( |  | self ) |

Returns the face type of the page view.

QAbstractItemDelegate itemDelegate | ( |  | self ) |

Returns the item delegate of the page view.

QAbstractItemModel model | ( |  | self ) |

Returns the model of the page view.

setCurrentPage | ( | self, |
|  | QModelIndex | index
| ) |  |  |

Sets the page with

Parameters:

  | index | to be the current page and emits the See also: currentPageChanged signal.

setDefaultWidget | ( | self, |
|  | QWidget | widget
| ) |  |  |

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

setFaceType | ( | self, |
|  | KPageView.FaceType | faceType
| ) |  |  |

Sets the face type of the page view.

setItemDelegate | ( | self, |
|  | QAbstractItemDelegate | delegate
| ) |  |  |

Sets the item

Parameters:

  | delegate | which can be used customize the page view.

setModel | ( | self, |
|  | QAbstractItemModel | model
| ) |  |  |

Sets the model of the page view.

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

bool showPageHeader | ( |  | self ) |

Returns whether the page header should be visible.

This method can be reimplemented for adapting custom views.

Qt::Alignment viewPosition | ( |  | self ) |

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

This method can be reimplemented for adapting custom views.

## Enumeration Documentation

FaceType

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

- Auto - Depending on the number of pages in the model,
the Plain (one page), the List (several pages) or the Tree face (nested pages) will be used. This is the default face type.
- Plain - No navigation view will be visible and only the
first page of the model will be shown.

- List - An icon list is used as navigation view.

- Tree - A tree list is used as navigation view.

- Tabbed - A tab widget is used as navigation view.

Enumerator:

  Auto |
  Plain |
  List |
  Tree |
  Tabbed |