org.kde.koala
public class KComboBox extends QComboBox implements KCompletionBaseInterface
setCompletionObject
call to false.
Beware: The completion object can be deleted on you, especially if a call
such as setEditable(false) is made. Store the pointer at your own risk,
and consider using QGuardedPtrCompletionAuto.
Unlike an editable combobox the CompletionAuto mode, works by matching
any typed key with the first letter of entries in the combobox. Please note
that if you call setEditable( false ) to change an editable combobox to a
non-editable one, the text completion object associated with the combobox will
no longer exist unless you created the completion object yourself and assigned
it to this widget or you called setAutoDeleteCompletionObject( false ). In other
words do not do the following:
KComboBox combo = new KCompletionBox(true, this, "mywidget"); KCompletion comp = combo.completionObject(); combo.setEditable( false ); comp.clear(); // CRASH: completion object does not exist anymore.A read-only KComboBox will have the same background color as a disabled KComboBox, but its foreground color will be the one used for the read-write mode. This differs from QComboBox's implementation and is done to give visual distinction between the three different modes: disabled, read-only, and read-write.
KComboBox combo = new KComboBox( true, this, "mywidget" ); KCompletion comp = combo.completionObject(); // Connect to the return pressed signal - optional connect(combo,SIGNAL("returnPressed(String)"),comp,SLOT("addItem(String)")); // Provide the to be completed strings. Note that those are separate from the combo's // contents. comp.insertItems( someArrayList );To use your own completion object:
KComboBox combo = new KComboBox( this,"mywidget" ); KURLCompletion comp = new KURLCompletion(); combo.setCompletionObject( comp ); // Connect to the return pressed signal - optional connect(combo,SIGNAL("returnPressed(String)"),comp,SLOT("addItem(String)"));Note that you have to either delete the allocated completion object when you don't need it anymore, or call setAutoDeleteCompletionObject( true ); Miscellaneous function calls:
// Tell the widget not to handle completion and rotation combo.setHandleSignals( false ); // Set your own completion key for manual completions. combo.setKeyBinding( KCompletionBase.TextCompletion, Qt.End ); // Hide the context (popup) menu combo.setContextMenuEnabled( false );See KComboBoxSignals for signals emitted by KComboBox
UNKNOWN: An enhanced combo box.
Constructor Summary | |
---|---|
protected | KComboBox(Class dummy) |
KComboBox(QWidget parent, String name)
Constructs a read-only or rather select-only combo box with a
parent object and a name. | |
KComboBox(QWidget parent) | |
KComboBox() | |
KComboBox(boolean rw, QWidget parent, String name)
Constructs a "read-write" or "read-only" combo box depending on
the value of the first argument( rw ) with a parent, a
name. | |
KComboBox(boolean rw, QWidget parent) | |
KComboBox(boolean rw) |
Method Summary | |
---|---|
boolean | autoCompletion()
Re-implemented from QComboBox.
|
void | changeURL(KURL url, int index)
Replaces the item at position index with url.
KURL.prettyURL() is used so that the url is properly decoded
for displaying. |
void | changeURL(QPixmap pixmap, KURL url, int index)
Replaces the item at position index with url and pixmap pixmap.
KURL.prettyURL() is used so that the url is properly decoded
for displaying. |
String | className() |
KCompletionBox | completionBox(boolean create) |
KCompletionBox | completionBox() |
int | completionMode()
Returns the current completion mode.
|
KCompletion | completionObject(boolean hsig)
Returns a pointer to the current completion object.
|
KCompletion | completionObject() |
KCompletion | compObj()
Returns a pointer to the completion object.
|
boolean | contains(String text)
Convenience method which iterates over all items and checks if
any of them is equal to text.
If text is an empty string, false
is returned. |
protected void | create(long arg1, boolean initializeWindow, boolean destroyOldWindow)
Reimplemented for internal reasons, the API is not affected. |
protected void | create(long arg1, boolean initializeWindow) |
protected void | create(long arg1) |
protected void | create() |
int | cursorPosition()
Returns the current cursor position.
|
protected KCompletionBaseInterface | delegate()
Returns the delegation object. |
void | dispose() Delete the wrapped C++ instance ahead of finalize() |
boolean | emitSignals()
Returns true if the object emits the signals. |
boolean | eventFilter(QObject arg1, QEvent arg2)
Re-implemented for internal reasons. |
protected void | finalize() Deletes the wrapped C++ instance |
KShortcut | getKeyBinding(int item)
Returns the key-binding used for the specified item.
|
boolean | handleSignals()
Returns true if the object handles the signals. |
void | insertURL(KURL url, int index)
Inserts url at position index into the combobox. |
void | insertURL(KURL url) |
void | insertURL(QPixmap pixmap, KURL url, int index)
Inserts url with the pixmap &p pixmap at position index into
the combobox. |
void | insertURL(QPixmap pixmap, KURL url) |
boolean | isCompletionObjectAutoDeleted()
Returns true if the completion object is deleted
upon this widget's destruction.
|
boolean | isContextMenuEnabled()
Returns true when the context menu is enabled. |
boolean | isDisposed() Has the wrapped C++ instance been deleted? |
boolean | isURLDropsEnabled()
Returns true when decoded URL drops are enabled |
protected void | makeCompletion(String arg1)
Completes text according to the completion mode.
|
QMetaObject | metaObject() |
void | rotateText(int type)
Iterates through all possible matches of the completed text
or the history list.
|
void | setAutoCompletion(boolean autocomplete)
Re-implemented from QComboBox.
|
void | setAutoDeleteCompletionObject(boolean autoDelete)
Sets the completion object when this widget's destructor
is called.
|
void | setCompletedItems(String[] items)
Sets items into the completion-box if completionMode() is
CompletionPopup. |
void | setCompletedText(String arg1)
Sets the completed text in the line-edit appropriately.
|
protected void | setCompletedText(String arg1, boolean arg2) |
void | setCompletionMode(int mode)
Sets the type of completion to be used.
|
void | setCompletionObject(KCompletion compObj, boolean hsig)
Sets up the completion object to be used.
|
void | setCompletionObject(KCompletion compObj) |
void | setContextMenuEnabled(boolean showMenu)
Enables or disable the popup (context) menu.
|
void | setCurrentItem(String item, boolean insert, int index)
Selects the first item that matches item. If there is no such item,
it is inserted at position index if insert is true. |
void | setCurrentItem(String item, boolean insert) |
void | setCurrentItem(String item) |
void | setCurrentItem(int index)
Simply calls QComboBox' implementation. |
protected void | setDelegate(KCompletionBaseInterface delegate)
Sets or removes the delegation object. |
void | setEditURL(KURL url)
Sets url into the edit field of the combobox. |
void | setEnableSignals(boolean enable)
Sets the widget's ability to emit text completion and
rotation signals.
|
void | setHandleSignals(boolean handle)
Enables this object to handle completion and rotation
events internally.
|
boolean | setKeyBinding(int item, KShortcut key)
Sets the key-binding to be used for manual text
completion, text rotation in a history list as
well as a completion list.
|
void | setLineEdit(QLineEdit arg1)
Re-implemented for internal reasons. |
void | setTrapReturnKey(boolean trap)
By default, KComboBox recognizes Key_Return and Key_Enter
and emits the returnPressed() signals, but it also lets the
event pass, for example causing a dialog's default-button to
be called.
|
void | setURLDropsEnabled(boolean enable)
Enables/Disables handling of URL drops. |
boolean | trapReturnKey() |
void | useGlobalKeyBindings()
Sets this object to use global values for key-bindings.
|
protected void | wheelEvent(QWheelEvent ev) |
Parameters: parent The parent object of this widget name The name of this widget
UNKNOWN: Constructs a read-only or rather select-only combo box with a parent object and a name.
rw
) with a parent, a
name.Parameters: rw When true
, widget will be editable. parent The parent object of this widget. name The name of this widget.
UNKNOWN: Constructs a "read-write" or "read-only" combo box depending on the value of the first argument( rw
) with a parent, a name.
true
if the current completion mode is set
to automatic. See its more comprehensive replacement
completionMode().Returns: true
when completion mode is automatic.
UNKNOWN: Re-implemented from QComboBox.
index
with url.
KURL.prettyURL() is used so that the url is properly decoded
for displaying.UNKNOWN: Replaces the item at position index
with url.
index
with url
and pixmap pixmap.
KURL.prettyURL() is used so that the url is properly decoded
for displaying.UNKNOWN: Replaces the item at position index
with url
and pixmap pixmap.
Parameters: create Set this to false if you don't want the box to be created i.e. to test if it is available.
Returns: the completion-box, that is used in completion mode KGlobalSettings.CompletionPopup and KGlobalSettings.CompletionPopupAuto. This method will create a completion-box by calling KLineEdit.completionBox, if none is there, yet.
UNKNOWN:
Returns: the completion mode.
UNKNOWN: Returns the current completion mode.
hsig
is set to false. It is also automatically destroyed when the destructor
is called. You can change this default behavior using the
KComboBox and KComboBox member
functions.
See also KComboBox.Parameters: hsig if true, handles completion signals internally.
Returns: a pointer the completion object.
UNKNOWN: Returns a pointer to the current completion object.
NULL.
Use this method to get the
pointer to a completion object when inheriting so that you
won't inadvertently create it!!Returns: the completion object or NULL if one does not exist.
UNKNOWN: Returns a pointer to the completion object.
text.
If text
is an empty string, false
is returned.Returns: true
if an item with the string text
is in the combobox.
UNKNOWN: Convenience method which iterates over all items and checks if any of them is equal to text.
UNKNOWN: Reimplemented for internal reasons, the API is not affected.
Returns: Current cursor position.
UNKNOWN: Returns the current cursor position.
Returns: the delegation object, or 0 if there is none
See Also: KComboBox
UNKNOWN: Returns the delegation object.
Returns: true if signals are emitted
UNKNOWN: Returns true if the object emits the signals.
UNKNOWN: Re-implemented for internal reasons.
item.
If the binding
contains modifier key(s), the SUM of the modifier key
and the actual key code are returned.Parameters: item the item to check
Returns: the key-binding used for the feature given by item.
See Also: KComboBox
UNKNOWN: Returns the key-binding used for the specified item.
Returns: true if this signals are handled internally.
UNKNOWN: Returns true if the object handles the signals.
url
at position index
into the combobox. The item will
be appended if index
is negative. KURL.prettyURL() is used
so that the url is properly decoded for displaying.UNKNOWN: Inserts url
at position index
into the combobox.
url
with the pixmap &p pixmap at position index
into
the combobox. The item will be appended if index
is negative.
KURL.prettyURL() is used so that the url is properly decoded
for displaying.UNKNOWN: Inserts url
with the pixmap &p pixmap at position index
into the combobox.
Returns: true if the completion object will be deleted automatically
UNKNOWN: Returns true if the completion object is deleted upon this widget's destruction.
true
when the context menu is enabled.UNKNOWN: Returns true
when the context menu is enabled.
true
when decoded URL drops are enabledUNKNOWN: Returns true
when decoded URL drops are enabled
not
invoked if the completion mode is
set to CompletionNone. Also if the mode is set to CompletionShell
and multiple matches are found, this method will complete the
text to the first match with a beep to inidicate that there are
more matches. Then any successive completion key event iterates
through the remaining matches. This way the rotation functionality
is left to iterate through the list as usual.UNKNOWN: Completes text according to the completion mode.
QComobBox
.AtTop or QComboBox
.AtBottom.
For other insertion modes whatever has been typed by the user
when the rotation event was initiated will be lost.Parameters: type The key-binding invoked.
UNKNOWN: Iterates through all possible matches of the completed text or the history list.
true
, the completion mode will be set to automatic.
Otherwise, it is defaulted to the global setting. This
method has been replaced by the more comprehensive
setCompletionMode().Parameters: autocomplete Flag to enable/disable automatic completion mode.
UNKNOWN: Re-implemented from QComboBox.
Parameters: autoDelete if true, delete completion object on destruction.
UNKNOWN: Sets the completion object when this widget's destructor is called.
items
into the completion-box if completionMode() is
CompletionPopup. The popup will be shown immediately.UNKNOWN: Sets items
into the completion-box if completionMode() is CompletionPopup.
UNKNOWN: Sets the completed text in the line-edit appropriately.
Parameters: mode Completion type:
Parameters: compObj a KCompletion() or a derived child object. hsig if true, handles completion signals internally.
UNKNOWN: Sets up the completion object to be used.
Parameters: showMenu If true
, show the context menu.
UNKNOWN: Enables or disable the popup (context) menu.
item.
If there is no such item,
it is inserted at position index
if insert
is true. Otherwise,
no item is selected.UNKNOWN: Selects the first item that matches item.
UNKNOWN: Simply calls QComboBox' implementation.
Parameters: delegate the delegation object, or 0 to remove it
UNKNOWN: Sets or removes the delegation object.
url
into the edit field of the combobox. It uses
KURL.prettyURL() so that the url is properly decoded for
displaying.UNKNOWN: Sets url
into the edit field of the combobox.
enable
set to false
will
cause the completion & rotation signals not to be emitted.
However, unlike setting the completion object to NULL
using setCompletionObject, disabling the emition of
the signals through this method does not affect the current
completion object.
There is no need to invoke this function by default. When a
completion object is created through completionObject or
setCompletionObject, these signals are set to emit
automatically. Also note that disabling this signals will not
necessarily interfere with the objects ability to handle these
events internally. See setHandleSignals.Parameters: enable if false, disables the emition of completion & rotation signals.
UNKNOWN: Sets the widget's ability to emit text completion and rotation signals.
Parameters: handle if true, handle completion & rotation internally.
UNKNOWN: Enables this object to handle completion and rotation events internally.
key
is negative or the supplied key-binding conflicts
with the ones set for one of the other features.
NOTE: To use a modifier key (Shift, Ctrl, Alt) as part of
the key-binding simply simply sum
up the values of the
modifier and the actual key. For example, to use CTRL+E as
a key binding for one of the items, you would simply supply
"Qt.CtrlButton + Qt.Key_E" as the second argument to this
function.Parameters: item the feature whose key-binding needs to be set:
Returns: true if key-binding can successfully be set.
See Also: KComboBox
UNKNOWN: Sets the key-binding to be used for manual text completion, text rotation in a history list as well as a completion list.
UNKNOWN: Re-implemented for internal reasons.
trap
equal to true to make KComboBox
stop these events. The signals will still be emitted of course.
Only affects read-writable comboboxes.See Also: KComboBox
UNKNOWN: By default, KComboBox recognizes Key_Return and Key_Enter and emits the returnPressed() signals, but it also lets the event pass, for example causing a dialog's default-button to be called.
Parameters: enable If true
, insert decoded URLs
UNKNOWN: Enables/Disables handling of URL drops.
Returns: true
if keyevents of Key_Return or Key_Enter will
be stopped or if they will be propagated.
See Also: KComboBox
UNKNOWN:
UNKNOWN: Sets this object to use global values for key-bindings.