org.kde.koala

Class KCompletionBox

public class KCompletionBox extends KListBox

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. See KCompletionBoxSignals for signals emitted by KCompletionBox

Author: Carsten Pfeiffer

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

Constructor Summary
protected KCompletionBox(Class dummy)
KCompletionBox(QWidget parent, String name)
Constructs a KCompletionBox.
KCompletionBox(QWidget parent)
Method Summary
booleanactivateOnSelect()
protected QRectcalculateGeometry()
This calculates the size of the dropdown and the relative position of the top left corner with respect to the parent widget.
StringcancelledText()
StringclassName()
voiddispose()
Delete the wrapped C++ instance ahead of finalize()
voiddown()
Moves the selection one line down or select the first item if nothing is selected yet.
voidend()
Moves the selection down to the last item.
booleaneventFilter(QObject arg1, QEvent arg2)
Reimplemented from KListBox to get events from the viewport (to hide this widget on mouse-click, Escape-presses, etc.
protected voidfinalize()
Deletes the wrapped C++ instance
voidhide()
Re-implemented for internal reasons.
voidhome()
Moves the selection up to the first item.
voidinsertItems(String[] items, int index)
Inserts items into the box.
voidinsertItems(String[] items)
booleanisDisposed()
Has the wrapped C++ instance been deleted?
booleanisTabHandling()
Default is false.
ArrayListitems()
Returns a list of all items currently in the box.
QMetaObjectmetaObject()
voidpageDown()
Moves the selection one page down.
voidpageUp()
Moves the selection one page up.
voidpopup()
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.
voidsetActivateOnSelect(boolean state)
Set whether or not the selected signal should be emitted when an item is selected.
voidsetCancelledText(String txt)
Sets the text to be emitted if the user chooses not to pick from the available matches.
voidsetItems(String[] items)
Clears the box and inserts items.
voidsetTabHandling(boolean enable)
Makes this widget (when visible) capture Tab-key events to traverse the items in the dropdown list.
voidshow()
Re-implemented for internal reasons.
protected voidsizeAndPosition()
This properly sizes and positions the listbox.
QSizesizeHint()
protected voidslotActivated(QListBoxItem arg1)
Called when an item was activated.
voidup()
Moves the selection one line up or select the first item if nothing is selected yet.

Constructor Detail

KCompletionBox

protected KCompletionBox(Class dummy)

KCompletionBox

public KCompletionBox(QWidget parent, String name)
Constructs a KCompletionBox. The parent widget is used to give the focus back when pressing the up-button on the very first item.

UNKNOWN: Constructs a KCompletionBox.

KCompletionBox

public KCompletionBox(QWidget parent)

Method Detail

activateOnSelect

public boolean activateOnSelect()

Returns: true if selecting an item results in the emition of the selected signal.

UNKNOWN:

calculateGeometry

protected QRect calculateGeometry()
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.

UNKNOWN: This calculates the size of the dropdown and the relative position of the top left corner with respect to the parent widget.

cancelledText

public String cancelledText()

Returns: the text set via setCancelledText() or null.

UNKNOWN:

className

public String className()

dispose

public void dispose()
Delete the wrapped C++ instance ahead of finalize()

down

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

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

end

public void end()
Moves the selection down to the last item.

UNKNOWN: Moves the selection down to the last item.

eventFilter

public boolean eventFilter(QObject arg1, QEvent arg2)
Reimplemented from KListBox to get events from the viewport (to hide this widget on mouse-click, Escape-presses, etc.

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

finalize

protected void finalize()
Deletes the wrapped C++ instance

hide

public void hide()
Re-implemented for internal reasons. API is unaffected.

UNKNOWN: Re-implemented for internal reasons.

home

public void home()
Moves the selection up to the first item.

UNKNOWN: Moves the selection up to the first item.

insertItems

public void insertItems(String[] items, int index)
Inserts items into the box. Does not clear the items before. index determines at which position items will be inserted. (defaults to appending them at the end)

UNKNOWN: Inserts items into the box.

insertItems

public void insertItems(String[] items)

isDisposed

public boolean isDisposed()
Has the wrapped C++ instance been deleted?

isTabHandling

public boolean isTabHandling()
Default is false.

Returns: true if this widget is handling Tab-key events to traverse the items in the dropdown list, otherwise false.

See Also: KCompletionBox

UNKNOWN:

items

public ArrayList items()
Returns a list of all items currently in the box.

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

metaObject

public QMetaObject metaObject()

pageDown

public void pageDown()
Moves the selection one page down.

UNKNOWN: Moves the selection one page down.

pageUp

public void pageUp()
Moves the selection one page up.

UNKNOWN: Moves the selection one page up.

popup

public 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. 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.

UNKNOWN: 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.

setActivateOnSelect

public void setActivateOnSelect(boolean state)
Set whether or not the selected signal should be emitted when an item is selected. By default the selected signal is emitted.

Parameters: state false if the signal should not be emitted.

UNKNOWN: Set whether or not the selected signal should be emitted when an item is selected.

setCancelledText

public void setCancelledText(String txt)
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.

Parameters: txt the text to be emitted if the user cancels this box

See Also: ( KCompletionBox

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

setItems

public void setItems(String[] items)
Clears the box and inserts items.

UNKNOWN: Clears the box and inserts items.

setTabHandling

public void setTabHandling(boolean enable)
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.

See Also: KCompletionBox

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

show

public void show()
Re-implemented for internal reasons. API is unaffected.

UNKNOWN: Re-implemented for internal reasons.

sizeAndPosition

protected void sizeAndPosition()
This properly sizes and positions the listbox.

UNKNOWN: This properly sizes and positions the listbox.

sizeHint

public QSize sizeHint()

slotActivated

protected void slotActivated(QListBoxItem arg1)
Called when an item was activated. Emits activated() with the item.

UNKNOWN: Called when an item was activated.

up

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

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