KEditListWidget Class Reference
from PyKDE5.kwidgetsaddons 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.Button.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) |
QLineEdit | 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
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)
- Signal syntax:
QObject.connect(source, SIGNAL("changed()"), target_slot)
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.Button.All |
|
) |
|
|
|
Constructor which allows to use a custom editing widget
instead of the standard QLineEdit widget. E.g. you can use a
KUrlRequester or a QComboBox as input widget. The custom
editor must consist of a lineedit and optionally another widget that
is used as representation. A QComboBox or a KUrlRequester have a
QLineEdit as child-widget for example, so the QComboBox is used as
the representation widget.
- See also:
- KUrlRequester.customEditor(), setCustomEditor
QPushButton addButton |
( |
|
self ) |
|
- Returns:
- 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.
Clears both the listbox and the line edit.
- Returns:
- the count of elements in the list
- Returns:
- the currently selected item
QString currentText |
( |
|
self ) |
|
- Returns:
- the currently selected item's text
QPushButton downButton |
( |
|
self ) |
|
- Returns:
- 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 |
|
) |
|
|
|
Inserts a text element at the index position
If index is negative, the element will be appended
insertStringList |
( |
self, |
|
|
|
QStringList |
list, |
|
|
int |
index=-1 |
|
) |
|
|
|
Inserts a list of elements from the index element
If index is negative, the elements will be appended
QStringList items |
( |
|
self ) |
|
- Returns:
- a list with the text of all items in the listbox
QLineEdit lineEdit |
( |
|
self ) |
|
- Returns:
- a pointer to the embedded QLineEdit.
QListView listView |
( |
|
self ) |
|
- Returns:
- a pointer to the embedded QListView.
QPushButton removeButton |
( |
|
self ) |
|
- Returns:
- a pointer to the Remove button
setButtons |
( |
self, |
|
|
|
KEditListWidget::Buttons |
buttons |
|
) |
|
|
|
Specifies which buttons are 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 QLineEdit widget. E.g. you can use a
KUrlRequester or a QComboBox as input widget. The custom
editor must consist of a lineedit and optionally another widget that
is used as representation. A QComboBox or a KUrlRequester have a
QLineEdit as child-widget for example, so the QComboBox is used as
the representation widget.
setItems |
( |
self, |
|
|
|
QStringList |
items |
|
) |
|
|
|
Clears the listbox and sets the contents to items
QString text |
( |
self, |
|
|
|
int |
index |
|
) |
|
|
|
- Returns:
- the text at the index position
QPushButton upButton |
( |
|
self ) |
|
- Returns:
- a pointer to the Up button
Enumeration Documentation
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 | |