KEditListWidget

KDE 4.7 PyKDE API Reference

- KDE's Python API

# KEditListWidget Class Reference

`from PyKDE4.kdeui import *`

Inherits: QWidget → QObject

## Detailed Description

An editable listbox

This class provides an 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"

Since:
  4.6

## Enumerations
Button | { Add, Remove, UpDown, All }
## Signals
| added (QString text)
| changed ()
| removed (QString text)
## Methods
| __init__ (self, QWidget parent=0)
| __init__ (self, KEditListWidget.CustomEditor customEditor, QWidget parent=0, bool checkAtEntering=0, KEditListWidget.Buttons buttons=KEditListWidget.All)
QPushButton | addButton (self)
KEditListWidget.Buttons | buttons (self)
bool | checkAtEntering (self)
| clear (self)
int | count (self)
int | currentItem (self)
QString | currentText (self)
QPushButton | downButton (self)
bool | eventFilter (self, QObject o, QEvent e)
| insertItem (self, QString text, int index=-1)
| insertStringList (self, QStringList list, int index=-1)
QStringList | items (self)
KLineEdit | lineEdit (self)
QListView | listView (self)
QPushButton | removeButton (self)
| setButtons (self, KEditListWidget.Buttons buttons)
| setCheckAtEntering (self, bool check)
| setCustomEditor (self, KEditListWidget.CustomEditor editor)
| setItems (self, QStringList items)
QString | text (self, int index)
QPushButton | upButton (self)

## Signal Documentation

added | ( | QString | text
| ) |  |  |

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

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

changed | ( |  | ) |

Signal syntax:
  `QObject.connect(source, SIGNAL("changed()"), target_slot)`

removed | ( | QString | text
| ) |  |  |

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

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

## Method Documentation

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

Create an editable listbox.

__init__ | ( | self, |
|  | KEditListWidget.CustomEditor | customEditor,
|  | QWidget | parent=0,
|  | bool | checkAtEntering=0,
|  | KEditListWidget.Buttons | buttons=KEditListWidget.All
| ) |  |  |

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(), setCustomEditor

QPushButton addButton | ( |  | self ) |

Return a pointer to the Add button

KEditListWidget.Buttons buttons | ( |  | self ) |

Returns which buttons are visible

bool checkAtEntering | ( |  | self ) |

Returns true if check at entering is enabled.

clear | ( |  | self ) |

Clears both the listbox and the line edit.

int count | ( |  | self ) |

See Q3ListBox.count()

int currentItem | ( |  | self ) |

See Q3ListBox.currentItem()

QString currentText | ( |  | self ) |

See Q3ListBox.currentText()

QPushButton downButton | ( |  | self ) |

Return a pointer to the Down button

bool eventFilter | ( | self, |
|  | QObject | o,
|  | QEvent | e
| ) |  |  |

Reimplented for interal reasons. The API is not affected.

insertItem | ( | self, |
|  | QString | text,
|  | int | index=-1
| ) |  |  |

See Q3ListBox.insertItem()

insertStringList | ( | self, |
|  | QStringList | list,
|  | int | index=-1
| ) |  |  |

See Q3ListBox.insertStringList()

QStringList items | ( |  | self ) |

Returns:
  a stringlist of all items in the listbox

KLineEdit lineEdit | ( |  | self ) |

Return a pointer to the embedded KLineEdit.

QListView listView | ( |  | self ) |

Return a pointer to the embedded QListView.

QPushButton removeButton | ( |  | self ) |

Return a pointer to the Remove button

setButtons | ( | self, |
|  | KEditListWidget.Buttons | buttons
| ) |  |  |

Specifies which buttons should be visible

setCheckAtEntering | ( | self, |
|  | bool | check
| ) |  |  |

If check is true, after every character you type in the line edit KEditListWidget 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 check is false, it will be checked if you press the Add-button. It is not possible to enter items twice into the listbox. Default is false.

setCustomEditor | ( | self, |
|  | KEditListWidget.CustomEditor | editor
| ) |  |  |

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.

setItems | ( | self, |
|  | QStringList | items
| ) |  |  |

Clears the listbox and sets the contents to items

QString text | ( | self, |
|  | int | index
| ) |  |  |

See Q3ListBox.text()

QPushButton upButton | ( |  | self ) |

Return a pointer to the Up button

## Enumeration Documentation

Button

Enumeration of the buttons, the listbox offers. Specify them in the constructor in the buttons parameter, or in setButtons.

Enumerator:

  Add = 0x0001 |
  Remove = 0x0002 |
  UpDown = 0x0004 |
  All = Add|Remove|UpDown |