An abstract base class for adding a completion feature into widgets.
This is a convenience class that provides the basic functions needed to add text completion support into widgets. All that is required is an implementation for the pure virtual function setCompletedText(). Refer to KLineEdit or KComboBox to see how easily such support can be added using this as a base class.
An abstract class for adding text completion support to widgets.
- Dawit Alemayehu firstname.lastname@example.org@email@example.com
Definition at line 47 of file kcompletionbase.h.
Sets up the completion object to be used.
This method assigns the completion object and sets it up to automatically handle the completion and rotation signals internally. You should use this function if you want to share one completion object among your widgets or need to use a customized completion object.
The object assigned through this method is not deleted when this object's destructor is invoked unless you explicitly call setAutoDeleteCompletionObject after calling this method. Be sure to set the bool argument to false, if you want to handle the completion signals yourself.
|completionObject||a KCompletion or a derived child object. |
|handleCompletionSignals||if true, handles completion signals internally. |
Reimplemented in KLineEdit, and KUrlComboBox.
Definition at line 113 of file kcompletionbase.cpp.
Sets the widget's ability to emit text completion and rotation signals.
Invoking this function with
enable set to
false will cause the completion and rotation signals not to be emitted. However, unlike setting the completion object to
NULL using setCompletionObject, disabling the emission 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.
|enable||if false, disables the emission of completion and rotation signals. |
Definition at line 163 of file kcompletionbase.cpp.
Sets the key binding to be used for manual text completion, text rotation in a history list as well as a completion list.
When the keys set by this function are pressed, a signal defined by the inheriting widget will be activated. If the default value or 0 is specified by the second parameter, then the key binding as defined in the global setting should be used. This method returns false when
key is negative or the supplied key binding conflicts with another one set for another feature.
NOTE: To use a modifier key (Shift, Ctrl, Alt) as part of the key binding simply
sum up the values of the modifier and the actual key. For example, to use CTRL+E, supply
"Qt::CtrlButton + Qt::Key_E" as the second argument to this function.
|item||the feature whose key binding needs to be set: |
- TextCompletion the manual completion key binding.
- PrevCompletionMatch the previous match key for multiple completion.
- NextCompletionMatch the next match key for for multiple completion.
- SubstringCompletion the key for substring completion
|key||key binding used to rotate down in a list. |
- true if key binding is successfully set.
- See also
Definition at line 217 of file kcompletionbase.cpp.
Sets this object to use global values for key bindings.
This method changes the values of the key bindings for rotation and completion features to the default values provided in KGlobalSettings.
NOTE: By default, inheriting widgets should use the global key bindings so that there is no need to call this method.
Definition at line 240 of file kcompletionbase.cpp.