org.kde.koala
public class KHistoryCombo extends KComboBox
UNKNOWN: A combobox for offering a history and completion.
Constructor Summary | |
---|---|
protected | KHistoryCombo(Class dummy) |
KHistoryCombo(QWidget parent, String name)
Constructs a "read-write" combobox. | |
KHistoryCombo(QWidget parent) | |
KHistoryCombo() | |
KHistoryCombo(boolean useCompletion, QWidget parent, String name)
Same as the previous constructor, but additionally has the option
to specify whether you want to let KHistoryCombo handle completion
or not. | |
KHistoryCombo(boolean useCompletion, QWidget parent) | |
KHistoryCombo(boolean useCompletion) |
Method Summary | |
---|---|
void | addToHistory(String item)
Adds an item to the end of the history list and to the completion list.
|
String | className() |
void | clearHistory()
Clears the history and the completion list. |
void | dispose() Delete the wrapped C++ instance ahead of finalize() |
protected void | finalize() Deletes the wrapped C++ instance |
ArrayList | historyItems()
Returns the list of history items. |
protected void | insertItems(String[] items)
Inserts items into the combo, honoring pixmapProvider()
Does not update the completionObject.
|
boolean | isDisposed() Has the wrapped C++ instance been deleted? |
protected void | keyPressEvent(QKeyEvent arg1)
Handling key-events, the shortcuts to rotate the items. |
QMetaObject | metaObject() |
KPixmapProvider | pixmapProvider() |
boolean | removeFromHistory(String item)
Removes all items named item. |
void | reset()
Resets the current position of the up/down history. |
void | setHistoryItems(String[] items)
Inserts items into the combobox. |
void | setHistoryItems(String[] items, boolean setCompletionList)
Inserts items into the combobox. |
void | setPixmapProvider(KPixmapProvider prov)
Sets a pixmap provider, so that items in the combobox can have a pixmap.
|
protected boolean | useCompletion() |
protected void | wheelEvent(QWheelEvent ev)
Handling wheel-events, to rotate the items. |
connect( combo, SIGNAL("activated( String )"), combo, SLOT("addToHistory( String )"));Use QComboBox.setMaxCount() to limit the history.
parent
the parent object of this widget.
name
the name of this widget.UNKNOWN: Constructs a "read-write" combobox.
true
, KHistoryCombo will sync the completion to the
contents of the combobox.UNKNOWN: Same as the previous constructor, but additionally has the option to specify whether you want to let KHistoryCombo handle completion or not.
item
, it will not be
inserted again.
If duplicatesEnabled() is false, any equal existing item will be
removed before item
is added.
Note: By using this method and not the Q and KComboBox insertItem()
methods, you make sure that the combobox stays in sync with the
completion. It would be annoying if completion would give an item
not in the combobox, and vice versa.See Also: KHistoryCombo org.kde.qt.QComboBox#setDuplicatesEnabled
UNKNOWN: Adds an item to the end of the history list and to the completion list.
UNKNOWN: Clears the history and the completion list.
See Also: KHistoryCombo
UNKNOWN: Returns the list of history items.
items
into the combo, honoring pixmapProvider()
Does not update the completionObject.
Note: duplicatesEnabled() is not honored here.
Called from setHistoryItems() and setPixmapProvider()UNKNOWN: Inserts items
into the combo, honoring pixmapProvider() Does not update the completionObject.
UNKNOWN: Handling key-events, the shortcuts to rotate the items.
item.
Returns: true
if at least one item was removed.
See Also: KHistoryCombo
UNKNOWN: Removes all items named item.
UNKNOWN: Resets the current position of the up/down history.
items
into the combobox. items
might get
truncated if it is longer than maxCount()See Also: KHistoryCombo
UNKNOWN: Inserts items
into the combobox.
items
into the combobox. items
might get
truncated if it is longer than maxCount()
Set setCompletionList
to true, if you don't have a list of
completions. This tells KHistoryCombo to use all the items for the
completion object as well.
You won't have the benefit of weighted completion though, so normally
you should do something like
KConfig config = kapp.config(); ArrayList list; // load the history and completion list after creating the history combo list = config.readListEntry( "Completion list" ); combo.completionObject().setItems( list ); list = config.readListEntry( "History list" ); combo.setHistoryItems( list ); [...] // save the history and completion list when the history combo is // destroyed list = combo.completionObject().items() config.writeEntry( "Completion list", list ); list = combo.historyItems(); config.writeEntry( "History list", list );Be sure to use different names for saving with KConfig if you have more than one KHistoryCombo. Note: When
setCompletionList
is true, the items are inserted into the
KCompletion object with mode KCompletion.Insertion and the mode is set
to KCompletion.Weighted afterwards.See Also: KHistoryCombo KComboBox KCompletion KCompletion
UNKNOWN: Inserts items
into the combobox.
prov
to null if you want to disable pixmaps. Default no pixmaps.See Also: KHistoryCombo
UNKNOWN: Sets a pixmap provider, so that items in the combobox can have a pixmap.
Returns: if we can modify the completion object or not.
UNKNOWN:
UNKNOWN: Handling wheel-events, to rotate the items.