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

Public Slots | |
QStringList | items () const |
void | insertItems (const QStringList &items, int index=-1) |
void | setItems (const QStringList &items) |
virtual void | popup () |
void | setTabHandling (bool enable) |
bool | isTabHandling () const |
void | setCancelledText (const QString &txt) |
QString | cancelledText () const |
void | setActivateOnSelect (bool state) |
void | down () |
void | up () |
void | pageDown () |
void | pageUp () |
void | home () |
void | end () |
virtual void | show () |
virtual void | hide () |
Signals | |
void | activated (const QString &) |
void | userCancelled (const QString &) |
Public Member Functions | |
KCompletionBox (QWidget *parent, const char *name=0) | |
~KCompletionBox () | |
virtual QSize | sizeHint () const |
bool | activateOnSelect () const |
Protected Slots | |
virtual void | slotActivated (QListBoxItem *) |
Protected Member Functions | |
QRect | calculateGeometry () const |
void | sizeAndPosition () |
virtual bool | eventFilter (QObject *, QEvent *) |
virtual void | virtual_hook (int id, void *data) |
Properties | |
bool | isTabHandling |
QString | cancelledText |
bool | activateOnSelect |
Detailed Description
A helper widget for "completion-widgets" (KLineEdit, KComboBox)).A little utility class for "completion-widgets", like KLineEdit or 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 43 of file kcompletionbox.h.
Constructor & Destructor Documentation
|
Constructs a KCompletionBox. The parent widget is used to give the focus back when pressing the up-button on the very first item. Definition at line 47 of file kcompletionbox.cpp. References KListBox::doubleClicked(), and slotActivated(). |
|
Destroys the box.
Definition at line 79 of file kcompletionbox.cpp. |
Member Function Documentation
|
|
|
Returns a list of all items currently in the box.
Definition at line 85 of file kcompletionbox.cpp. |
|
Inserts
Does not clear the items before. Definition at line 468 of file kcompletionbox.cpp. |
|
Clears the box and inserts
Definition at line 477 of file kcompletionbox.cpp. References sizeAndPosition(). Referenced by KLineEdit::setCompletedItems(). |
|
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 250 of file kcompletionbox.cpp. References hide(), show(), and sizeAndPosition(). |
|
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 426 of file kcompletionbox.cpp. |
|
|
|
Sets the text to be emitted if the user chooses not to pick from the available matches. If the canceled text is not set through this function, the userCancelled signal will not be emitted.
Definition at line 436 of file kcompletionbox.cpp. |
|
|
|
Set whether or not the selected signal should be emitted when an item is selected. By default the selevted signal is emitted.
Definition at line 549 of file kcompletionbox.cpp. |
|
Moves the selection one line down or select the first item if nothing is selected yet.
Definition at line 381 of file kcompletionbox.cpp. Referenced by eventFilter(). |
|
Moves the selection one line up or select the first item if nothing is selected yet.
Definition at line 396 of file kcompletionbox.cpp. Referenced by eventFilter(). |
|
Moves the selection one page down.
Definition at line 402 of file kcompletionbox.cpp. Referenced by eventFilter(). |
|
Moves the selection one page up.
Definition at line 409 of file kcompletionbox.cpp. Referenced by eventFilter(). |
|
Moves the selection up to the first item.
Definition at line 416 of file kcompletionbox.cpp. Referenced by eventFilter(). |
|
Moves the selection down to the last item.
Definition at line 421 of file kcompletionbox.cpp. Referenced by eventFilter(). |
|
Re-implemented for internal reasons. API is unaffected. Definition at line 300 of file kcompletionbox.cpp. References sizeAndPosition(). Referenced by popup(). |
|
Re-implemented for internal reasons. API is unaffected. Definition at line 324 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.
|
|
This calculates the size of the dropdown and the relative position of the top left corner with respect to the parent widget. This matches the geometry and position normally used by K/QComboBox when used with one. Definition at line 332 of file kcompletionbox.cpp. Referenced by sizeAndPosition(). |
|
This properly sizes and positions the listbox.
Definition at line 268 of file kcompletionbox.cpp. References calculateGeometry(), and KGlobalSettings::desktopGeometry(). Referenced by popup(), setItems(), and show(). |
|
Reimplemented from KListBox to get events from the viewport (to hide this widget on mouse-click, Escape-presses, etc.
Definition at line 108 of file kcompletionbox.cpp. References down(), end(), hide(), home(), pageDown(), pageUp(), and up(). |
|
Called when an item was activated. Emits activated() with the item. Definition at line 99 of file kcompletionbox.cpp. References activated(), and hide(). Referenced by KCompletionBox(). |
The documentation for this class was generated from the following files: