8#if QT_CONFIG(itemviews)
11#if QT_CONFIG(draganddrop)
18#if QT_CONFIG(accessibility)
26#if QT_CONFIG(animation)
76#if QT_CONFIG(completer)
78void QLineEditPrivate::_q_completionHighlighted(
const QString &newText)
89 const bool mark =
true;
111#if QT_CONFIG(completer)
122 emit q->cursorPositionChanged(from, to);
125#ifdef QT_KEYPAD_NAVIGATION
126void QLineEditPrivate::_q_editFocusChange(
bool e)
138 q->initStyleOption(&
opt);
145 emit q->selectionChanged();
146#if QT_CONFIG(accessibility)
149 QAccessible::updateAccessibility(&ev);
174#ifdef QT_KEYPAD_NAVIGATION
176 q,
SLOT(_q_editFocusChange(
bool)));
179 q,
SLOT(updateMicroFocus()));
182 q,
SLOT(updateMicroFocus()));
185 q,
SLOT(updateMicroFocus()));
192 q,
SLOT(updateMicroFocus()));
202 q->initStyleOption(&
opt);
215 q->setMouseTracking(
true);
216 q->setAcceptDrops(
true);
232 q->initStyleOption(&
opt);
266 if (
q->hasFocus() &&
qApp) {
280 int tmp_cursor =
xToPos(
e->position().toPoint().x());
299#if QT_CONFIG(draganddrop)
300void QLineEditPrivate::drag()
315#if QT_CONFIG(toolbutton)
325 QLineEdit *
le = qobject_cast<QLineEdit *>(parentWidget());
349 const auto *action =
e->action();
350 if (isVisibleTo(parentWidget()) != action->isVisible()) {
351 setVisible(action->isVisible());
363void QLineEditIconButton::setOpacity(
qreal value)
372#if QT_CONFIG(animation)
373bool QLineEditIconButton::shouldHideWithText()
const
375 return m_hideWithText;
378void QLineEditIconButton::setHideWithText(
bool hide)
380 m_hideWithText =
hide;
383void QLineEditIconButton::onAnimationFinished()
385 if (shouldHideWithText() &&
isVisible() && m_fadingOut) {
390 if (
auto le = lineEditPrivate())
391 le->updateGeometry_helper(
true);
395void QLineEditIconButton::animateShow(
bool visible)
397 m_fadingOut = !visible;
399 if (shouldHideWithText() && !
isVisible()) {
403 if (
auto le = lineEditPrivate())
404 le->updateGeometry_helper(
true);
407 startOpacityAnimation(visible ? 1.0 : 0.0);
410void QLineEditIconButton::startOpacityAnimation(
qreal endValue)
421void QLineEditIconButton::updateCursor()
429#if QT_CONFIG(animation) && QT_CONFIG(toolbutton)
434 static_cast<QLineEditIconButton *
>(
e.widget)->animateShow(
display);
442 const int newTextSize =
text.
size();
443 if (!newTextSize || !lastTextSize) {
444 lastTextSize = newTextSize;
445#if QT_CONFIG(animation) && QT_CONFIG(toolbutton)
446 const bool display = newTextSize > 0;
447 displayWidgets(leadingSideWidgets,
display);
448 displayWidgets(trailingSideWidgets,
display);
457 if (!
q->text().isEmpty()) {
467 emit q->returnPressed();
468 emit q->editingFinished();
486 q->initStyleOption(&styleOption);
508 const QRect contentRect =
q->rect();
510 const int delta =
p.margin +
p.widgetWidth;
512 QSize(
p.widgetWidth,
p.widgetHeight));
514 e.widget->setGeometry(widgetGeometry);
516 if (
e.action->isVisible())
522 widgetGeometry.
moveLeft(contentRect.
width() -
p.widgetWidth -
p.margin);
524 e.widget->setGeometry(widgetGeometry);
526 if (
e.action->isVisible())
534QLineEditPrivate::SideWidgetLocation QLineEditPrivate::findSideWidget(
const QAction *
a)
const
537 for (
const auto &
e : leadingSideWidgets) {
543 for (
const auto &
e : trailingSideWidgets) {
558 lastTextSize =
q->text().size();
563 if (
QWidgetAction *widgetAction = qobject_cast<QWidgetAction *>(newAction)) {
564 if ((
w = widgetAction->requestWidget(
q)))
568#if QT_CONFIG(toolbutton)
569 QLineEditIconButton *toolButton =
new QLineEditIconButton(
q);
570 toolButton->setIcon(newAction->
icon());
575#if QT_CONFIG(animation)
578 toolButton->setHideWithText(
true);
581 toolButton->setDefaultAction(newAction);
590 for (
const SideWidgetEntry &
e : trailingSideWidgets) {
607 const SideWidgetLocation loc = {
position, -1};
608 const auto location = before ? findSideWidget(before) : loc;
610 const auto location = before ? findSideWidget(before) : SideWidgetLocation{
position, -1};
615 SideWidgetEntry(
w, newAction,
flags));
621void QLineEditPrivate::removeAction(
QAction *action)
624 const auto location = findSideWidget(action);
645 return defaultMargin;
649#if QT_CONFIG(toolbutton) && QT_CONFIG(animation)
651 if (auto* iconButton = qobject_cast<QLineEditIconButton*>(e.widget))
652 return iconButton->needsSpace();
655 return e.widget->isVisibleTo(e.widget->parentWidget());
658 return defaultMargin + (parameters.
margin + parameters.
widgetWidth) * visibleSideWidgetCount;
672#include "moc_qlineedit_p.cpp"
void start(QAbstractAnimation::DeletionPolicy policy=KeepWhenStopped)
Starts the animation.
void finished()
QAbstractAnimation emits this signal after the animation has stopped and has reached the end.
The QActionEvent class provides an event that is generated when a QAction is added,...
The QAction class provides an abstraction for user commands that can be added to different user inter...
QIcon icon
the action's icon
The QCursor class provides a mouse cursor with an arbitrary shape.
Qt::DropAction exec(Qt::DropActions supportedActions=Qt::MoveAction)
void setMimeData(QMimeData *data)
Sets the data to be sent to the given MIME data.
QObject * target() const
Returns the target of the drag and drop operation.
static QStyleHints * styleHints()
Returns the application's style hints.
static QInputMethod * inputMethod()
returns the input method.
The QIcon class provides scalable icons in different modes and states.
Mode
This enum type describes the mode for which a pixmap is intended to be used.
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
QRect adjustedControlRect(const QRect &) const
void positionSideWidgets()
QString textAfterCursor(int curPos) const
void _q_selectionChanged()
void _q_controlEditingFinished()
void _q_textEdited(const QString &)
void setClearButtonEnabled(bool enabled)
void _q_clearButtonClicked()
void init(const QString &)
static const int horizontalMargin
static const int verticalMargin
QWidgetLineControl * control
void updatePasswordEchoEditing(bool)
@ SideWidgetFadeInWithText
@ SideWidgetCreatedByWidgetAction
void initMouseYThreshold()
void _q_updateNeeded(const QRect &)
QIcon clearButtonIcon() const
bool shouldEnableInputMethod() const
QMargins effectiveTextMargins() const
void _q_cursorPositionChanged(int, int)
void _q_handleWindowActivate()
QRect adjustedContentsRect() const
const SideWidgetEntryList & leftSideWidgetList() const
const SideWidgetEntryList & rightSideWidgetList() const
void _q_textChanged(const QString &)
bool sendMouseEventToInputContext(QMouseEvent *e)
This function is not intended as polymorphic usage.
QString textBeforeCursor(int curPos) const
void setText(const QString &text)
void setCursorVisible(bool visible)
SideWidgetParameters sideWidgetParameters() const
bool hasSideWidgets() const
std::vector< SideWidgetEntry > SideWidgetEntryList
int xToPos(int x, QTextLine::CursorPosition=QTextLine::CursorBetweenCharacters) const
bool inSelection(int x) const
The QLineEdit widget is a one-line text editor.
ActionPosition
This enum type describes how a line edit should display the action widgets to be added.
iterator erase(const_iterator begin, const_iterator end)
iterator insert(qsizetype i, parameter_type t)
bool empty() const noexcept
constexpr int bottom() const noexcept
Returns the bottom margin.
constexpr int left() const noexcept
Returns the left margin.
constexpr int right() const noexcept
Returns the right margin.
constexpr int top() const noexcept
Returns the top margin.
void setText(const QString &text)
Sets text as the plain text (MIME type text/plain) used to represent the data.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void setParent(QObject *parent)
Makes the object a child of parent.
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
\threadsafe
The QPaintEvent class contains event parameters for paint events.
The QPainter class performs low-level painting on widgets and other paint devices.
void setOpacity(qreal opacity)
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr void moveCenter(const QPoint &p) noexcept
Moves the rectangle, leaving the center point at the given position.
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr QRect marginsRemoved(const QMargins &margins) const noexcept
Removes the margins from the rectangle, shrinking it.
constexpr void moveLeft(int pos) noexcept
Moves the rectangle horizontally, leaving the rectangle's left edge at the given x coordinate.
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr QRect translated(int dx, int dy) const noexcept
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis,...
The QSizePolicy class is a layout attribute describing horizontal and vertical resizing policy.
\macro QT_RESTRICTED_CAST_FROM_ASCII
qsizetype size() const
Returns the number of characters in this string.
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
QString left(qsizetype n) const
Returns a substring that contains the n leftmost characters of the string.
int mouseQuickSelectionThreshold
Quick selection mouse threshold in QLineEdit.
\variable QStyleOptionFocusRect::backgroundColor
@ SH_LineEdit_PasswordMaskDelay
@ SH_LineEdit_PasswordCharacter
@ SH_BlinkCursorWhenTextSelected
CursorPosition
\value CursorBetweenCharacters \value CursorOnCharacter
void setDuration(int msecs)
void setEndValue(const QVariant &value)
void textChanged(const QString &newText)
struct wl_display * display
Combined button and popup list for selecting options.
QTextStream & center(QTextStream &stream)
Calls QTextStream::setFieldAlignment(QTextStream::AlignCenter) on stream and returns stream.
#define QByteArrayLiteral(str)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
static int effectiveTextMargin(int defaultMargin, const QLineEditPrivate::SideWidgetEntryList &widgets, const QLineEditPrivate::SideWidgetParameters ¶meters)
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLdouble GLdouble GLdouble GLdouble q
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)
QList< QWidget * > widgets
[11]
item setCursor(Qt::IBeamCursor)
[1]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent