class KCompletionBox

A helper widget for "completion-widgets" (KLineEdit, KComboBox)). More...

Definition#include <kcompletionbox.h>
InheritsKListBox
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Slots

Signals

Protected Methods

Protected Slots


Detailed Description

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.

 KCompletionBox ( QWidget *parent, const char *name = 0 )

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.

KCompletionBox ()

Destroys the box

void  setCancelledText ( const QString& )

Sets the text emitted if this box is closed without selecting an item.

By default, a null string is emitted if the user presses cancel or clicks elsewhere to close this completion box widget.

QStringList  items ()

[const slot]

Returns: a list of all items currently in the box.

void  popup ()

[virtual slot]

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.

void  down ()

[slot]

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

void  up ()

[slot]

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

void  pageDown ()

[slot]

Move the selection one page down.

void  pageUp ()

[slot]

Move the selection one page up.

void  home ()

[slot]

Move the selection up to the first item.

void  end ()

[slot]

Move the selection down to the last item.

void  show ()

[virtual slot]

Re-implemented for internal reasons. API is not affected.

Reimplemented from QScrollView

void  hide ()

[virtual slot]

Re-implemented for internal reasons. API is not affected.

Reimplemented from QWidget

void  activated ( const QString& )

[signal]

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

void  userCancelled ( const QString& )

[signal]

Emitted if this widget is closed by clicking outsite this widgets area or by presseing the escape key.

bool  eventFilter ( QObject *, QEvent * )

[protected virtual]

Reimplemented from KListBox to get events from the viewport (to hide this widget on mouse-click, Escape-presses, etc.

Reimplemented from QScrollView

void  cancelled ()

[protected]

Invoked if the user choose to ignore the current selection and close this widget.

void  slotActivated ( QListBoxItem * )

[protected virtual slot]

Called when an item was activated. Emits activated() with the item.