KCompletion
klineedit.cpp
186 if (mode == KCompletion::CompletionPopupAuto || mode == KCompletion::CompletionAuto || mode == KCompletion::CompletionMan) {
356 const int labelWidth = q->size().width() - 2 * q->style()->pixelMetric(QStyle::PM_DefaultFrameWidth) - 2;
362 // TODO: better would be "…" char (0x2026), but for that one would need to ensure it's from the main font,
363 // otherwise if resulting in use of a new fallback font this can affect the metrics of the complete text,
669 } else if ((mode == KCompletion::CompletionPopup || mode == KCompletion::CompletionPopupAuto) //
910 QAction *clearAllAction = new QAction(QIcon::fromTheme(QStringLiteral("edit-clear")), tr("C&lear", "@action:inmenu"), this);
923 if (compObj() && !isReadOnly() && KAuthorized::authorize(QStringLiteral("lineedit_text_completion"))) {
924 QMenu *subMenu = popup->addMenu(QIcon::fromTheme(QStringLiteral("text-completion")), tr("Text Completion", "@title:menu"));
936 d->shortAutoCompletionAction = ag->addAction(tr("Short Automatic", "@item:inmenu Text Completion"));
937 d->popupAutoCompletionAction = ag->addAction(tr("Dropdown List && Automatic", "@item:inmenu Text Completion"));
954 d->popupAutoCompletionAction->setEnabled(!d->disableCompletionMap[KCompletion::CompletionPopupAuto]);
1014 if ((oldMode == KCompletion::CompletionPopup || oldMode == KCompletion::CompletionPopupAuto) //
1032 } else if (ev->type() == QEvent::ApplicationPaletteChange || ev->type() == QEvent::PaletteChange) {
1085 connect(d->completionBox, &KCompletionBox::currentTextChanged, this, [d](const QString &text) {
1091 connect(d->completionBox, &KCompletionBox::textActivated, this, &KLineEdit::completionBoxActivated);
1243 const QList<QListWidgetItem *> matchedItems = d->completionBox->findItems(currentSelection, Qt::MatchExactly);
1296 d->m_matchesConnection = connect(comp, &KCompletion::matches, this, [this](const QStringList &list) {
static Q_INVOKABLE bool authorize(const QString &action)
bool handleSignals() const
Returns true if the object handles the signals.
Definition kcompletionbase.cpp:163
virtual void setCompletionMode(KCompletion::CompletionMode mode)
Sets the type of completion to be used.
Definition kcompletionbase.cpp:185
KCompletion * compObj() const
Returns a pointer to the completion object.
Definition kcompletionbase.cpp:246
virtual void setCompletionObject(KCompletion *completionObject, bool handleSignals=true)
Sets up the completion object to be used.
Definition kcompletionbase.cpp:104
bool emitSignals() const
Returns true if the object emits the signals.
Definition kcompletionbase.cpp:169
KCompletion::CompletionMode completionMode() const
Returns the current completion mode.
Definition kcompletionbase.cpp:201
KeyBindingType
Constants that represent the items whose shortcut key binding is programmable.
Definition kcompletionbase.h:45
@ NextCompletionMatch
Switch to next completion (by default Ctrl-Down).
Definition kcompletionbase.h:57
@ PrevCompletionMatch
Switch to previous completion (by default Ctrl-Up).
Definition kcompletionbase.h:53
A helper widget for "completion-widgets" (KLineEdit, KComboBox))
Definition kcompletionbox.h:37
void userCancelled(const QString &)
Emitted whenever the user chooses to ignore the available selections and closes this box.
void textActivated(const QString &text)
Emitted when an item is selected, text is the text of the selected item.
QString nextMatch()
Returns the next item from the list of matching items.
Definition kcompletion.cpp:445
virtual QString makeCompletion(const QString &string)
Attempts to find an item in the list of available completions that begins with string.
Definition kcompletion.cpp:262
void matches(const QStringList &matchlist)
This signal is emitted by makeCompletion() in shell-completion mode when the same string is passed to...
QStringList allMatches()
Returns a list of all items matching the last completed string.
Definition kcompletion.cpp:374
CompletionMode
This enum describes the completion mode used for by the KCompletion class.
Definition kcompletion.h:131
@ CompletionPopupAuto
Lists all possible matches in a popup list box to choose from, and automatically fills the result whe...
Definition kcompletion.h:156
@ CompletionMan
Same as automatic, but shortest match is used for completion.
Definition kcompletion.h:143
@ CompletionShell
Completes text much in the same way as a typical *nix shell would.
Definition kcompletion.h:147
@ CompletionPopup
Lists all possible matches in a popup list box to choose from.
Definition kcompletion.h:151
QString previousMatch()
Returns the next item from the list of matching items.
Definition kcompletion.cpp:483
bool shouldAutoSuggest() const
Informs the caller if they should display the auto-suggestion for the last completion operation perfo...
Definition kcompletion.cpp:362
static void setAutoHideCursor(QWidget *w, bool enable, bool customEventFilter=false)
static void autoHideEventFilter(QObject *, QEvent *)
void setCompletedText(const QString &) override
See KCompletionBase::setCompletedText.
Definition klineedit.cpp:221
void setCompletionMode(KCompletion::CompletionMode mode) override
Reimplemented from KCompletionBase for internal reasons.
Definition klineedit.cpp:165
KLineEdit(const QString &string, QWidget *parent=nullptr)
Constructs a KLineEdit object with a default text, a parent, and a name.
Definition klineedit.cpp:128
void setTrapReturnKey(bool trap)
By default, KLineEdit recognizes Key_Return and Key_Enter and emits the returnPressed() signals,...
Definition klineedit.cpp:1059
void setSqueezedTextEnabled(bool enable)
Enable text squeezing whenever the supplied text is too long.
Definition klineedit.cpp:324
void rotateText(KCompletionBase::KeyBindingType type)
Iterates through all possible matches of the completed text or the history list.
Definition klineedit.cpp:231
void setCompletionObject(KCompletion *, bool handle=true) override
Reimplemented for internal reasons, the API is not affected.
Definition klineedit.cpp:1286
virtual void setText(const QString &)
Reimplemented to enable text squeezing.
Definition klineedit.cpp:336
void returnKeyPressed(const QString &text)
Emitted when the user presses the Return or Enter key.
void aboutToShowContextMenu(QMenu *contextMenu)
Emitted before the context menu is displayed.
void keyPressEvent(QKeyEvent *) override
Reimplemented for internal reasons.
Definition klineedit.cpp:465
void setCompletionBox(KCompletionBox *box)
Set the completion-box to be used in completion mode CompletionPopup.
Definition klineedit.cpp:1076
void setUserSelection(bool userSelection)
Sets the widget in userSelection mode or in automatic completion selection mode.
Definition klineedit.cpp:1304
bool urlDropsEnabled() const
Returns true when decoded URL drops are enabled.
Definition klineedit.cpp:1053
void setCompletedItems(const QStringList &items, bool autoSuggest=true) override
Same as the above function except it allows you to temporarily turn off text completion in Completion...
Definition klineedit.cpp:1216
bool autoSuggest() const
Whether in current state text should be auto-suggested.
Definition klineedit.cpp:1366
void textRotation(KCompletionBase::KeyBindingType)
Emitted when the text rotation key-bindings are pressed.
void resizeEvent(QResizeEvent *) override
Reimplemented for internal reasons.
Definition klineedit.cpp:455
void completionBoxActivated(const QString &)
Emitted whenever the completion box is activated.
void contextMenuEvent(QContextMenuEvent *) override
Reimplemented for internal reasons.
Definition klineedit.cpp:974
void clearButtonClicked()
Emitted when the user clicked on the clear button.
void mouseReleaseEvent(QMouseEvent *) override
Reimplemented for internal reasons.
Definition klineedit.cpp:864
void setSqueezedText(const QString &text)
Squeezes text into the line edit.
Definition klineedit.cpp:318
void setCompletionModeDisabled(KCompletion::CompletionMode mode, bool disable=true)
Disables completion modes by making them non-checkable.
Definition klineedit.cpp:195
QString originalText() const
Returns the original text if text squeezing is enabled.
Definition klineedit.cpp:1350
void mouseDoubleClickEvent(QMouseEvent *) override
Reimplemented for internal reasons.
Definition klineedit.cpp:830
virtual KCompletionBox * completionBox(bool create=true)
This method will create a completion-box if none is there, yet.
Definition klineedit.cpp:1274
void mousePressEvent(QMouseEvent *) override
Reimplemented for internal reasons.
Definition klineedit.cpp:842
void substringCompletion(const QString &)
Emitted when the shortcut for substring completion is pressed.
virtual void copy() const
Reimplemented for internal reasons, the API is not affected.
Definition klineedit.cpp:416
void userCancelled(const QString &cancelText)
Resets the current displayed text.
Definition klineedit.cpp:1111
bool isSqueezedTextEnabled() const
Returns true if text squeezing is enabled.
Definition klineedit.cpp:330
virtual void makeCompletion(const QString &)
Completes the remaining text with a matching one from a given list.
Definition klineedit.cpp:253
Q_SCRIPTABLE Q_NOREPLY void start()
QAction * end(const QObject *recvr, const char *slot, QObject *parent)
const QList< QKeySequence > & beginningOfLine()
const QList< QKeySequence > & cut()
const QList< QKeySequence > & undo()
const QList< QKeySequence > & deleteWordBack()
const QList< QKeySequence > & paste()
const QList< QKeySequence > & copy()
const QList< QKeySequence > & backwardWord()
const QList< QKeySequence > & endOfLine()
const QList< QKeySequence > & forwardWord()
const QList< QKeySequence > & shortcut(StandardShortcut id)
const QList< QKeySequence > & deleteWordForward()
const QList< QKeySequence > & pasteSelection()
const QList< QKeySequence > & redo()
NextCompletion
TextCompletion
PrevCompletion
SubstringCompletion
void setEnabled(bool)
void setShortcuts(QKeySequence::StandardKey key)
void triggered(bool checked)
QList< QAction * > actions() const const
QAction * addAction(QAction *action)
doubleClickInterval
bool isPrint(char32_t ucs4)
Clipboard
void setText(const QString &text, Mode mode)
QString text(Mode mode) const const
ShortcutOverride
void accept()
void ignore()
Type type() const const
QClipboard * clipboard()
QPalette palette()
QIcon fromTheme(const QString &name)
int toCombined() const const
int key() const const
bool matches(QKeySequence::StandardKey key) const const
Qt::KeyboardModifiers modifiers() const const
QString text() const const
DeleteCompleteLine
QList< QKeySequence > keyBindings(StandardKey key)
Normal
void backspace()
void clear()
bool isClearButtonEnabled() const const
void copy() const const
QMenu * createStandardContextMenu()
void setCursorPosition(int)
void cursorWordBackward(bool mark)
void cursorWordForward(bool mark)
void cut()
void del()
void deselect()
displayText
echoMode
void end(bool mark)
virtual bool event(QEvent *e) override
hasSelectedText
void home(bool mark)
void insert(const QString &newText)
virtual void keyPressEvent(QKeyEvent *event) override
bool isModified() const const
virtual void mouseDoubleClickEvent(QMouseEvent *e) override
virtual void mousePressEvent(QMouseEvent *e) override
virtual void mouseReleaseEvent(QMouseEvent *e) override
virtual void paintEvent(QPaintEvent *) override
void paste()
readOnly
void redo()
void returnPressed()
void selectAll()
selectedText
void selectionChanged()
int selectionStart() const const
void setSelection(int start, int length)
text
void textChanged(const QString &text)
void textEdited(const QString &text)
void undo()
const_reference at(qsizetype i) const const
bool contains(const AT &value) const const
qsizetype count() const const
T & first()
qsizetype indexOf(const AT &value, qsizetype from) const const
bool isEmpty() const const
void currentTextChanged(const QString ¤tText)
QString text() const const
Q_EMITQ_EMIT
bool blockSignals(bool block)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool disconnect(const QMetaObject::Connection &connection)
objectName
void objectNameChanged(const QString &objectName)
T qobject_cast(QObject *object)
QString tr(const char *sourceText, const char *disambiguation, int n)
Normal
HighlightedText
const QColor & color(ColorGroup group, ColorRole role) const const
void setColor(ColorGroup group, ColorRole role, const QColor &color)
Qt::MouseButton button() const const
bool isEmpty() const const
QString left(qsizetype n) const const
qsizetype length() const const
QString mid(qsizetype position, qsizetype n) const const
QString & remove(QChar ch, Qt::CaseSensitivity cs)
QString right(qsizetype n) const const
QString trimmed() const const
const QChar * unicode() const const
PM_DefaultFrameWidth
DefaultContextMenu
Key_Return
KeypadModifier
MatchExactly
CTRL
NoButton
WA_UpdatesDisabled
singleShot
void showText(const QPoint &pos, const QString &text, QWidget *w, const QRect &rect, int msecDisplayTime)
QString toDisplayString(FormattingOptions options) const const
QList< QAction * > actions() const const
void addActions(const QList< QAction * > &actions)
QPalette::ColorRole backgroundRole() const const
contextMenuPolicy
void create(WId window, bool initializeWindow, bool destroyOldWindow)
font
height
void insertAction(QAction *before, QAction *action)
palette
virtual void resizeEvent(QResizeEvent *event)
void setAttribute(Qt::WidgetAttribute attribute, bool on)
void setBackgroundRole(QPalette::ColorRole role)
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:04:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:04:01 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.