KCompletion
kcombobox.h
101 * connect(combo, &KComboBox::returnPressed, comp, [this](const QString &text) { addItem(text); });
119 * connect(combo, &KComboBox::returnPressed, comp, [this](const QString &text) { addItem(text); });
131 * \image html kcombobox.png "KComboBox widgets, one non-editable, one editable with KUrlCompletion"
135class KCOMPLETION_EXPORT KComboBox : public QComboBox, public KCompletionBase // krazy:exclude=qclasses
void substringCompletion(const QString &)
Emitted when the shortcut for substring completion is pressed.
void aboutToShowContextMenu(QMenu *contextMenu)
Emitted before the context menu is displayed.
QMenu * contextMenu() const
Pointer to KLineEdit's context menu, or nullptr if it does not exist at the given moment.
Definition kcombobox.cpp:300
bool contains(const QString &text) const
Convenience method which iterates over all items and checks if any of them is equal to text.
Definition kcombobox.cpp:64
void completionModeChanged(KCompletion::CompletionMode)
Emitted whenever the completion mode is changed by the user through the context menu.
virtual void makeCompletion(const QString &)
Completes text according to the completion mode.
Definition kcombobox.cpp:125
void setEditUrl(const QUrl &url)
Sets url into the edit field of the combo box.
Definition kcombobox.cpp:167
void setCurrentItem(const QString &item, bool insert=false, int index=-1)
Selects the first item that matches item.
Definition kcombobox.cpp:305
bool urlDropsEnabled() const
Returns true when decoded URL drops are enabled.
Definition kcombobox.cpp:103
void changeUrl(int index, const QUrl &url)
Replaces the item at position index with url.
Definition kcombobox.cpp:192
void textRotation(KCompletionBase::KeyBindingType)
Emitted when the text rotation key bindings are pressed.
void returnPressed(const QString &text)
Emitted when the user presses the Return or Enter key.
void setTrapReturnKey(bool trap)
By default, KComboBox recognizes Key_Return and Key_Enter and emits the returnPressed(const QString &...
Definition kcombobox.cpp:149
void insertUrl(int index, const QUrl &url)
Inserts url at position index into the combo box.
Definition kcombobox.cpp:182
KCompletionBox * completionBox(bool create=true)
This method will create a completion box by calling KLineEdit::completionBox, if none is there yet.
Definition kcombobox.cpp:211
virtual void setAutoCompletion(bool autocomplete)
Reimplemented from QComboBox.
Definition kcombobox.cpp:84
void rotateText(KCompletionBase::KeyBindingType type)
Iterates through all possible matches of the completed text or the history list.
Definition kcombobox.cpp:141
KComboBox(QWidget *parent=nullptr)
Constructs a read-only (or rather select-only) combo box.
Definition kcombobox.cpp:38
virtual void setCompletedItems(const QStringList &items, bool autoSuggest=true)=0
A pure virtual function that must be implemented by all inheriting classes.
virtual void setCompletedText(const QString &text)=0
A pure virtual function that must be implemented by all inheriting classes.
KeyBindingType
Constants that represent the items whose shortcut key binding is programmable.
Definition kcompletionbase.h:45
A helper widget for "completion-widgets" (KLineEdit, KComboBox))
Definition kcompletionbox.h:37
CompletionMode
This enum describes the completion mode used for by the KCompletion class.
Definition kcompletion.h:131
QComboBox(QWidget *parent)
void setEditable(bool editable)
virtual QSize minimumSizeHint() const const override
void setLineEdit(QLineEdit *edit)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
QWidget(QWidget *parent, Qt::WindowFlags f)
void create(WId window, bool initializeWindow, bool destroyOldWindow)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:58:10 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:58:10 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.