KEditListBox Class Reference

`#include <keditlistbox.h>`

Inherits QGroupBox.

## Classes

class | CustomEditor

## Public Types

enum | Button { Add = 1, Remove = 2, UpDown = 4 }
enum | { All = Add|Remove|UpDown }

## Signals

void | changed ()
void | added (const QString &text)
void | removed (const QString &text)

## Public Member Functions

| KEditListBox (QWidget *parent=0, const char *name=0, bool checkAtEntering=false, int buttons=All)
| KEditListBox (const QString &title, QWidget *parent=0, const char *name=0, bool checkAtEntering=false, int buttons=All)
| KEditListBox (const QString &title, const CustomEditor &customEditor, QWidget *parent=0, const char *name=0, bool checkAtEntering=false, int buttons=All)
QListBox * | listBox () const
KLineEdit * | lineEdit () const
QPushButton * | addButton () const
QPushButton * | removeButton () const
QPushButton * | upButton () const
QPushButton * | downButton () const
int | count () const
void | insertStringList (const QStringList &list, int index=-1)
void | insertStrList (const QStrList *list, int index=-1)
void | insertStrList (const QStrList &list, int index=-1)
void | insertStrList (const char **list, int numStrings=-1, int index=-1)
void | insertItem (const QString &text, int index=-1)
void | clear ()
QString | text (int index) const
int | currentItem () const
QString | currentText () const
QStringList | items () const
void | setItems (const QStringList &items)
int | buttons () const
void | setButtons (uint buttons)

## Protected Slots

void | moveItemUp ()
void | moveItemDown ()
void | addItem ()
void | removeItem ()
void | enableMoveButtons (int index)
void | typedSomething (const QString &text)

## Protected Member Functions

virtual void | virtual_hook (int id, void *data)

## Properties

Button | buttons
QStringList | items

## Detailed Description

An editable listbox.

This class provides a editable listbox ;-), this means a listbox which is accompanied by a line edit to enter new items into the listbox and pushbuttons to add and remove items from the listbox and two buttons to move items up and down.

KDE Edit List Box Widget

Definition at line 44 of file keditlistbox.h.

## Member Enumeration Documentation

enum KEditListBox::Button

Enumeration of the buttons, the listbox offers.

Specify them in the constructor in the buttons parameter, or in setButtons.

Definition at line 95 of file keditlistbox.h.

## Constructor & Destructor Documentation

KEditListBox::KEditListBox | ( | QWidget * | parent = `0`,
|  | const char * | name = `0`,
|  | bool | checkAtEntering = `false`,
|  | int | buttons = `All`
| ) |  |

Create an editable listbox.

If `checkAtEntering` is true, after every character you type in the line edit KEditListBox will enable or disable the Add-button, depending whether the current content of the line edit is already in the listbox. Maybe this can become a performance hit with large lists on slow machines. If `checkAtEntering` is false, it will be checked if you press the Add-button. It is not possible to enter items twice into the listbox.

Definition at line 48 of file keditlistbox.cpp.

KEditListBox::KEditListBox | ( | const QString & | title,
|  | QWidget * | parent = `0`,
|  | const char * | name = `0`,
|  | bool | checkAtEntering = `false`,
|  | int | buttons = `All`
| ) |  |

Create an editable listbox.

The same as the other constructor, additionally it takes `title`, which will be the title of the frame around the listbox.

Definition at line 55 of file keditlistbox.cpp.

KEditListBox::KEditListBox | ( | const QString & | title,
|  | const CustomEditor & | customEditor,
|  | QWidget * | parent = `0`,
|  | const char * | name = `0`,
|  | bool | checkAtEntering = `false`,
|  | int | buttons = `All`
| ) |  |

Another constructor, which allows to use a custom editing widget instead of the standard KLineEdit widget.

E.g. you can use a KURLRequester or a KComboBox as input widget. The custom editor must consist of a lineedit and optionally another widget that is used as representation. A KComboBox or a KURLRequester have a KLineEdit as child-widget for example, so the KComboBox is used as the representation widget.

See also
  KURLRequester::customEditor()

Since
  3.1

Definition at line 62 of file keditlistbox.cpp.

## Member Function Documentation

QPushButton* KEditListBox::addButton | ( |  | ) | const

inline

Return a pointer to the Add button.

Definition at line 152 of file keditlistbox.h.

void KEditListBox::added | ( | const QString & | text | ) |

signal

This signal is emitted when the user adds a new string to the list, the parameter is the added string.

Since
  3.2

int KEditListBox::buttons | ( |  | ) | const

Returns which buttons are visible.

void KEditListBox::clear | ( |  | ) |

Clears both the listbox and the line edit.

Definition at line 357 of file keditlistbox.cpp.

int KEditListBox::count | ( |  | ) | const

inline

See QListBox::count()

Definition at line 169 of file keditlistbox.h.

int KEditListBox::currentItem | ( |  | ) | const

See QListBox::currentItem()

Definition at line 294 of file keditlistbox.cpp.

QString KEditListBox::currentText | ( |  | ) | const

inline

See QListBox::currentText()

Definition at line 205 of file keditlistbox.h.

QPushButton* KEditListBox::downButton | ( |  | ) | const

inline

Return a pointer to the Down button.

Definition at line 164 of file keditlistbox.h.

void KEditListBox::insertItem | ( | const QString & | text,
|  | int | index = `-1`
| ) |  |

inline

See QListBox::insertItem()

Definition at line 189 of file keditlistbox.h.

void KEditListBox::insertStringList | ( | const QStringList & | list,
|  | int | index = `-1`
| ) |  |

See QListBox::insertStringList()

Definition at line 364 of file keditlistbox.cpp.

void KEditListBox::insertStrList | ( | const QStrList * | list,
|  | int | index = `-1`
| ) |  |

See QListBox::insertStringList()

Definition at line 369 of file keditlistbox.cpp.

void KEditListBox::insertStrList | ( | const QStrList & | list,
|  | int | index = `-1`
| ) |  |

See QListBox::insertStrList()

Definition at line 374 of file keditlistbox.cpp.

void KEditListBox::insertStrList | ( | const char ** | list,
|  | int | numStrings = `-1`,
|  | int | index = `-1`
| ) |  |

See QListBox::insertStrList()

Definition at line 379 of file keditlistbox.cpp.

QStringList KEditListBox::items | ( |  | ) | const

Returns
  a stringlist of all items in the listbox

KLineEdit* KEditListBox::lineEdit | ( |  | ) | const

inline

Return a pointer to the embedded QLineEdit.

Definition at line 148 of file keditlistbox.h.

QListBox* KEditListBox::listBox | ( |  | ) | const

inline

Return a pointer to the embedded QListBox.

Definition at line 144 of file keditlistbox.h.

QPushButton* KEditListBox::removeButton | ( |  | ) | const

inline

Return a pointer to the Remove button.

Definition at line 156 of file keditlistbox.h.

void KEditListBox::removed | ( | const QString & | text | ) |

signal

This signal is emitted when the user removes a string from the list, the parameter is the removed string.

Since
  3.2

void KEditListBox::setButtons | ( | uint | buttons | ) |

Specifies which buttons should be visible.

Definition at line 117 of file keditlistbox.cpp.

void KEditListBox::setItems | ( | const QStringList & | items | ) |

Clears the listbox and sets the contents to `items`.

Since
  3.4

Definition at line 393 of file keditlistbox.cpp.

QString KEditListBox::text | ( | int | index | ) | const

inline

See QListBox::text()

Definition at line 197 of file keditlistbox.h.

QPushButton* KEditListBox::upButton | ( |  | ) | const

inline

Return a pointer to the Up button.

Definition at line 160 of file keditlistbox.h.

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

- keditlistbox.h
- keditlistbox.cpp

KDE Home | KDE Accessibility Home | Description of Access Keys