Compound list   Compound Members  

KDataNavigator Class Reference

The class KDataNavigator provides a widget for navigating through sets of data. More...

List of all members.

Public Members

Signals

Protected Members

Protected Slots


Detailed Description

The class KDataNavigator provides a widget for navigating through sets of data.


A KDataNavigator consists of six elements, some of them are displayed mandatory:

  1. A button displaying an icon for switching to the first element. If it is clicked, first() is emitted.
  2. A button displaying an icon for switching to the previous element. If it is clicked, previous() is emitted.
  3. A central element displaying a description of the current item. This element might be in either a lineedit, a combobox or a spinbox. The selected mode determines the type of the central element. The available modes are:
    1. The most simple mode is the manual mode. In this mode, the programmer that uses the class in his programs has to enable or disable the buttons when the first or the last element has been selected. The only help the class provides is the notification on button clicks since the program does not know about your first or last elements. The displayed text must be set using the setText() method. The central element is a non-editable lineedit.
    2. The second mode is the index mode. In index mode, the central element is a spinbox showing an integer number that is the index of the current element, and that is automatically updated when one of the navigation buttons is clicked. Call setIndexMode() to enable this mode, giving the range of element indices and the current index. If the user enters a number in the lineedit, the signal itemSelected() is emitted. All input is automatically validated by the class. The buttons are enabled or disabled according to the position in the data set, that means that the previous and the first buttons are disabled when the first element is displayed.
    3. The third mode is called list mode. In list mode, you define a list of values that is displayed in a combobox (as the central element). The class allows the user to navigate through the elements in the list, thereby automatically enabling or disabling the buttons that are useless.
  4. A button displaying an icon for switching to the next element. If it is clicked, next() is emitted.
  5. A button displaying an icon for switching to the last element. If it is clicked, last() is emitted.
  6. A button displaying an icon for creating a new element. If it is clicked, newItem() is emitted. This button might be hidden using the method showButtonNew(). Make sure you update the range for the indizes if a new item is really added!
The look of the widget heavily depends on the size of it. Thus you should respect its sizeHint() or at least the preferred height, since the central lineedit might be stretched horizontally.


Member Enumeration Type Documentation

enum KDataNavigator::Modes

The three possible operation modes.

Enumeration values:


Member Function Documentation

KDataNavigator::KDataNavigator(QWidget* parent=0, const char* name=0)

The Qt standard constructor.

KDataNavigator::~KDataNavigator()

The destructor.

QSize KDataNavigator::sizeHint()

The size hint.

The button width is fixed to 20.

void KDataNavigator::setMode(Modes mode)

Select the mode the widget operates in.

void KDataNavigator::setText(const char*)

Set the text of the central lineedit in text mode.

If you call setText(), the index mode is disabled.

void KDataNavigator::setList(QStrList*)

Set the list of strings displayed in the combobox in list mode.

void KDataNavigator::setIndexMode(int begin, int end, int current)

Enable index mode, giving the range and the current elements index.

If state is false, index mode is disabled.

void KDataNavigator::showButtonNew(bool state)

Hide or show the button for creating a new item.

void KDataNavigator::enableButtonFirst(bool state)

Hide or show button first.

void KDataNavigator::enableButtonNext(bool state)

Hide or show button next.

void KDataNavigator::enableButtonPrevious(bool state)

Hide or show button previous.

void KDataNavigator::enableButtonLast(bool state)

Hide or show button last.

void KDataNavigator::enableButtonNew(bool state)

Hide or show button new.

void KDataNavigator::first() [signal]

Button first has been pressed.

void KDataNavigator::previous() [signal]

Button previous has been pressed.

void KDataNavigator::next() [signal]

Button next has been pressed.

void KDataNavigator::last() [signal]

Button last has been pressed.

void KDataNavigator::newItem() [signal]

Button new item has been pressed.

void KDataNavigator::itemSelected(int) [signal]

The item with the given index has been selected.

void KDataNavigator::textChanged(const char*) [signal]

Emitted in manual mode.

void KDataNavigator::resizeEvent(QResizeEvent*) [protected]

The resize event.

void KDataNavigator::setLayout() [protected]

\internal.

void KDataNavigator::enableButtons() [protected]

\internal.

void KDataNavigator::buttonFirstClicked() [protected, slot]

\internal.

void KDataNavigator::buttonPreviousClicked() [protected, slot]

\internal.

void KDataNavigator::buttonNextClicked() [protected, slot]

\internal.

void KDataNavigator::buttonLastClicked() [protected, slot]

\internal.

void KDataNavigator::buttonNewClicked() [protected, slot]

\internal.

void KDataNavigator::leTextChanged(const char*) [protected, slot]

\internal.

void KDataNavigator::sbValueChanged(int) [protected, slot]

\internal.

void KDataNavigator::cbItemSelected(int) [protected, slot]

\internal.


Member Data Documentation

KButton* KDataNavigator::buttonFirst [protected]

The button for selecting the first element.

KButton* KDataNavigator::buttonPrevious [protected]

The button for selecting the previous element.

KButton* KDataNavigator::buttonNext [protected]

The button for selecting the next element.

KButton* KDataNavigator::buttonLast [protected]

The button for selecting the last element.

KButton* KDataNavigator::buttonNew [protected]

The button for inserting a new element.

QLineEdit* KDataNavigator::leIndex [protected]

The lineedit displayed in manual mode.

QSpinBox* KDataNavigator::sbIndex [protected]

The spin box displayed in index mode.

QComboBox* KDataNavigator::cbIndex [protected]

The combobox display in list mode.

int KDataNavigator::min [protected]

The smallest possible index.

int KDataNavigator::max [protected]

The largest possible index.

int KDataNavigator::current [protected]

The current index.

Modes KDataNavigator::mode [protected]

The selected mode (default: Manual).

bool KDataNavigator::buttonNewVisible [protected]

Wether the new button is displayed.


The documentation for this class was generated from the following file:

The KDE Addressbook Developers Reference 
Mirko Sucker, 1999