KIconViewSearchLine Class Reference

`#include <kiconviewsearchline.h>`

Inheritance diagram for KIconViewSearchLine:

## Public Slots

virtual void | updateSearch (const QString &s=QString::null)
void | setCaseSensitive (bool cs)
void | setIconView (QIconView *iv)
void | clear ()
Public Slots inherited from KLineEdit
virtual void | setReadOnly (bool)
void | rotateText (KCompletionBase::KeyBindingType type)
virtual void | setCompletedText (const QString &)
void | setCompletedItems (const QStringList &items)
void | setCompletedItems (const QStringList &items, bool autoSuggest)
virtual void | clear ()
void | setSqueezedText (const QString &text)
virtual void | setText (const QString &)

## Public Member Functions

| KIconViewSearchLine (QWidget *parent=0, QIconView *iconView=0, const char *name=0)
| KIconViewSearchLine (QWidget *parent, const char *name)
virtual | ~KIconViewSearchLine ()
bool | caseSensitive () const
QIconView * | iconView () const
Public Member Functions inherited from KLineEdit
| KLineEdit (const QString &string, QWidget *parent, const char *name=0)
| KLineEdit (QWidget *parent=0, const char *name=0)
virtual | ~KLineEdit ()
void | setURL (const KURL &url)
void | cursorAtEnd ()
virtual void | setCompletionMode (KGlobalSettings::Completion mode)
virtual void | setContextMenuEnabled (bool showMenu)
bool | isContextMenuEnabled () const
void | setURLDropsEnabled (bool enable)
bool | isURLDropsEnabled () const
void | setTrapReturnKey (bool trap)
bool | trapReturnKey () const
virtual bool | eventFilter (QObject *, QEvent *)
KCompletionBox * | completionBox (bool create=true)
virtual void | setCompletionObject (KCompletion *, bool hsig=true)
virtual void | copy () const
void | setEnableSqueezedText (bool enable)
bool | isSqueezedTextEnabled () const
QString | originalText () const
void | setCompletionBox (KCompletionBox *box)
void | setClickMessage (const QString &msg)
QString | clickMessage () const
Public Member Functions inherited from KCompletionBase
KCompletion * | completionObject (bool hsig=true)
virtual void | setHandleSignals (bool handle)
bool | isCompletionObjectAutoDeleted () const
void | setAutoDeleteCompletionObject (bool autoDelete)
void | setEnableSignals (bool enable)
bool | handleSignals () const
bool | emitSignals () const
KGlobalSettings::Completion | completionMode () const
bool | setKeyBinding (KeyBindingType item, const KShortcut &key)
const KShortcut & | getKeyBinding (KeyBindingType item) const
void | useGlobalKeyBindings ()
virtual void | setCompletedText (const QString &text)=0
virtual void | setCompletedItems (const QStringList &items)=0
KCompletion * | compObj () const

## Protected Slots

void | queueSearch (const QString &s)
void | activateSearch ()
Protected Slots inherited from KLineEdit
virtual void | makeCompletion (const QString &)
void | slotAboutToShow ()
void | slotCancelled ()
void | userCancelled (const QString &cancelText)

## Protected Member Functions

virtual bool | itemMatches (const QIconViewItem *item, const QString &s) const
void | init (QIconView *iconView=0)
void | hideItem (QIconViewItem *item)
void | showItem (QIconViewItem *item)
Protected Member Functions inherited from KLineEdit
virtual void | resizeEvent (QResizeEvent *)
virtual void | keyPressEvent (QKeyEvent *)
virtual void | mousePressEvent (QMouseEvent *)
virtual void | mouseDoubleClickEvent (QMouseEvent *)
virtual void | mouseReleaseEvent (QMouseEvent *)
virtual void | contextMenuEvent (QContextMenuEvent *)
virtual QPopupMenu * | createPopupMenu ()
virtual void | drawContents (QPainter *p)
virtual void | dropEvent (QDropEvent *)
virtual void | setCompletedText (const QString &, bool)
void | setUserSelection (bool userSelection)
virtual void | create (WId=0, bool initializeWindow=true, bool destroyOldWindow=true)
virtual void | focusInEvent (QFocusEvent *)
virtual void | focusOutEvent (QFocusEvent *)
bool | autoSuggest () const
virtual void | virtual_hook (int id, void *data)
Protected Member Functions inherited from KCompletionBase
KeyBindingMap | getKeyBindings () const
void | setDelegate (KCompletionBase *delegate)
KCompletionBase * | delegate () const

## Additional Inherited Members

Public Types inherited from KCompletionBase
enum | KeyBindingType
Signals inherited from KLineEdit
void | completionBoxActivated (const QString &)
void | returnPressed (const QString &)
void | completion (const QString &)
void | substringCompletion (const QString &)
void | textRotation (KCompletionBase::KeyBindingType)
void | completionModeChanged (KGlobalSettings::Completion)
void | aboutToShowContextMenu (QPopupMenu *p)
Properties inherited from KLineEdit
bool | contextMenuEnabled
bool | urlDropsEnabled
bool | trapEnterKeyEvent
bool | enableSqueezedText
QString | clickMessage

## Detailed Description

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

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

Since
  3.3

Definition at line 38 of file kiconviewsearchline.h.

## Constructor & Destructor Documentation

KIconViewSearchLine::KIconViewSearchLine | ( | QWidget * | parent = `0`,
|  | QIconView * | iconView = `0`,
|  | const char * | name = `0`
| ) |  |

Constructs a KIconViewSearchLine with iconView being the QIconView to be filtered.

If iconView is null then the widget will be disabled until a iconview is set with setIconView().

Definition at line 57 of file kiconviewsearchline.cpp.

KIconViewSearchLine::KIconViewSearchLine | ( | QWidget * | parent,
|  | const char * | name
| ) |  |

Constructs a KIconViewSearchLine without any QIconView to filter.

The QIconView object has to be set later with setIconView().

Definition at line 66 of file kiconviewsearchline.cpp.

KIconViewSearchLine::~KIconViewSearchLine | ( |  | ) |

virtual

Destroys the KIconViewSearchLine.

Definition at line 73 of file kiconviewsearchline.cpp.

## Member Function Documentation

void KIconViewSearchLine::activateSearch | ( |  | ) |

protected slot

When the timer started with queueSearch() expires this slot is called.

If there has been another timer started then this slot does nothing. However if there are no other pending searches this starts the icon view search.

See also
  queueSearch()

Definition at line 254 of file kiconviewsearchline.cpp.

bool KIconViewSearchLine::caseSensitive | ( |  | ) | const

Returns true if the search is case sensitive.

This defaults to false.

See also
  setCaseSensitive()

Definition at line 79 of file kiconviewsearchline.cpp.

void KIconViewSearchLine::clear | ( |  | ) |

slot

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

Definition at line 137 of file kiconviewsearchline.cpp.

void KIconViewSearchLine::hideItem | ( | QIconViewItem * | item | ) |

protected

Hide item.

Definition at line 222 of file kiconviewsearchline.cpp.

QIconView * KIconViewSearchLine::iconView | ( |  | ) | const

Returns the iconview that is currently filtered by the search.

See also
  setIconView()

Definition at line 84 of file kiconviewsearchline.cpp.

void KIconViewSearchLine::init | ( | QIconView * | iconView = `0` | ) |

protected

Do initialization common to both constructors.

Definition at line 202 of file kiconviewsearchline.cpp.

bool KIconViewSearchLine::itemMatches | ( | const QIconViewItem * | item,
|  | const QString & | s
| ) |  | const

protected virtual

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.

Definition at line 190 of file kiconviewsearchline.cpp.

void KIconViewSearchLine::queueSearch | ( | const QString & | s | ) |

protected slot

When keys are pressed a new search string is created and a timer is activated.

The most recent search is activated when this timer runs out if another key has not yet been pressed.

This method makes

Parameters

  s | the most recent search and starts the timer.

Together with activateSearch() this makes it such that searches are not started until there is a short break in the users typing.

See also
  activateSearch()

Definition at line 247 of file kiconviewsearchline.cpp.

void KIconViewSearchLine::setCaseSensitive | ( | bool | cs | ) |

slot

Make the search case sensitive or case insensitive.

See also
  caseSenstive()

Definition at line 164 of file kiconviewsearchline.cpp.

void KIconViewSearchLine::setIconView | ( | QIconView * | iv | ) |

slot

Sets the QIconView that is filtered by this search line.

If lv is null then the widget will be disabled.

See also
  iconView()

Definition at line 169 of file kiconviewsearchline.cpp.

void KIconViewSearchLine::showItem | ( | QIconViewItem * | item | ) |

protected

Show item.

Just unhide it, doesn't necessary show it on screen, for that use iconView->ensureItemVisible()

Definition at line 231 of file kiconviewsearchline.cpp.

void KIconViewSearchLine::updateSearch | ( | const QString & | s = `QString::null` | ) |

virtual slot

Updates search to only make visible the items that match s.

If s is null then the line edit's text will be used.

Definition at line 92 of file kiconviewsearchline.cpp.

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

- kiconviewsearchline.h
- kiconviewsearchline.cpp

KDE Home | KDE Accessibility Home | Description of Access Keys