\section{KList\-View\-Search\-Line Class Reference}
\label{classKListViewSearchLine}\index{KListViewSearchLine@{KListViewSearchLine}}
This class makes it easy to add a search line for filtering the items in a listview based on a simple text search.  


{\tt \#include $<$klistviewsearchline.h$>$}

Inheritance diagram for KList\-View\-Search\-Line:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=105pt]{classKListViewSearchLine__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KList\-View\-Search\-Line:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=105pt]{classKListViewSearchLine__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Slots}
\begin{CompactItemize}
\item 
virtual void {\bf update\-Search} (const {\bf QString} \&s=QString::null)
\item 
void {\bf set\-Case\-Sensitive} (bool cs)
\item 
void {\bf set\-Keep\-Parents\-Visible} (bool v)
\item 
void {\bf set\-Search\-Columns} (const {\bf QValue\-List}$<$ int $>$ \&columns)
\item 
void {\bf set\-List\-View} ({\bf KList\-View} $\ast$lv)
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KList\-View\-Search\-Line} ({\bf QWidget} $\ast$parent=0, {\bf KList\-View} $\ast$list\-View=0, const char $\ast$name=0)
\item 
{\bf KList\-View\-Search\-Line} ({\bf QWidget} $\ast$parent, const char $\ast$name)
\item 
virtual {\bf $\sim$KList\-View\-Search\-Line} ()
\item 
bool {\bf case\-Sensitive} () const 
\item 
{\bf QValue\-List}$<$ int $>$ {\bf search\-Columns} () const 
\item 
bool {\bf keep\-Parents\-Visible} () const 
\item 
{\bf KList\-View} $\ast$ {\bf list\-View} () const 
\end{CompactItemize}
\subsection*{Protected Slots}
\begin{CompactItemize}
\item 
void {\bf queue\-Search} (const {\bf QString} \&search)
\item 
void {\bf activate\-Search} ()
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual bool {\bf item\-Matches} (const {\bf QList\-View\-Item} $\ast$item, const {\bf QString} \&s) const 
\item 
virtual {\bf QPopup\-Menu} $\ast$ {\bf create\-Popup\-Menu} ()
\end{CompactItemize}


\subsection{Detailed Description}
This class makes it easy to add a search line for filtering the items in a listview based on a simple text search. 

No changes to the application other than instantiating this class with an appropriate {\bf KList\-View}{\rm (p.\,\pageref{classKListView})} should be needed.

\begin{Desc}
\item[Since:]3.3 \end{Desc}




Definition at line 39 of file klistviewsearchline.h.

\subsection{Constructor \& Destructor Documentation}
\index{KListViewSearchLine@{KList\-View\-Search\-Line}!KListViewSearchLine@{KListViewSearchLine}}
\index{KListViewSearchLine@{KListViewSearchLine}!KListViewSearchLine@{KList\-View\-Search\-Line}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KList\-View\-Search\-Line::KList\-View\-Search\-Line ({\bf QWidget} $\ast$ {\em parent} = {\tt 0}, {\bf KList\-View} $\ast$ {\em list\-View} = {\tt 0}, const char $\ast$ {\em name} = {\tt 0})}\label{classKListViewSearchLine_a0}


Constructs a KList\-View\-Search\-Line with {\em list\-View\/} being the {\bf KList\-View}{\rm (p.\,\pageref{classKListView})} to be filtered. 

If {\em list\-View\/} is null then the widget will be disabled until a listview is set with {\bf set\-List\-View()}{\rm (p.\,\pageref{classKListViewSearchLine_i4})}. 

Definition at line 59 of file klistviewsearchline.cpp.

References list\-View(), queue\-Search(), and QLine\-Edit::text\-Changed().\index{KListViewSearchLine@{KList\-View\-Search\-Line}!KListViewSearchLine@{KListViewSearchLine}}
\index{KListViewSearchLine@{KListViewSearchLine}!KListViewSearchLine@{KList\-View\-Search\-Line}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KList\-View\-Search\-Line::KList\-View\-Search\-Line ({\bf QWidget} $\ast$ {\em parent}, const char $\ast$ {\em name})}\label{classKListViewSearchLine_a1}


Constructs a KList\-View\-Search\-Line without any {\bf KList\-View}{\rm (p.\,\pageref{classKListView})} to filter. 

The {\bf KList\-View}{\rm (p.\,\pageref{classKListView})} object has to be set later with {\bf set\-List\-View()}{\rm (p.\,\pageref{classKListViewSearchLine_i4})}. 

Definition at line 80 of file klistviewsearchline.cpp.

References queue\-Search(), and QLine\-Edit::text\-Changed().\index{KListViewSearchLine@{KList\-View\-Search\-Line}!~KListViewSearchLine@{$\sim$KListViewSearchLine}}
\index{~KListViewSearchLine@{$\sim$KListViewSearchLine}!KListViewSearchLine@{KList\-View\-Search\-Line}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KList\-View\-Search\-Line::$\sim${\bf KList\-View\-Search\-Line} ()\hspace{0.3cm}{\tt  [virtual]}}\label{classKListViewSearchLine_a2}


Destroys the KList\-View\-Search\-Line. 



Definition at line 93 of file klistviewsearchline.cpp.

\subsection{Member Function Documentation}
\index{KListViewSearchLine@{KList\-View\-Search\-Line}!caseSensitive@{caseSensitive}}
\index{caseSensitive@{caseSensitive}!KListViewSearchLine@{KList\-View\-Search\-Line}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KList\-View\-Search\-Line::case\-Sensitive () const}\label{classKListViewSearchLine_a3}


Returns true if the search is case sensitive. 

This defaults to false.

\begin{Desc}
\item[See also:]{\bf set\-Case\-Sensitive()}{\rm (p.\,\pageref{classKListViewSearchLine_i1})} \end{Desc}


Definition at line 98 of file klistviewsearchline.cpp.\index{KListViewSearchLine@{KList\-View\-Search\-Line}!searchColumns@{searchColumns}}
\index{searchColumns@{searchColumns}!KListViewSearchLine@{KList\-View\-Search\-Line}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QValue\-List}$<$ int $>$ KList\-View\-Search\-Line::search\-Columns () const}\label{classKListViewSearchLine_a4}


Returns the current list of columns that will be searched. 

If the returned list is empty all visible columns will be searched.

\begin{Desc}
\item[See also:]{\bf set\-Search\-Columns}{\rm (p.\,\pageref{classKListViewSearchLine_i3})} \end{Desc}


Definition at line 103 of file klistviewsearchline.cpp.\index{KListViewSearchLine@{KList\-View\-Search\-Line}!keepParentsVisible@{keepParentsVisible}}
\index{keepParentsVisible@{keepParentsVisible}!KListViewSearchLine@{KList\-View\-Search\-Line}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KList\-View\-Search\-Line::keep\-Parents\-Visible () const}\label{classKListViewSearchLine_a5}


If this is true (the default) then the parents of matched items will also be shown. 

\begin{Desc}
\item[See also:]{\bf set\-Keep\-Parents\-Visible()}{\rm (p.\,\pageref{classKListViewSearchLine_i2})} \end{Desc}


Definition at line 108 of file klistviewsearchline.cpp.\index{KListViewSearchLine@{KList\-View\-Search\-Line}!listView@{listView}}
\index{listView@{listView}!KListViewSearchLine@{KList\-View\-Search\-Line}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KList\-View} $\ast$ KList\-View\-Search\-Line::list\-View () const}\label{classKListViewSearchLine_a6}


Returns the listview that is currently filtered by the search. 

\begin{Desc}
\item[See also:]{\bf set\-List\-View()}{\rm (p.\,\pageref{classKListViewSearchLine_i4})} \end{Desc}


Definition at line 113 of file klistviewsearchline.cpp.

Referenced by KList\-View\-Search\-Line().\index{KListViewSearchLine@{KList\-View\-Search\-Line}!updateSearch@{updateSearch}}
\index{updateSearch@{updateSearch}!KListViewSearchLine@{KList\-View\-Search\-Line}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KList\-View\-Search\-Line::update\-Search (const {\bf QString} \& {\em s} = {\tt QString::null})\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKListViewSearchLine_i0}


Updates search to only make visible the items that match {\em s\/}. 

If {\em s\/} is null then the line edit's text will be used. 

Definition at line 122 of file klistviewsearchline.cpp.

References QList\-View\-Item::list\-View(), and QLine\-Edit::text().

Referenced by activate\-Search().\index{KListViewSearchLine@{KList\-View\-Search\-Line}!setCaseSensitive@{setCaseSensitive}}
\index{setCaseSensitive@{setCaseSensitive}!KListViewSearchLine@{KList\-View\-Search\-Line}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KList\-View\-Search\-Line::set\-Case\-Sensitive (bool {\em cs})\hspace{0.3cm}{\tt  [slot]}}\label{classKListViewSearchLine_i1}


Make the search case sensitive or case insensitive. 

\begin{Desc}
\item[See also:]case\-Senstive() \end{Desc}


Definition at line 163 of file klistviewsearchline.cpp.\index{KListViewSearchLine@{KList\-View\-Search\-Line}!setKeepParentsVisible@{setKeepParentsVisible}}
\index{setKeepParentsVisible@{setKeepParentsVisible}!KListViewSearchLine@{KList\-View\-Search\-Line}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KList\-View\-Search\-Line::set\-Keep\-Parents\-Visible (bool {\em v})\hspace{0.3cm}{\tt  [slot]}}\label{classKListViewSearchLine_i2}


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.

\begin{Desc}
\item[See also:]{\bf keep\-Parents\-Visible}{\rm (p.\,\pageref{classKListViewSearchLine_a5})} \end{Desc}


Definition at line 168 of file klistviewsearchline.cpp.\index{KListViewSearchLine@{KList\-View\-Search\-Line}!setSearchColumns@{setSearchColumns}}
\index{setSearchColumns@{setSearchColumns}!KListViewSearchLine@{KList\-View\-Search\-Line}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KList\-View\-Search\-Line::set\-Search\-Columns (const {\bf QValue\-List}$<$ int $>$ \& {\em columns})\hspace{0.3cm}{\tt  [slot]}}\label{classKListViewSearchLine_i3}


Sets the list of columns to be searched. 

The default is to search all, visible columns which can be restored by passing {\em columns\/} as an empty list.

\begin{Desc}
\item[See also:]{\bf search\-Columns}{\rm (p.\,\pageref{classKListViewSearchLine_a4})} \end{Desc}


Definition at line 173 of file klistviewsearchline.cpp.\index{KListViewSearchLine@{KList\-View\-Search\-Line}!setListView@{setListView}}
\index{setListView@{setListView}!KListViewSearchLine@{KList\-View\-Search\-Line}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KList\-View\-Search\-Line::set\-List\-View ({\bf KList\-View} $\ast$ {\em lv})\hspace{0.3cm}{\tt  [slot]}}\label{classKListViewSearchLine_i4}


Sets the {\bf KList\-View}{\rm (p.\,\pageref{classKListView})} that is filtered by this search line. 

If {\em lv\/} is null then the widget will be disabled.

\begin{Desc}
\item[See also:]{\bf list\-View()}{\rm (p.\,\pageref{classKListViewSearchLine_a6})} \end{Desc}


Definition at line 178 of file klistviewsearchline.cpp.

References QList\-View\-Item::list\-View().\index{KListViewSearchLine@{KList\-View\-Search\-Line}!itemMatches@{itemMatches}}
\index{itemMatches@{itemMatches}!KListViewSearchLine@{KList\-View\-Search\-Line}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KList\-View\-Search\-Line::item\-Matches (const {\bf QList\-View\-Item} $\ast$ {\em item}, const {\bf QString} \& {\em s}) const\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKListViewSearchLine_b0}


Returns true if {\em item\/} matches the search {\em s\/}. 

This will be evaluated based on the value of {\bf case\-Sensitive()}{\rm (p.\,\pageref{classKListViewSearchLine_a3})}. This can be overridden in subclasses to implement more complicated matching schemes. 

Definition at line 205 of file klistviewsearchline.cpp.

References QValue\-List::end(), and QValue\-List::find().\index{KListViewSearchLine@{KList\-View\-Search\-Line}!createPopupMenu@{createPopupMenu}}
\index{createPopupMenu@{createPopupMenu}!KListViewSearchLine@{KList\-View\-Search\-Line}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QPopup\-Menu} $\ast$ KList\-View\-Search\-Line::create\-Popup\-Menu ()\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKListViewSearchLine_b1}


Re-implemented for internal reasons. 

API not affected.

See QLine\-Edit::mouse\-Press\-Event(). 

Reimplemented from {\bf KLine\-Edit} {\rm (p.\,\pageref{classKLineEdit_b5})}.

Definition at line 234 of file klistviewsearchline.cpp.

References QString::arg(), QPopup\-Menu::clear(), KLine\-Edit::create\-Popup\-Menu(), QPopup\-Menu::insert\-Item(), QPopup\-Menu::insert\-Separator(), QString::is\-Empty(), QHeader::map\-To\-Index(), QHeader::map\-To\-Section(), and QPopup\-Menu::set\-Item\-Checked().\index{KListViewSearchLine@{KList\-View\-Search\-Line}!queueSearch@{queueSearch}}
\index{queueSearch@{queueSearch}!KListViewSearchLine@{KList\-View\-Search\-Line}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KList\-View\-Search\-Line::queue\-Search (const {\bf QString} \& {\em search})\hspace{0.3cm}{\tt  [protected, slot]}}\label{classKListViewSearchLine_j0}


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 \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em search}]the most recent search and starts the timer.\end{description}
\end{Desc}
Together with {\bf activate\-Search()}{\rm (p.\,\pageref{classKListViewSearchLine_j1})} this makes it such that searches are not started until there is a short break in the users typing.

\begin{Desc}
\item[See also:]{\bf activate\-Search()}{\rm (p.\,\pageref{classKListViewSearchLine_j1})} \end{Desc}


Definition at line 284 of file klistviewsearchline.cpp.

References activate\-Search(), and QTimer::single\-Shot().

Referenced by KList\-View\-Search\-Line().\index{KListViewSearchLine@{KList\-View\-Search\-Line}!activateSearch@{activateSearch}}
\index{activateSearch@{activateSearch}!KListViewSearchLine@{KList\-View\-Search\-Line}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KList\-View\-Search\-Line::activate\-Search ()\hspace{0.3cm}{\tt  [protected, slot]}}\label{classKListViewSearchLine_j1}


When the timer started with {\bf queue\-Search()}{\rm (p.\,\pageref{classKListViewSearchLine_j0})} 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 list view search.

\begin{Desc}
\item[See also:]{\bf queue\-Search()}{\rm (p.\,\pageref{classKListViewSearchLine_j0})} \end{Desc}


Definition at line 291 of file klistviewsearchline.cpp.

References update\-Search().

Referenced by queue\-Search().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
klistviewsearchline.h\item 
klistviewsearchline.cpp\end{CompactItemize}
