KDEUI
#include <ktreewidgetsearchline.h>
Public Slots | |
void | addTreeWidget (QTreeWidget *treeWidget) |
void | removeTreeWidget (QTreeWidget *treeWidget) |
void | setCaseSensitivity (Qt::CaseSensitivity caseSensitivity) |
void | setKeepParentsVisible (bool value) |
void | setSearchColumns (const QList< int > &columns) |
void | setTreeWidget (QTreeWidget *treeWidget) |
void | setTreeWidgets (const QList< QTreeWidget * > &treeWidgets) |
virtual void | updateSearch (const QString &pattern=QString()) |
Public Slots inherited from KLineEdit | |
virtual void | clear () |
bool | passwordMode () const |
void | rotateText (KCompletionBase::KeyBindingType type) |
void | setCompletedItems (const QStringList &items, bool autoSuggest=true) |
virtual void | setCompletedText (const QString &) |
void | setPasswordMode (bool b=true) |
virtual void | setReadOnly (bool) |
void | setSqueezedText (const QString &text) |
virtual void | setText (const QString &) |
Signals | |
void | hiddenChanged (QTreeWidgetItem *, bool) |
Signals inherited from KLineEdit | |
void | aboutToShowContextMenu (QMenu *menu) |
void | clearButtonClicked () |
void | completion (const QString &) |
void | completionBoxActivated (const QString &) |
void | completionModeChanged (KGlobalSettings::Completion) |
void | returnPressed (const QString &) |
void | substringCompletion (const QString &) |
void | textRotation (KCompletionBase::KeyBindingType) |
QT_MOC_COMPAT void | userTextChanged (const QString &) |
Protected Member Functions | |
virtual bool | canChooseColumnsCheck () |
virtual void | connectTreeWidget (QTreeWidget *) |
virtual void | contextMenuEvent (QContextMenuEvent *) |
virtual void | disconnectTreeWidget (QTreeWidget *) |
virtual bool | event (QEvent *event) |
virtual bool | itemMatches (const QTreeWidgetItem *item, const QString &pattern) const |
virtual void | updateSearch (QTreeWidget *treeWidget) |
Protected Member Functions inherited from KLineEdit | |
bool | autoSuggest () const |
virtual void | create (WId=0, bool initializeWindow=true, bool destroyOldWindow=true) |
QMenu * | createStandardContextMenu () |
virtual void | dropEvent (QDropEvent *) |
virtual void | focusInEvent (QFocusEvent *ev) |
virtual void | focusOutEvent (QFocusEvent *ev) |
virtual void | keyPressEvent (QKeyEvent *) |
virtual void | mouseDoubleClickEvent (QMouseEvent *) |
virtual void | mousePressEvent (QMouseEvent *) |
virtual void | mouseReleaseEvent (QMouseEvent *) |
virtual void | paintEvent (QPaintEvent *ev) |
virtual void | resizeEvent (QResizeEvent *) |
virtual void | setCompletedText (const QString &, bool) |
void | setUserSelection (bool userSelection) |
Protected Member Functions inherited from KCompletionBase | |
KCompletionBase * | delegate () const |
KeyBindingMap | getKeyBindings () const |
void | setDelegate (KCompletionBase *delegate) |
virtual void | virtual_hook (int id, void *data) |
Properties | |
Qt::CaseSensitivity | caseSensitity |
bool | keepParentsVisible |
Properties inherited from KLineEdit | |
QString | clickMessage |
bool | contextMenuEnabled |
bool | passwordMode |
bool | showClearButton |
bool | squeezedTextEnabled |
bool | trapEnterKeyEvent |
bool | urlDropsEnabled |
Additional Inherited Members | |
Public Types inherited from KCompletionBase | |
typedef QMap< KeyBindingType, KShortcut > | KeyBindingMap |
enum | KeyBindingType { TextCompletion, PrevCompletionMatch, NextCompletionMatch, SubstringCompletion } |
Protected Slots inherited from KLineEdit | |
virtual void | makeCompletion (const QString &) |
void | userCancelled (const QString &cancelText) |
Detailed Description
This class makes it easy to add a search line for filtering the items in listviews based on a simple text search.
No changes to the application other than instantiating this class with appropriate QTreeWidgets should be needed.
Definition at line 38 of file ktreewidgetsearchline.h.
Constructor & Destructor Documentation
|
explicit |
Constructs a KTreeWidgetSearchLine with treeWidget being the QTreeWidget to be filtered.
If treeWidget is null then the widget will be disabled until listviews are set with setTreeWidget(), setTreeWidgets() or added with addTreeWidget().
Definition at line 218 of file ktreewidgetsearchline.cpp.
KTreeWidgetSearchLine::KTreeWidgetSearchLine | ( | QWidget * | parent, |
const QList< QTreeWidget * > & | treeWidgets | ||
) |
Constructs a KTreeWidgetSearchLine with treeWidgets being the list of pointers to QTreeWidgets to be filtered.
If treeWidgets is empty then the widget will be disabled until listviews are set with setTreeWidget(), setTreeWidgets() or added with addTreeWidget().
Definition at line 232 of file ktreewidgetsearchline.cpp.
|
virtual |
Destroys the KTreeWidgetSearchLine.
Definition at line 243 of file ktreewidgetsearchline.cpp.
Member Function Documentation
|
slot |
Adds a QTreeWidget to the list of listviews filtered by this search line.
If treeWidget is null then the widget will be disabled.
- See also
- treeWidget(), setTreeWidgets(), removeTreeWidget()
Definition at line 284 of file ktreewidgetsearchline.cpp.
|
protectedvirtual |
Checks columns in all listviews and decides whether choosing columns to filter on makes any sense.
Returns false if either of the following is true:
- there are no listviews connected,
- the listviews have different numbers of columns,
- the listviews have only one column,
- the listviews differ in column labels.
Otherwise it returns true.
- See also
- setSearchColumns()
Definition at line 483 of file ktreewidgetsearchline.cpp.
Qt::CaseSensitivity KTreeWidgetSearchLine::caseSensitivity | ( | ) | const |
Returns true if the search is case sensitive.
This defaults to false.
- See also
- setCaseSensitive()
Definition at line 248 of file ktreewidgetsearchline.cpp.
|
protectedvirtual |
Connects signals of this listview to the appropriate slots of the search line.
Definition at line 465 of file ktreewidgetsearchline.cpp.
|
protectedvirtual |
Re-implemented for internal reasons.
API not affected.
Reimplemented from KLineEdit.
Definition at line 414 of file ktreewidgetsearchline.cpp.
|
protectedvirtual |
Disconnects signals of a listviews from the search line.
Definition at line 474 of file ktreewidgetsearchline.cpp.
|
protectedvirtual |
Re-implemented for internal reasons.
API not affected.
Reimplemented from KLineEdit.
Definition at line 522 of file ktreewidgetsearchline.cpp.
|
signal |
This signal is emitted whenever an item gets hidden or unhidden due to it not matching or matching the search string.
|
protectedvirtual |
Returns true if item matches the search pattern.
This will be evaluated based on the value of caseSensitive(). This can be overridden in subclasses to implement more complicated matching schemes.
Definition at line 388 of file ktreewidgetsearchline.cpp.
bool KTreeWidgetSearchLine::keepParentsVisible | ( | ) | const |
If this is true (the default) then the parents of matched items will also be shown.
- See also
- setKeepParentsVisible()
|
slot |
Removes a QTreeWidget from the list of listviews filtered by this search line.
Does nothing if treeWidget is 0 or is not filtered by the quick search line.
- See also
- listVew(), setTreeWidgets(), addTreeWidget()
Definition at line 296 of file ktreewidgetsearchline.cpp.
QList< int > KTreeWidgetSearchLine::searchColumns | ( | ) | const |
Returns the current list of columns that will be searched.
If the returned list is empty all visible columns will be searched.
- See also
- setSearchColumns
Definition at line 253 of file ktreewidgetsearchline.cpp.
|
slot |
Make the search case sensitive or case insensitive.
- See also
- caseSenstivity()
Definition at line 341 of file ktreewidgetsearchline.cpp.
|
slot |
When a search is active on a list that's organized into a tree view if a parent or ancesestor of an item is does not match the search then it will be hidden and as such so too will any children that match.
If this is set to true (the default) then the parents of matching items will be shown.
- Warning
- setKeepParentsVisible(true) does not have the expected effect on items being added to or removed from the view while a search is active. When a new search starts afterwards the behavior will be normal.
- See also
- keepParentsVisible
Definition at line 349 of file ktreewidgetsearchline.cpp.
|
slot |
Sets the list of columns to be searched.
The default is to search all, visible columns which can be restored by passing columns as an empty list. If listviews to be filtered have different numbers or labels of columns this method has no effect.
- See also
- searchColumns
Definition at line 357 of file ktreewidgetsearchline.cpp.
|
slot |
Sets the QTreeWidget that is filtered by this search line, replacing any previously filtered listviews.
If treeWidget is null then the widget will be disabled.
- See also
- treeWidget(), setTreeWidgets()
Definition at line 363 of file ktreewidgetsearchline.cpp.
|
slot |
Sets QTreeWidgets that are filtered by this search line, replacing any previously filtered listviews.
If treeWidgets is empty then the widget will be disabled.
- See also
- treeWidgets(), addTreeWidget(), setTreeWidget()
Definition at line 369 of file ktreewidgetsearchline.cpp.
QTreeWidget * KTreeWidgetSearchLine::treeWidget | ( | ) | const |
Returns the listview that is currently filtered by the search.
If there are multiple listviews filtered, it returns 0.
- See also
- setTreeWidget(), treeWidgets()
Definition at line 266 of file ktreewidgetsearchline.cpp.
QList< QTreeWidget * > KTreeWidgetSearchLine::treeWidgets | ( | ) | const |
Returns the list of pointers to listviews that are currently filtered by the search.
- See also
- setTreeWidgets(), addTreeWidget(), treeWidget()
Definition at line 274 of file ktreewidgetsearchline.cpp.
Updates search to only make visible the items that match pattern.
If s is null then the line edit's text will be used.
Definition at line 312 of file ktreewidgetsearchline.cpp.
|
protectedvirtual |
Updates search to only make visible appropriate items in treeWidget.
If treeWidget is null then nothing is done.
Definition at line 320 of file ktreewidgetsearchline.cpp.
Property Documentation
|
readwrite |
Definition at line 42 of file ktreewidgetsearchline.h.
|
readwrite |
Definition at line 43 of file ktreewidgetsearchline.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.