KCompletionBox Class Reference
A little utility class for "completion-widgets", like KLineEdit or KComboBox. A helper widget for "completion-widgets" (KLineEdit, KComboBox)). More...
#include <kcompletionbox.h>
Inheritance diagram for KCompletionBox:

Public Slots | |
QStringList | items () const |
Returns a list of all items currently in the box. | |
void | insertItems (const QStringList &items, int index=-1) |
Inserts items into the box. | |
void | setItems (const QStringList &items) |
Clears the box and inserts items . | |
virtual void | popup () |
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. | |
void | setTabHandling (bool enable) |
Makes this widget (when visible) capture Tab-key events to traverse the items in the dropdown list. | |
bool | isTabHandling () const |
void | setCancelledText (const QString &) |
Sets the text to be emitted if the user chooses not to pick from the available matches. | |
QString | cancelledText () const |
void | down () |
Moves the selection one line down or select the first item if nothing is selected yet. | |
void | up () |
Moves the selection one line up or select the first item if nothing is selected yet. | |
void | pageDown () |
Moves the selection one page down. | |
void | pageUp () |
Moves the selection one page up. | |
void | home () |
Moves the selection up to the first item. | |
void | end () |
Moves the selection down to the last item. | |
virtual void | show () |
Re-implemented for internal reasons. | |
virtual void | hide () |
Re-implemented for internal reasons. | |
Signals | |
void | activated (const QString &) |
Emitted when an item was selected, contains the text of the selected item. | |
void | userCancelled (const QString &) |
Emitted whenever the user chooses to ignore the available selections and close the this box. | |
Public Member Functions | |
KCompletionBox (QWidget *parent, const char *name=0) | |
Constructs a KCompletionBox. | |
~KCompletionBox () | |
Destroys the box. | |
virtual QSize | sizeHint () const |
Protected Slots | |
virtual void | slotActivated (QListBoxItem *) |
Called when an item was activated. | |
Protected Member Functions | |
virtual bool | eventFilter (QObject *, QEvent *) |
Reimplemented from KListBox to get events from the viewport (to hide this widget on mouse-click, Escape-presses, etc. | |
virtual void | virtual_hook (int id, void *data) |
Detailed Description
A little utility class for "completion-widgets", like KLineEdit or KComboBox. A helper widget for "completion-widgets" (KLineEdit, KComboBox)).KCompletionBox 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 KGlobalSettings::Completion == CompletionPopup or CompletionPopupAuto.
- Author:
- Carsten Pfeiffer <pfeiffer@kde.org>
Definition at line 41 of file kcompletionbox.h.
Constructor & Destructor Documentation
|
Constructs a KCompletionBox. Notice: the parent needs to be always 0L, so you can't specify it in the constructor. Because of that, Qt's auto-deletion does not take place, so you have to explicitly delete this widget when you don't need it anymore. 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 QListBox::clicked(), QListBox::currentChanged(), KListBox::doubleClicked(), KStdAccel::name(), QListBox::setColumnMode(), and slotActivated(). |
|
Destroys the box.
Definition at line 71 of file kcompletionbox.cpp. |
Member Function Documentation
|
Returns a list of all items currently in the box.
Definition at line 77 of file kcompletionbox.cpp. References QListBox::count(), and QListBox::text(). |
|
Inserts
Does not clear the items before. Definition at line 366 of file kcompletionbox.cpp. References QListBox::insertStringList(). |
|
Clears the box and inserts
Definition at line 375 of file kcompletionbox.cpp. References QListBox::firstItem(), QListBox::insertItem(), QListBox::insertStringList(), QListBox::item(), QListBoxItem::next(), and QListBox::triggerUpdate(). |
|
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 hide() the box when appropriate. Definition at line 219 of file kcompletionbox.cpp. References QListBox::clearSelection(), QListBox::count(), QListBox::ensureCurrentVisible(), QSize::height(), hide(), QListBox::setCurrentItem(), and show(). |
|
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.
Definition at line 331 of file kcompletionbox.cpp. |
|
Definition at line 336 of file kcompletionbox.cpp. |
|
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 userCancelled signal will not be emitted.
Definition at line 341 of file kcompletionbox.cpp. |
|
Definition at line 346 of file kcompletionbox.cpp. |
|
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 QListBox::count(), QListBox::currentItem(), QListBox::currentText(), QListBox::highlighted(), QListBox::setCurrentItem(), and QListBox::setSelected(). Referenced by eventFilter(). |
|
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 QListBox::currentItem(), and QListBox::setCurrentItem(). Referenced by eventFilter(). |
|
Moves the selection one page down.
Definition at line 307 of file kcompletionbox.cpp. References QListBox::count(), QListBox::currentItem(), QListBox::numItemsVisible(), and QListBox::setCurrentItem(). Referenced by eventFilter(). |
|
Moves the selection one page up.
Definition at line 314 of file kcompletionbox.cpp. References QListBox::currentItem(), QListBox::numItemsVisible(), and QListBox::setCurrentItem(). Referenced by eventFilter(). |
|
Moves the selection up to the first item.
Definition at line 321 of file kcompletionbox.cpp. References QListBox::setCurrentItem(). Referenced by eventFilter(). |
|
Moves the selection down to the last item.
Definition at line 326 of file kcompletionbox.cpp. References QListBox::count(), and QListBox::setCurrentItem(). Referenced by eventFilter(). |
|
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(). |
|
Re-implemented for internal reasons. API is unaffected. Definition at line 267 of file kcompletionbox.cpp. Referenced by eventFilter(), popup(), and slotActivated(). |
|
Emitted when an item was selected, contains the text of the selected item.
Referenced by slotActivated(). |
|
Emitted whenever the user chooses to ignore the available selections and close the this box.
|
|
Reimplemented from KListBox 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 QKeyEvent::accept(), down(), end(), hide(), home(), QKeyEvent::key(), KIO::move(), pageDown(), pageUp(), QMouseEvent::pos(), QKeyEvent::state(), QEvent::type(), and up(). |
|
Called when an item was activated. Emits activated() with the item. Definition at line 86 of file kcompletionbox.cpp. References activated(), hide(), and QListBoxItem::text(). Referenced by KCompletionBox(). |
The documentation for this class was generated from the following files: