KDEUI
klineedit.cpp
Go to the documentation of this file.
102 clearButton->setAnimationsEnabled(KGlobalSettings::graphicEffectsLevel() & KGlobalSettings::SimpleAnimationEffects);
188 QAction *noCompletionAction, *shellCompletionAction, *autoCompletionAction, *popupCompletionAction, *shortAutoCompletionAction, *popupAutoCompletionAction, *defaultAction;
203 QRect KLineEditStyle::subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
265 connect(KGlobalSettings::self(), SIGNAL(settingsChanged(int)), this, SLOT(_k_slotSettingsChanged(int)));
294 d->clearButton->setToolTip( i18nc( "@action:button Clear current text in the line edit", "Clear text" ) );
592 const int labelWidth = size().width() - 2*style()->pixelMetric(QStyle::PM_DefaultFrameWidth) - 2;
684 QApplication::clipboard()->setText( t, clipboard ? QClipboard::Clipboard : QClipboard::Selection );
973 if ( ( txt != old_txt || txt != e->text() ) && len/* && ( cursorPosition() == len || force )*/ &&
1211 QMenu *subMenu = popup->addMenu( KIcon("text-completion"), i18nc("@title:menu", "Text Completion") );
1221 d->popupCompletionAction = ag->addAction( i18nc("@item:inmenu Text Completion", "Dropdown List") );
1222 d->shortAutoCompletionAction = ag->addAction( i18nc("@item:inmenu Text Completion", "Short Automatic") );
1223 d->popupAutoCompletionAction = ag->addAction( i18nc("@item:inmenu Text Completion", "Dropdown List && Automatic"));
1235 d->shellCompletionAction->setEnabled( !d->disableCompletionMap[ KGlobalSettings::CompletionShell ] );
1236 d->noCompletionAction->setEnabled( !d->disableCompletionMap[ KGlobalSettings::CompletionNone ] );
1237 d->popupCompletionAction->setEnabled( !d->disableCompletionMap[ KGlobalSettings::CompletionPopup ] );
1238 d->autoCompletionAction->setEnabled( !d->disableCompletionMap[ KGlobalSettings::CompletionAuto ] );
1239 d->shortAutoCompletionAction->setEnabled( !d->disableCompletionMap[ KGlobalSettings::CompletionMan ] );
1240 d->popupAutoCompletionAction->setEnabled( !d->disableCompletionMap[ KGlobalSettings::CompletionPopupAuto ] );
1595 const QList<QListWidgetItem*> matchedItems = d->completionBox->findItems(currentSelection, Qt::MatchExactly);
1799 QRect lineRect(cr.x() + horizontalMargin, vscroll, cr.width() - 2*horizontalMargin, fm.height());
const char * className() const
void initStyleOption(QStyleOptionFrame *option) const
void undo()
bool contains(const QKeySequence &needle) const
Returns whether at least one of the key sequences is equal to needle.
Definition: kshortcut.cpp:149
virtual void mouseDoubleClickEvent(QMouseEvent *)
Re-implemented for internal reasons.
Definition: klineedit.cpp:1102
Qt::KeyboardModifiers modifiers() const
const KShortcut & deleteWordForward()
Delete a word forward from mouse/cursor position.
Definition: kstandardshortcut.cpp:339
Type type() const
int doubleClickInterval()
const QPalette & palette() const
void create(WId window, bool initializeWindow, bool destroyOldWindow)
int width() const
static void setEditText(KLineEdit *edit, const QString &text)
Definition: klineedit.cpp:1454
const QMimeData * mimeData() const
void setColor(ColorGroup group, ColorRole role, const QColor &color)
QString text() const
void aboutToShowContextMenu(QMenu *menu)
Emitted before the context menu is displayed.
virtual void create(WId=0, bool initializeWindow=true, bool destroyOldWindow=true)
Reimplemented for internal reasons, the API is not affected.
Definition: klineedit.cpp:1655
A helper widget for "completion-widgets" (KLineEdit, KComboBox))
Definition: kcompletionbox.h:43
void addActions(QList< QAction * > actions)
QMenu * createStandardContextMenu()
Re-implemented for internal reasons.
Definition: klineedit.cpp:1180
virtual bool event(QEvent *e)
void paste()
QStyle * style() const
const KShortcut & shortcut(StandardShortcut id)
Returns the keybinding for accel.
Definition: kstandardshortcut.cpp:285
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const =0
virtual void setCompletionObject(KCompletion *, bool hsig=true)
Reimplemented for internal reasons, the API is not affected.
Definition: klineedit.cpp:1640
QWidget * childAt(int x, int y) const
const QColor & color(ColorGroup group, ColorRole role) const
const T & at(int i) const
int & rwidth()
virtual void setCompletedText(const QString &)
See KCompletionBase::setCompletedText.
Definition: klineedit.cpp:451
Switch to next completion (by default Ctrl-Down).
Definition: kcompletion.h:665
bool hasSelectedText() const
void setCompletionBox(KCompletionBox *box)
Set the completion-box to be used in completion mode KGlobalSettings::CompletionPopup.
Definition: klineedit.cpp:1431
QMenu * createStandardContextMenu()
virtual const QMetaObject * metaObject() const
bool isSqueezedTextEnabled() const
Returns true if text squeezing is enabled.
Definition: klineedit.cpp:564
void setAttribute(Qt::WidgetAttribute attribute, bool on)
EchoMode echoMode() const
void textChanged(const QString &text)
bool autoSuggest() const
Whether in current state text should be auto-suggested.
Definition: klineedit.cpp:1726
int height() const
QAction * addAction(QAction *action)
int x() const
int y() const
KCompletion * compObj() const
Returns a pointer to the completion object.
Definition: kcompletionbase.cpp:220
QString clickMessage() const
void textRotation(KCompletionBase::KeyBindingType)
Emitted when the text rotation key-bindings are pressed.
QString & remove(int position, int n)
static KGlobalSettings * self()
Return the KGlobalSettings singleton.
Definition: kglobalsettings.cpp:188
typedef Alignment
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
virtual void contextMenuEvent(QContextMenuEvent *)
Re-implemented for internal reasons.
Definition: klineedit.cpp:1261
void showText(const QPoint &pos, const QString &text, QWidget *w)
QPalette::ColorRole foregroundRole() const
QString selectedText() const
virtual void keyPressEvent(QKeyEvent *event)
void update()
KCompletionBox * completionBox(bool create=true)
Definition: klineedit.cpp:1629
void cursorWordBackward(bool mark)
static void autoHideEventFilter(QObject *, QEvent *)
KCursor has to install an eventFilter over the widget you want to auto-hide.
Definition: kcursor.cpp:208
virtual void clear()
Reimplemented to workaround a buggy QLineEdit::clear() (changing the clipboard to the text we just ha...
Definition: klineedit.cpp:1698
QString i18nc(const char *ctxt, const char *text)
bool isModified() const
virtual void keyPressEvent(QKeyEvent *)
Re-implemented for internal reasons.
Definition: klineedit.cpp:702
KSharedConfigPtr config()
void userCancelled(const QString &cancelText)
Resets the current displayed text.
Definition: klineedit.cpp:1465
int indexOf(const T &value, int from) const
bool isReadOnly() const
void clearButtonClicked()
Emitted when the user clicked on the clear button.
virtual void mousePressEvent(QMouseEvent *)
Re-implemented for internal reasons.
Definition: klineedit.cpp:1113
QSize size() const
virtual void setContextMenuEnabled(bool showMenu)
Enables/disables the popup (context) menu.
Definition: klineedit.cpp:1823
void setUrlDropsEnabled(bool enable)
Enables/Disables handling of URL drops.
Definition: klineedit.cpp:1406
bool isPrint() const
void setFont(const QFont &font)
void insertAction(QAction *before, QAction *action)
int count(const T &value) const
virtual void dropEvent(QDropEvent *)
Re-implemented to handle URI drops.
Definition: klineedit.cpp:1321
void ignore()
Substring completion (by default Ctrl-T).
Definition: kcompletion.h:669
void substringCompletion(const QString &)
Emitted when the shortcut for substring completion is pressed.
Switch to previous completion (by default Ctrl-Up).
Definition: kcompletion.h:661
Qt::LayoutDirection layoutDirection() const
QClipboard * clipboard()
static KUrl::List fromMimeData(const QMimeData *mimeData, KUrl::MetaDataMap *metaData=0)
bool passwordMode() const
void setPen(const QColor &color)
bool urlDropsEnabled() const
Returns true when decoded URL drops are enabled.
QStringList allMatches()
Returns a list of all items matching the last completed string.
Definition: kcompletion.cpp:339
Qt::MouseButton button() const
QPalette::ColorRole backgroundRole() const
bool isEmpty() const
bool isEmpty() const
virtual void setCompletionMode(KGlobalSettings::Completion mode)
Sets the type of completion to be used.
Definition: kcompletionbase.cpp:167
QString trimmed() const
Definition: kstandardaction.h:133
Text is automatically filled in whenever possible.
Definition: kglobalsettings.h:187
void setUserSelection(bool userSelection)
Sets the widget in userSelection mode or in automatic completion selection mode.
Definition: klineedit.cpp:1661
QString text() const
virtual void resizeEvent(QResizeEvent *)
Re-implemented for internal reasons.
Definition: klineedit.cpp:692
const KShortcut & beginningOfLine()
Goto beginning of current line.
Definition: kstandardshortcut.cpp:349
QPoint pos() const
KAction * clear(const QObject *recvr, const char *slot, QObject *parent)
Clear the content of the focus widget.
Definition: kstandardaction.cpp:314
void setSqueezedTextEnabled(bool enable)
Enable text squeezing whenever the supplied text is too long.
Definition: klineedit.cpp:559
void drawText(const QPointF &position, const QString &text)
virtual void focusOutEvent(QFocusEvent *e)
bool handleSignals() const
Returns true if the object handles the signals.
Definition: kcompletionbase.cpp:157
T & first()
void selectAll()
virtual void setCompletionMode(KGlobalSettings::Completion mode)
Re-implemented from KCompletionBase for internal reasons.
Definition: klineedit.cpp:400
void setSqueezedText(const QString &text)
Squeezes text into the line edit.
Definition: klineedit.cpp:553
QPalette palette()
virtual void paintEvent(QPaintEvent *)
void backspace()
bool matches(QKeySequence::StandardKey key) const
void redo()
const KShortcut & copy()
Copy selected area into the clipboard.
Definition: kstandardshortcut.cpp:335
void completionBoxActivated(const QString &)
Emitted whenever the completion box is activated.
QString right(int n) const
QRect adjusted(int dx1, int dy1, int dx2, int dy2) const
virtual void mouseReleaseEvent(QMouseEvent *e)
int selectionStart() const
QString originalText() const
Returns the original text if text squeezing is enabled.
Definition: klineedit.cpp:1713
iterator end()
static void setAutoHideCursor(QWidget *w, bool enable, bool customEventFilter=false)
Sets auto-hiding the cursor for widget w.
Definition: kcursor.cpp:202
int key() const
void textEdited(const QString &text)
void getTextMargins(int *left, int *top, int *right, int *bottom) const
void accept()
void insert(const QString &newText)
bool blockSignals(bool block)
void setTrapReturnKey(bool trap)
By default, KLineEdit recognizes Key_Return and Key_Enter and emits the returnPressed() signals...
Definition: klineedit.cpp:1416
const QFont & font() const
void setContextMenuPolicy(Qt::ContextMenuPolicy policy)
Qt::Alignment alignment() const
QString nextMatch()
Returns the next item from the matching-items-list.
Definition: kcompletion.cpp:404
void setItalic(bool enable)
virtual void mouseReleaseEvent(QMouseEvent *)
Re-implemented for internal reasons.
Definition: klineedit.cpp:1144
const KShortcut & cut()
Cut selected area and store it in the clipboard.
Definition: kstandardshortcut.cpp:334
Lists all possible matches in a popup list-box to choose from.
Definition: kglobalsettings.h:199
bool isContextMenuEnabled() const
Returns true when the context menu is enabled.
Definition: klineedit.cpp:1830
void returnPressed()
QString text(Mode mode) const
const QChar * unicode() const
Same as automatic except shortest match is used for completion.
Definition: kglobalsettings.h:191
virtual void focusInEvent(QFocusEvent *e)
QList< QAction * > actions() const
void end(bool mark)
virtual QString makeCompletion(const QString &string)
Attempts to find an item in the list of available completions, that begins with string.
Definition: kcompletion.cpp:229
void cut()
int width() const
void setClipRect(const QRectF &rectangle, Qt::ClipOperation operation)
QString mid(int position, int n) const
QFontMetrics fontMetrics() const
void del()
const KShortcut & deleteWordBack()
Delete a word back from mouse/cursor position.
Definition: kstandardshortcut.cpp:338
KLineEdit(const QString &string, QWidget *parent=0)
Constructs a KLineEdit object with a default text, a parent, and a name.
Definition: klineedit.cpp:232
const KShortcut & pasteSelection()
Paste the selection at mouse/cursor position.
Definition: kstandardshortcut.cpp:337
void home(bool mark)
void cursorWordForward(bool mark)
virtual void copy() const
Reimplemented for internal reasons, the API is not affected.
Definition: klineedit.cpp:657
void selectionChanged()
typedef ConstIterator
int height() const
int height() const
KAction * create(StandardAction id, const QObject *recvr, const char *slot, QObject *parent)
Creates an action corresponding to one of the KStandardAction::StandardAction actions, which is connected to the given object and slot, and is owned by parent.
Definition: kstandardaction.cpp:82
void adjust(int dx1, int dy1, int dx2, int dy2)
Completion
This enum describes the completion mode used for by the KCompletion class.
Definition: kglobalsettings.h:179
virtual void setCompletionObject(KCompletion *compObj, bool hsig=true)
Sets up the completion object to be used.
Definition: kcompletionbase.cpp:109
QPixmap SmallIcon(const QString &name, int force_size, int state, const QStringList &overlays)
Definition: kiconloader.cpp:1553
int length() const
bool emitSignals() const
Returns true if the object emits the signals.
Definition: kcompletionbase.cpp:162
KeyBindingType
Constants that represent the items whose short-cut key-binding is programmable.
Definition: kcompletion.h:653
QString left(int n) const
bool authorize(const QString &genericAction)
void completionModeChanged(KGlobalSettings::Completion)
Emitted when the user changed the completion mode by using the popupmenu.
void setAlphaF(qreal alpha)
void setClearButtonShown(bool show)
This makes the line edit display an icon on one side of the line edit which, when clicked...
Definition: klineedit.cpp:284
void setText(const QString &text, Mode mode)
Complete text much in the same way as a typical *nix shell would.
Definition: kglobalsettings.h:195
void setClickMessage(const QString &msg)
This makes the line edit display a grayed-out hinting text as long as the user didn't enter any text...
Definition: klineedit.cpp:1815
virtual QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const =0
const QPoint & pos() const
void setToolTip(const QString &)
static GraphicEffects graphicEffectsLevel()
This function determines the desired level of effects on the GUI.
Definition: kglobalsettings.cpp:782
virtual void resizeEvent(QResizeEvent *event)
void copy() const
static Completion completionMode()
Returns the preferred completion mode setting.
Definition: kglobalsettings.cpp:267
void setBackgroundRole(QPalette::ColorRole role)
void setCursorPosition(int)
static void assignIconsToContextMenu(ContextMenus type, QList< QAction * > actions)
Assigns standard icons to the various standard text edit context menus.
Definition: kicontheme.cpp:599
virtual void makeCompletion(const QString &)
Completes the remaining text with a matching one from a given list.
Definition: klineedit.cpp:482
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QList< QAction * > actions() const
virtual void setText(const QString &)
Re-implemented to enable text squeezing.
Definition: klineedit.cpp:569
void setStyle(QStyle *style)
void setCompletedItems(const QStringList &items, bool autoSuggest=true)
Same as the above function except it allows you to temporarily turn off text completion in Completion...
Definition: klineedit.cpp:1567
virtual void mouseDoubleClickEvent(QMouseEvent *e)
void deselect()
QChar * data()
Definition: kicontheme.h:202
T readEntry(const QString &key, const T &aDefault) const
void accept(bool accept)
iterator begin()
GUI with simple animations enabled.
Definition: kglobalsettings.h:467
QString prettyUrl(AdjustPathOption trailing=LeaveTrailingSlash) const
void setEnabled(bool)
QString text() const
KGlobalSettings::Completion completionMode() const
Returns the current completion mode.
Definition: kcompletionbase.cpp:181
QString previousMatch()
Returns the next item from the matching-items-list.
Definition: kcompletion.cpp:442
void rotateText(KCompletionBase::KeyBindingType type)
Iterates through all possible matches of the completed text or the history list.
Definition: klineedit.cpp:461
Lists all possible matches in a popup list-box to choose from, and automatically fill the result when...
Definition: kglobalsettings.h:204
virtual void mousePressEvent(QMouseEvent *e)
void setCompletionModeDisabled(KGlobalSettings::Completion mode, bool disable=true)
Disables completion modes by makeing them non-checkable.
Definition: klineedit.cpp:427
const KShortcut & paste()
Paste contents of clipboard at mouse/cursor position.
Definition: kstandardshortcut.cpp:336
void setSelection(int start, int length)
singleShot
QString displayText() const
typedef KeyboardModifiers
virtual void dropEvent(QDropEvent *e)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:59 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.