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
- enum Modes { Index ,
List ,
Manual
}
- The three possible operation modes.
- KDataNavigator (QWidget* parent=0, const char* name=0)
- The Qt standard constructor.
- ~KDataNavigator ()
- The destructor.
- QSize sizeHint ()
- The size hint.
- void setMode (Modes mode)
- Select the mode the widget operates in.
- void setText (const char*)
- Set the text of the central lineedit in text mode.
- void setList (QStrList*)
- Set the list of strings displayed in the combobox in list mode.
- void setIndexMode (int begin, int end, int current)
- Enable index mode, giving the range and the current elements index.
- void showButtonNew (bool state)
- Hide or show the button for creating a new item.
- void enableButtonFirst (bool state)
- Hide or show button first.
- void enableButtonNext (bool state)
- Hide or show button next.
- void enableButtonPrevious (bool state)
- Hide or show button previous.
- void enableButtonLast (bool state)
- Hide or show button last.
- void enableButtonNew (bool state)
- Hide or show button new.
Signals
- void first ()
- Button first has been pressed.
- void previous ()
- Button previous has been pressed.
- void next ()
- Button next has been pressed.
- void last ()
- Button last has been pressed.
- void newItem ()
- Button new item has been pressed.
- void itemSelected (int)
- The item with the given index has been selected.
- void textChanged (const char*)
- Emitted in manual mode.
Protected Members
- void resizeEvent (QResizeEvent*)
- The resize event.
- void setLayout ()
- \internal.
- void enableButtons ()
- \internal.
- KButton* buttonFirst
- The button for selecting the first element.
- KButton* buttonPrevious
- The button for selecting the previous element.
- KButton* buttonNext
- The button for selecting the next element.
- KButton* buttonLast
- The button for selecting the last element.
- KButton* buttonNew
- The button for inserting a new element.
- QLineEdit* leIndex
- The lineedit displayed in manual mode.
- QSpinBox* sbIndex
- The spin box displayed in index mode.
- QComboBox* cbIndex
- The combobox display in list mode.
- int min
- The smallest possible index.
- int max
- The largest possible index.
- int current
- The current index.
- Modes mode
- The selected mode (default: Manual).
- bool buttonNewVisible
- Wether the new button is displayed.
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:
- A button displaying an icon for switching to the first element.
If it is clicked, first() is emitted.
- A button displaying an icon for switching to the previous element.
If it is clicked, previous() is emitted.
- 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:
- 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.
-
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.
-
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.
- A button displaying an icon for switching to the next element.
If it is clicked, next() is emitted.
- A button displaying an icon for switching to the last element.
If it is clicked, last() is emitted.
- 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()
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)
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]
void KDataNavigator::resizeEvent(QResizeEvent*) [protected]
void KDataNavigator::setLayout() [protected]
void KDataNavigator::enableButtons() [protected]
void KDataNavigator::buttonFirstClicked() [protected, slot]
void KDataNavigator::buttonPreviousClicked() [protected, slot]
void KDataNavigator::buttonNextClicked() [protected, slot]
void KDataNavigator::buttonLastClicked() [protected, slot]
void KDataNavigator::buttonNewClicked() [protected, slot]
void KDataNavigator::leTextChanged(const char*) [protected, slot]
void KDataNavigator::sbValueChanged(int) [protected, slot]
void KDataNavigator::cbItemSelected(int) [protected, slot]
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]
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
|