KDE 4.9 PyKDE API Reference

- KDE's Python API

# KListWidgetSearchLine Class Reference

`from PyKDE4.kdeui import *`

Inherits: KLineEdit → QLineEdit → QWidget → QObject

## Detailed Description

This class makes it easy to add a search line for filtering the items in a listwidget based on a simple text search.

No changes to the application other than instantiating this class with an appropriate QListWidget should be needed.

## Methods

| __init__ (self, QWidget parent=0, QListWidget listWidget=0)
Qt::CaseSensitivity | caseSensitive (self)
| clear (self)
bool | event (self, QEvent event)
bool | itemMatches (self, QListWidgetItem item, QString s)
QListWidget | listWidget (self)
| setCaseSensitivity (self, Qt::CaseSensitivity cs)
| setListWidget (self, QListWidget lv)
| updateSearch (self, QString s=QString())

## Method Documentation

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

Constructs a KListWidgetSearchLine with listWidget being the QListWidget to be filtered.

If listWidget is null then the widget will be disabled until a listWidget is set with setListWidget().

Qt::CaseSensitivity caseSensitive | ( |  | self ) |

Returns if the search is case sensitive. This defaults to Qt.CaseInsensitive.

See also:
  setCaseSensitive()

clear | ( |  | self ) |

Clear line edit and empty hiddenItems, returning elements to listWidget.

bool event | ( | self, |
|  | QEvent | event
| ) |  |  |

Re-implemented for internal reasons. API not affected.

bool itemMatches | ( | self, |
|  | QListWidgetItem | item,
|  | QString | s
| ) |  |  |

Returns true if item matches the search s. This will be evaluated based on the value of caseSensitive(). This can be overridden in subclasses to implement more complicated matching schemes.

QListWidget listWidget | ( |  | self ) |

Returns the listWidget that is currently filtered by the search.

See also:
  setListWidget()

setCaseSensitivity | ( | self, |
|  | Qt::CaseSensitivity | cs
| ) |  |  |

Make the search case sensitive or case insensitive.

See also:
  caseSenstive()

setListWidget | ( | self, |
|  | QListWidget | lv
| ) |  |  |

Sets the QListWidget that is filtered by this search line. If lv is null then the widget will be disabled.

See also:
  listWidget()

updateSearch | ( | self, |
|  | QString | s=QString()
| ) |  |  |

Updates search to only make visible the items that match s. If s is null then the line edit's text will be used.