[KLF Backend][KLF Tools][KLF Home]
KLatexFormula Project
Public Member Functions
KLFItemViewSearchTarget Class Reference

A search target (for KLFSearchBar) for standard item views. More...

#include <klfitemviewsearchtarget.h>

Inheritance diagram for KLFItemViewSearchTarget:
Inheritance graph
[legend]
Collaboration diagram for KLFItemViewSearchTarget:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 KLFItemViewSearchTarget (QAbstractItemView *view, QObject *parent=NULL)
virtual ~KLFItemViewSearchTarget ()
QAbstractItemView * view ()
QList< int > searchColumns ()
virtual QModelIndex searchIterAdvance (const QModelIndex &pos, bool forward)
virtual QModelIndex searchIterBegin ()
virtual QModelIndex searchIterEnd ()
virtual bool searchIterMatches (const QModelIndex &pos, const QString &queryString)
virtual void searchPerformed (const QModelIndex &resultMatchPosition, bool found, const QString &queryString)
virtual void searchAborted ()
virtual void searchReinitialized ()
virtual void searchMoveToIterPos (const QModelIndex &pos)
void setSearchView (QAbstractItemView *view)
void setSearchColumns (const QList< int > &columnList)

Detailed Description

A search target (for KLFSearchBar) for standard item views.

Add search functionality to standard item views. Any item view you may have (QTreeView/QListView etc.) may be added search functionality with KLFSearchBar, using this class as search target.

For basic usage, you should not need to interact more with this class than simply instantiating it and feeding it to KLFSearchBar as the search target with KLFSearchBar::setSearchTarget().

Matches are displayed in highlighted red font, and current found item is displayed as selected.

Minimal example:

   QTableView * view = ...;
   KLFSearchBar * searchBar = new KLFSearchBar(...);
   KLFItemViewSearchTarget * searchTarget = new KLFItemViewSearchTarget(view, this);
   searchBar->setSearchTarget(searchTarget);
Todo:
Currently, to highlight search matches this class replaces the delegate with a custom delegate used to highlight search matches, thus relying on the fact that the default delegate is close to a standard QItemDelegate. TODO: define some "proxy" delegate, and just extend the delegate that is already set on the view.

Definition at line 60 of file klfitemviewsearchtarget.h.


Constructor & Destructor Documentation

KLFItemViewSearchTarget::KLFItemViewSearchTarget ( QAbstractItemView *  view,
QObject parent = NULL 
)

Definition at line 130 of file klfitemviewsearchtarget.cpp.

References KLF_INIT_PRIVATE, and setSearchView().

Definition at line 136 of file klfitemviewsearchtarget.cpp.

References KLF_DELETE_PRIVATE.


Member Function Documentation

Reimplemented from KLFIteratorSearchable< QModelIndex >.

Definition at line 212 of file klfitemviewsearchtarget.cpp.

References KLF_DEBUG_BLOCK, and KLF_FUNC_NAME.

Definition at line 146 of file klfitemviewsearchtarget.cpp.

QModelIndex KLFItemViewSearchTarget::searchIterAdvance ( const QModelIndex pos,
bool  forward 
) [virtual]

Implements KLFIteratorSearchable< QModelIndex >.

Definition at line 154 of file klfitemviewsearchtarget.cpp.

Implements KLFIteratorSearchable< QModelIndex >.

Definition at line 161 of file klfitemviewsearchtarget.cpp.

Implements KLFIteratorSearchable< QModelIndex >.

Definition at line 165 of file klfitemviewsearchtarget.cpp.

bool KLFItemViewSearchTarget::searchIterMatches ( const QModelIndex pos,
const QString queryString 
) [virtual]
void KLFItemViewSearchTarget::searchPerformed ( const QModelIndex resultMatchPosition,
bool  found,
const QString queryString 
) [virtual]

Reimplemented from KLFPosSearchable.

Definition at line 219 of file klfitemviewsearchtarget.cpp.

References KLF_DEBUG_BLOCK, and KLF_FUNC_NAME.

void KLFItemViewSearchTarget::setSearchColumns ( const QList< int > &  columnList)
void KLFItemViewSearchTarget::setSearchView ( QAbstractItemView *  view)
QAbstractItemView * KLFItemViewSearchTarget::view ( )

Definition at line 142 of file klfitemviewsearchtarget.cpp.

Referenced by setSearchView().


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

Generated by doxygen 1.7.6.1. The KLatexFormula website is hosted on sourceforge.net