\section{KCompletion\-Box Class Reference}
\label{classKCompletionBox}\index{KCompletionBox@{KCompletionBox}}
A little utility class for \char`\"{}completion-widgets\char`\"{}, like {\bf KLine\-Edit}{\rm (p.\,\pageref{classKLineEdit})} or {\bf KCombo\-Box}{\rm (p.\,\pageref{classKComboBox})}. A helper widget for \char`\"{}completion-widgets\char`\"{} ({\bf KLine\-Edit}{\rm (p.\,\pageref{classKLineEdit})}, {\bf KCombo\-Box}{\rm (p.\,\pageref{classKComboBox})})).  


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

Inheritance diagram for KCompletion\-Box:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=66pt]{classKCompletionBox__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KCompletion\-Box:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=176pt]{classKCompletionBox__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Slots}
\begin{CompactItemize}
\item 
{\bf QString\-List} {\bf items} () const 
\begin{CompactList}\small\item\em Returns a list of all items currently in the box. \item\end{CompactList}\item 
void {\bf insert\-Items} (const  {\bf QString\-List} \&items, int {\bf index}=-1)
\begin{CompactList}\small\item\em Inserts {\tt items} into the box. \item\end{CompactList}\item 
void {\bf set\-Items} (const  {\bf QString\-List} \&items)
\begin{CompactList}\small\item\em Clears the box and inserts {\tt items}. \item\end{CompactList}\item 
virtual void {\bf popup} ()
\begin{CompactList}\small\item\em Adjusts the size of the box to fit the width of the parent given in the constructor and pops it up at the most appropriate place, relative to the parent. \item\end{CompactList}\item 
void {\bf set\-Tab\-Handling} (bool enable)
\begin{CompactList}\small\item\em Makes this widget (when visible) capture Tab-key events to traverse the items in the dropdown list. \item\end{CompactList}\item 
bool {\bf is\-Tab\-Handling} () const 
\item 
void {\bf set\-Cancelled\-Text} (const  {\bf QString} \&)
\begin{CompactList}\small\item\em Sets the text to be emitted if the user chooses not to pick from the available matches. \item\end{CompactList}\item 
{\bf QString} {\bf cancelled\-Text} () const 
\item 
void {\bf down} ()
\begin{CompactList}\small\item\em Moves the selection one line down or select the first item if nothing is selected yet. \item\end{CompactList}\item 
void {\bf up} ()
\begin{CompactList}\small\item\em Moves the selection one line up or select the first item if nothing is selected yet. \item\end{CompactList}\item 
void {\bf page\-Down} ()
\begin{CompactList}\small\item\em Moves the selection one page down. \item\end{CompactList}\item 
void {\bf page\-Up} ()
\begin{CompactList}\small\item\em Moves the selection one page up. \item\end{CompactList}\item 
void {\bf home} ()
\begin{CompactList}\small\item\em Moves the selection up to the first item. \item\end{CompactList}\item 
void {\bf end} ()
\begin{CompactList}\small\item\em Moves the selection down to the last item. \item\end{CompactList}\item 
virtual void {\bf show} ()
\begin{CompactList}\small\item\em Re-implemented for internal reasons. \item\end{CompactList}\item 
virtual void {\bf hide} ()
\begin{CompactList}\small\item\em Re-implemented for internal reasons. \item\end{CompactList}\end{CompactItemize}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf activated} (const  {\bf QString} \&)
\begin{CompactList}\small\item\em Emitted when an item was selected, contains the text of the selected item. \item\end{CompactList}\item 
void {\bf user\-Cancelled} (const  {\bf QString} \&)
\begin{CompactList}\small\item\em Emitted whenever the user chooses to ignore the available selections and close the this box. \item\end{CompactList}\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KCompletion\-Box} ({\bf QWidget} $\ast$parent, const  char $\ast$name=0)
\begin{CompactList}\small\item\em Constructs a KCompletion\-Box. \item\end{CompactList}\item 
{\bf $\sim$KCompletion\-Box} ()
\begin{CompactList}\small\item\em Destroys the box. \item\end{CompactList}\item 
virtual {\bf QSize} {\bf size\-Hint} () const \label{classKCompletionBox_a2}

\end{CompactItemize}
\subsection*{Protected Slots}
\begin{CompactItemize}
\item 
virtual void {\bf slot\-Activated} ({\bf QList\-Box\-Item} $\ast$)
\begin{CompactList}\small\item\em Called when an item was activated. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual bool {\bf event\-Filter} ({\bf QObject} $\ast$, {\bf QEvent} $\ast$)
\begin{CompactList}\small\item\em Reimplemented from {\bf KList\-Box}{\rm (p.\,\pageref{classKListBox})} to get events from the viewport (to hide this widget on mouse-click, Escape-presses, etc. \item\end{CompactList}\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKCompletionBox_b1}

\end{CompactItemize}


\subsection{Detailed Description}
A little utility class for \char`\"{}completion-widgets\char`\"{}, like {\bf KLine\-Edit}{\rm (p.\,\pageref{classKLineEdit})} or {\bf KCombo\-Box}{\rm (p.\,\pageref{classKComboBox})}. A helper widget for \char`\"{}completion-widgets\char`\"{} ({\bf KLine\-Edit}{\rm (p.\,\pageref{classKLineEdit})}, {\bf KCombo\-Box}{\rm (p.\,\pageref{classKComboBox})})). 

KCompletion\-Box is a listbox, displayed as a rectangle without any window decoration, usually directly under the lineedit or combobox. It is filled with all possible matches for a completion, so the user can select the one he wants.

It is used when {\bf KGlobal\-Settings::Completion} == Completion\-Popup or Completion\-Popup\-Auto.

\begin{Desc}
\item[Author:]Carsten Pfeiffer $<${\tt pfeiffer@kde.org}$>$ \end{Desc}




Definition at line 41 of file kcompletionbox.h.

\subsection{Constructor \& Destructor Documentation}
\index{KCompletionBox@{KCompletion\-Box}!KCompletionBox@{KCompletionBox}}
\index{KCompletionBox@{KCompletionBox}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KCompletion\-Box::KCompletion\-Box ({\bf QWidget} $\ast$ {\em parent}, const char $\ast$ {\em name} = 0)}\label{classKCompletionBox_a0}


Constructs a KCompletion\-Box. 

The parent widget is used to give the focus back when pressing the up-button on the very first item. 

Definition at line 41 of file kcompletionbox.cpp.

References QList\-Box::clicked(), QList\-Box::current\-Changed(), KList\-Box::double\-Clicked(), KStd\-Accel::name(), QList\-Box::set\-Column\-Mode(), and slot\-Activated().\index{KCompletionBox@{KCompletion\-Box}!~KCompletionBox@{$\sim$KCompletionBox}}
\index{~KCompletionBox@{$\sim$KCompletionBox}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KCompletion\-Box::$\sim${\bf KCompletion\-Box} ()}\label{classKCompletionBox_a1}


Destroys the box. 



Definition at line 71 of file kcompletionbox.cpp.

\subsection{Member Function Documentation}
\index{KCompletionBox@{KCompletion\-Box}!items@{items}}
\index{items@{items}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString\-List} KCompletion\-Box::items () const\hspace{0.3cm}{\tt  [slot]}}\label{classKCompletionBox_i0}


Returns a list of all items currently in the box. 



Definition at line 77 of file kcompletionbox.cpp.

References QList\-Box::count(), and QList\-Box::text().\index{KCompletionBox@{KCompletion\-Box}!insertItems@{insertItems}}
\index{insertItems@{insertItems}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion\-Box::insert\-Items (const {\bf QString\-List} \& {\em items}, int {\em index} = -1)\hspace{0.3cm}{\tt  [slot]}}\label{classKCompletionBox_i1}


Inserts {\tt items} into the box. 

Does not clear the items before. {\tt index} determines at which position {\tt items} will be inserted. (defaults to appending them at the end) 

Definition at line 366 of file kcompletionbox.cpp.

References QList\-Box::insert\-String\-List().\index{KCompletionBox@{KCompletion\-Box}!setItems@{setItems}}
\index{setItems@{setItems}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion\-Box::set\-Items (const {\bf QString\-List} \& {\em items})\hspace{0.3cm}{\tt  [slot]}}\label{classKCompletionBox_i2}


Clears the box and inserts {\tt items}. 



Definition at line 375 of file kcompletionbox.cpp.

References QList\-Box::first\-Item(), QList\-Box::insert\-Item(), QList\-Box::insert\-String\-List(), QList\-Box::item(), QList\-Box\-Item::next(), and QList\-Box::trigger\-Update().\index{KCompletionBox@{KCompletion\-Box}!popup@{popup}}
\index{popup@{popup}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion\-Box::popup ()\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKCompletionBox_i3}


Adjusts the size of the box to fit the width of the parent given in the constructor and pops it up at the most appropriate place, relative to the parent. 

Depending on the screensize and the position of the parent, this may be a different place, however the default is to pop it up and the lower left corner of the parent.

Make sure to {\bf hide()}{\rm (p.\,\pageref{classKCompletionBox_i15})} the box when appropriate. 

Definition at line 219 of file kcompletionbox.cpp.

References QList\-Box::clear\-Selection(), QList\-Box::count(), QList\-Box::ensure\-Current\-Visible(), QSize::height(), hide(), QList\-Box::set\-Current\-Item(), and show().\index{KCompletionBox@{KCompletion\-Box}!setTabHandling@{setTabHandling}}
\index{setTabHandling@{setTabHandling}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion\-Box::set\-Tab\-Handling (bool {\em enable})\hspace{0.3cm}{\tt  [slot]}}\label{classKCompletionBox_i4}


Makes this widget (when visible) capture Tab-key events to traverse the items in the dropdown list. 

Default off, as it conflicts with the usual behavior of Tab to traverse widgets. It is useful for cases like Konqueror's Location Bar, though.

\begin{Desc}
\item[See also:]{\bf is\-Tab\-Handling}{\rm (p.\,\pageref{classKCompletionBox_i5})} \end{Desc}


Definition at line 331 of file kcompletionbox.cpp.\index{KCompletionBox@{KCompletion\-Box}!isTabHandling@{isTabHandling}}
\index{isTabHandling@{isTabHandling}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KCompletion\-Box::is\-Tab\-Handling () const\hspace{0.3cm}{\tt  [slot]}}\label{classKCompletionBox_i5}


\begin{Desc}
\item[Returns:]true if this widget is handling Tab-key events to traverse the items in the dropdown list, otherwise false.\end{Desc}
Default is false.

\begin{Desc}
\item[See also:]{\bf set\-Tab\-Handling}{\rm (p.\,\pageref{classKCompletionBox_i4})} \end{Desc}


Definition at line 336 of file kcompletionbox.cpp.\index{KCompletionBox@{KCompletion\-Box}!setCancelledText@{setCancelledText}}
\index{setCancelledText@{setCancelledText}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion\-Box::set\-Cancelled\-Text (const {\bf QString} \&)\hspace{0.3cm}{\tt  [slot]}}\label{classKCompletionBox_i6}


Sets the text to be emitted if the user chooses not to pick from the available matches. 

If the cancelled text is not set through this function, the {\bf user\-Cancelled}{\rm (p.\,\pageref{classKCompletionBox_l1})} signal will not be emitted.

\begin{Desc}
\item[See also:]{\bf user\-Cancelled( const QString\& )}{\rm (p.\,\pageref{classKCompletionBox_l1})} \end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em txt}]the text to be emitted if the user cancels this box \end{description}
\end{Desc}


Definition at line 341 of file kcompletionbox.cpp.\index{KCompletionBox@{KCompletion\-Box}!cancelledText@{cancelledText}}
\index{cancelledText@{cancelledText}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QString} KCompletion\-Box::cancelled\-Text () const\hspace{0.3cm}{\tt  [slot]}}\label{classKCompletionBox_i7}


\begin{Desc}
\item[Returns:]the text set via {\bf set\-Cancelled\-Text}{\rm (p.\,\pageref{classKCompletionBox_i6})}() or QString::null. \end{Desc}


Definition at line 346 of file kcompletionbox.cpp.\index{KCompletionBox@{KCompletion\-Box}!down@{down}}
\index{down@{down}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion\-Box::down ()\hspace{0.3cm}{\tt  [slot]}}\label{classKCompletionBox_i8}


Moves the selection one line down or select the first item if nothing is selected yet. 



Definition at line 286 of file kcompletionbox.cpp.

References QList\-Box::count(), QList\-Box::current\-Item(), QList\-Box::current\-Text(), QList\-Box::highlighted(), QList\-Box::set\-Current\-Item(), and QList\-Box::set\-Selected().

Referenced by event\-Filter().\index{KCompletionBox@{KCompletion\-Box}!up@{up}}
\index{up@{up}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion\-Box::up ()\hspace{0.3cm}{\tt  [slot]}}\label{classKCompletionBox_i9}


Moves the selection one line up or select the first item if nothing is selected yet. 



Definition at line 301 of file kcompletionbox.cpp.

References QList\-Box::current\-Item(), and QList\-Box::set\-Current\-Item().

Referenced by event\-Filter().\index{KCompletionBox@{KCompletion\-Box}!pageDown@{pageDown}}
\index{pageDown@{pageDown}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion\-Box::page\-Down ()\hspace{0.3cm}{\tt  [slot]}}\label{classKCompletionBox_i10}


Moves the selection one page down. 



Definition at line 307 of file kcompletionbox.cpp.

References QList\-Box::count(), QList\-Box::current\-Item(), QList\-Box::num\-Items\-Visible(), and QList\-Box::set\-Current\-Item().

Referenced by event\-Filter().\index{KCompletionBox@{KCompletion\-Box}!pageUp@{pageUp}}
\index{pageUp@{pageUp}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion\-Box::page\-Up ()\hspace{0.3cm}{\tt  [slot]}}\label{classKCompletionBox_i11}


Moves the selection one page up. 



Definition at line 314 of file kcompletionbox.cpp.

References QList\-Box::current\-Item(), QList\-Box::num\-Items\-Visible(), and QList\-Box::set\-Current\-Item().

Referenced by event\-Filter().\index{KCompletionBox@{KCompletion\-Box}!home@{home}}
\index{home@{home}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion\-Box::home ()\hspace{0.3cm}{\tt  [slot]}}\label{classKCompletionBox_i12}


Moves the selection up to the first item. 



Definition at line 321 of file kcompletionbox.cpp.

References QList\-Box::set\-Current\-Item().

Referenced by event\-Filter().\index{KCompletionBox@{KCompletion\-Box}!end@{end}}
\index{end@{end}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion\-Box::end ()\hspace{0.3cm}{\tt  [slot]}}\label{classKCompletionBox_i13}


Moves the selection down to the last item. 



Definition at line 326 of file kcompletionbox.cpp.

References QList\-Box::count(), and QList\-Box::set\-Current\-Item().

Referenced by event\-Filter().\index{KCompletionBox@{KCompletion\-Box}!show@{show}}
\index{show@{show}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion\-Box::show ()\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKCompletionBox_i14}


Re-implemented for internal reasons. 

API is unaffected. 

Definition at line 237 of file kcompletionbox.cpp.

References QRect::bottom(), QApplication::desktop(), KIO::move(), QRect::right(), QPoint::x(), and QPoint::y().

Referenced by popup().\index{KCompletionBox@{KCompletion\-Box}!hide@{hide}}
\index{hide@{hide}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion\-Box::hide ()\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKCompletionBox_i15}


Re-implemented for internal reasons. 

API is unaffected. 

Definition at line 267 of file kcompletionbox.cpp.

Referenced by event\-Filter(), popup(), and slot\-Activated().\index{KCompletionBox@{KCompletion\-Box}!activated@{activated}}
\index{activated@{activated}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion\-Box::activated (const {\bf QString} \&)\hspace{0.3cm}{\tt  [signal]}}\label{classKCompletionBox_l0}


Emitted when an item was selected, contains the text of the selected item. 



Referenced by slot\-Activated().\index{KCompletionBox@{KCompletion\-Box}!userCancelled@{userCancelled}}
\index{userCancelled@{userCancelled}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion\-Box::user\-Cancelled (const {\bf QString} \&)\hspace{0.3cm}{\tt  [signal]}}\label{classKCompletionBox_l1}


Emitted whenever the user chooses to ignore the available selections and close the this box. 

\index{KCompletionBox@{KCompletion\-Box}!eventFilter@{eventFilter}}
\index{eventFilter@{eventFilter}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KCompletion\-Box::event\-Filter ({\bf QObject} $\ast$, {\bf QEvent} $\ast$)\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKCompletionBox_b0}


Reimplemented from {\bf KList\-Box}{\rm (p.\,\pageref{classKListBox})} to get events from the viewport (to hide this widget on mouse-click, Escape-presses, etc. 



Definition at line 95 of file kcompletionbox.cpp.

References QKey\-Event::accept(), down(), end(), hide(), home(), QKey\-Event::key(), KIO::move(), page\-Down(), page\-Up(), QMouse\-Event::pos(), QKey\-Event::state(), QEvent::type(), and up().\index{KCompletionBox@{KCompletion\-Box}!slotActivated@{slotActivated}}
\index{slotActivated@{slotActivated}!KCompletionBox@{KCompletion\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KCompletion\-Box::slot\-Activated ({\bf QList\-Box\-Item} $\ast$)\hspace{0.3cm}{\tt  [protected, virtual, slot]}}\label{classKCompletionBox_j0}


Called when an item was activated. 

Emits {\bf activated}{\rm (p.\,\pageref{classKCompletionBox_l0})}() with the item. 

Definition at line 86 of file kcompletionbox.cpp.

References activated(), hide(), and QList\-Box\-Item::text().

Referenced by KCompletion\-Box().

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