| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qlineedit.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | - | |||||||||||||||||||||||||
| 8 | - | |||||||||||||||||||||||||
| 9 | - | |||||||||||||||||||||||||
| 10 | - | |||||||||||||||||||||||||
| 11 | - | |||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||
| 16 | - | |||||||||||||||||||||||||
| 17 | - | |||||||||||||||||||||||||
| 18 | void QLineEdit::initStyleOption(QStyleOptionFrame *option) const | - | ||||||||||||||||||||||||
| 19 | { | - | ||||||||||||||||||||||||
| 20 | if (!option
| 0 | ||||||||||||||||||||||||
| 21 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 22 | - | |||||||||||||||||||||||||
| 23 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 24 | option->initFrom(this); | - | ||||||||||||||||||||||||
| 25 | option->rect = contentsRect(); | - | ||||||||||||||||||||||||
| 26 | option->lineWidth = d->frame
| 0 | ||||||||||||||||||||||||
| 27 | : 0; | - | ||||||||||||||||||||||||
| 28 | option->midLineWidth = 0; | - | ||||||||||||||||||||||||
| 29 | option->state |= QStyle::State_Sunken; | - | ||||||||||||||||||||||||
| 30 | if (d->control->isReadOnly()
| 0 | ||||||||||||||||||||||||
| 31 | option->state |= QStyle::State_ReadOnly; never executed: option->state |= QStyle::State_ReadOnly; | 0 | ||||||||||||||||||||||||
| 32 | - | |||||||||||||||||||||||||
| 33 | - | |||||||||||||||||||||||||
| 34 | - | |||||||||||||||||||||||||
| 35 | - | |||||||||||||||||||||||||
| 36 | option->features = QStyleOptionFrame::None; | - | ||||||||||||||||||||||||
| 37 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 38 | QLineEdit::QLineEdit(QWidget* parent) | - | ||||||||||||||||||||||||
| 39 | : QWidget(*new QLineEditPrivate, parent,0) | - | ||||||||||||||||||||||||
| 40 | { | - | ||||||||||||||||||||||||
| 41 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 42 | d->init(QString()); | - | ||||||||||||||||||||||||
| 43 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 44 | QLineEdit::QLineEdit(const QString& contents, QWidget* parent) | - | ||||||||||||||||||||||||
| 45 | : QWidget(*new QLineEditPrivate, parent, 0) | - | ||||||||||||||||||||||||
| 46 | { | - | ||||||||||||||||||||||||
| 47 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 48 | d->init(contents); | - | ||||||||||||||||||||||||
| 49 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 50 | - | |||||||||||||||||||||||||
| 51 | - | |||||||||||||||||||||||||
| 52 | - | |||||||||||||||||||||||||
| 53 | - | |||||||||||||||||||||||||
| 54 | - | |||||||||||||||||||||||||
| 55 | - | |||||||||||||||||||||||||
| 56 | - | |||||||||||||||||||||||||
| 57 | QLineEdit::~QLineEdit() | - | ||||||||||||||||||||||||
| 58 | { | - | ||||||||||||||||||||||||
| 59 | } | - | ||||||||||||||||||||||||
| 60 | QString QLineEdit::text() const | - | ||||||||||||||||||||||||
| 61 | { | - | ||||||||||||||||||||||||
| 62 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 63 | return never executed: d->control->text();return d->control->text();never executed: return d->control->text(); | 0 | ||||||||||||||||||||||||
| 64 | } | - | ||||||||||||||||||||||||
| 65 | - | |||||||||||||||||||||||||
| 66 | void QLineEdit::setText(const QString& text) | - | ||||||||||||||||||||||||
| 67 | { | - | ||||||||||||||||||||||||
| 68 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 69 | d->control->setText(text); | - | ||||||||||||||||||||||||
| 70 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 71 | QString QLineEdit::placeholderText() const | - | ||||||||||||||||||||||||
| 72 | { | - | ||||||||||||||||||||||||
| 73 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 74 | return never executed: d->placeholderText;return d->placeholderText;never executed: return d->placeholderText; | 0 | ||||||||||||||||||||||||
| 75 | } | - | ||||||||||||||||||||||||
| 76 | - | |||||||||||||||||||||||||
| 77 | void QLineEdit::setPlaceholderText(const QString& placeholderText) | - | ||||||||||||||||||||||||
| 78 | { | - | ||||||||||||||||||||||||
| 79 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 80 | if (d->placeholderText != placeholderText
| 0 | ||||||||||||||||||||||||
| 81 | d->placeholderText = placeholderText; | - | ||||||||||||||||||||||||
| 82 | if (d->shouldShowPlaceholderText()
| 0 | ||||||||||||||||||||||||
| 83 | update(); never executed: update(); | 0 | ||||||||||||||||||||||||
| 84 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 85 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 86 | QString QLineEdit::displayText() const | - | ||||||||||||||||||||||||
| 87 | { | - | ||||||||||||||||||||||||
| 88 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 89 | return never executed: d->control->displayText();return d->control->displayText();never executed: return d->control->displayText(); | 0 | ||||||||||||||||||||||||
| 90 | } | - | ||||||||||||||||||||||||
| 91 | int QLineEdit::maxLength() const | - | ||||||||||||||||||||||||
| 92 | { | - | ||||||||||||||||||||||||
| 93 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 94 | return never executed: d->control->maxLength();return d->control->maxLength();never executed: return d->control->maxLength(); | 0 | ||||||||||||||||||||||||
| 95 | } | - | ||||||||||||||||||||||||
| 96 | - | |||||||||||||||||||||||||
| 97 | void QLineEdit::setMaxLength(int maxLength) | - | ||||||||||||||||||||||||
| 98 | { | - | ||||||||||||||||||||||||
| 99 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 100 | d->control->setMaxLength(maxLength); | - | ||||||||||||||||||||||||
| 101 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 102 | bool QLineEdit::hasFrame() const | - | ||||||||||||||||||||||||
| 103 | { | - | ||||||||||||||||||||||||
| 104 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 105 | return never executed: d->frame;return d->frame;never executed: return d->frame; | 0 | ||||||||||||||||||||||||
| 106 | } | - | ||||||||||||||||||||||||
| 107 | void QLineEdit::addAction(QAction *action, ActionPosition position) | - | ||||||||||||||||||||||||
| 108 | { | - | ||||||||||||||||||||||||
| 109 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 110 | QWidget::addAction(action); | - | ||||||||||||||||||||||||
| 111 | d->addAction(action, 0, position); | - | ||||||||||||||||||||||||
| 112 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 113 | QAction *QLineEdit::addAction(const QIcon &icon, ActionPosition position) | - | ||||||||||||||||||||||||
| 114 | { | - | ||||||||||||||||||||||||
| 115 | QAction *result = new QAction(icon, QString(), this); | - | ||||||||||||||||||||||||
| 116 | addAction(result, position); | - | ||||||||||||||||||||||||
| 117 | return never executed: result;return result;never executed: return result; | 0 | ||||||||||||||||||||||||
| 118 | } | - | ||||||||||||||||||||||||
| 119 | static const char clearButtonActionNameC[] = "_q_qlineeditclearaction"; | - | ||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||
| 121 | void QLineEdit::setClearButtonEnabled(bool enable) | - | ||||||||||||||||||||||||
| 122 | { | - | ||||||||||||||||||||||||
| 123 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 124 | if (enable == isClearButtonEnabled()
| 0 | ||||||||||||||||||||||||
| 125 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 126 | if (enable
| 0 | ||||||||||||||||||||||||
| 127 | QAction *clearAction = new QAction(d->clearButtonIcon(), QString(), this); | - | ||||||||||||||||||||||||
| 128 | clearAction->setEnabled(!isReadOnly()); | - | ||||||||||||||||||||||||
| 129 | clearAction->setObjectName(QLatin1String(clearButtonActionNameC)); | - | ||||||||||||||||||||||||
| 130 | d->addAction(clearAction, 0, QLineEdit::TrailingPosition, QLineEditPrivate::SideWidgetClearButton | QLineEditPrivate::SideWidgetFadeInWithText); | - | ||||||||||||||||||||||||
| 131 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 132 | QAction *clearAction = findChild<QAction *>(QLatin1String(clearButtonActionNameC)); | - | ||||||||||||||||||||||||
| 133 | ((!(clearAction)) ? qt_assert("clearAction",__FILE__,498) : qt_noop()); | - | ||||||||||||||||||||||||
| 134 | d->removeAction(clearAction); | - | ||||||||||||||||||||||||
| 135 | delete clearAction; | - | ||||||||||||||||||||||||
| 136 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 137 | } | - | ||||||||||||||||||||||||
| 138 | - | |||||||||||||||||||||||||
| 139 | bool QLineEdit::isClearButtonEnabled() const | - | ||||||||||||||||||||||||
| 140 | { | - | ||||||||||||||||||||||||
| 141 | return never executed: findChild<QAction *>(QLatin1String(clearButtonActionNameC));return findChild<QAction *>(QLatin1String(clearButtonActionNameC));never executed: return findChild<QAction *>(QLatin1String(clearButtonActionNameC)); | 0 | ||||||||||||||||||||||||
| 142 | } | - | ||||||||||||||||||||||||
| 143 | - | |||||||||||||||||||||||||
| 144 | void QLineEdit::setFrame(bool enable) | - | ||||||||||||||||||||||||
| 145 | { | - | ||||||||||||||||||||||||
| 146 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 147 | d->frame = enable; | - | ||||||||||||||||||||||||
| 148 | update(); | - | ||||||||||||||||||||||||
| 149 | updateGeometry(); | - | ||||||||||||||||||||||||
| 150 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 151 | QLineEdit::EchoMode QLineEdit::echoMode() const | - | ||||||||||||||||||||||||
| 152 | { | - | ||||||||||||||||||||||||
| 153 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 154 | return never executed: (EchoMode) d->control->echoMode();return (EchoMode) d->control->echoMode();never executed: return (EchoMode) d->control->echoMode(); | 0 | ||||||||||||||||||||||||
| 155 | } | - | ||||||||||||||||||||||||
| 156 | - | |||||||||||||||||||||||||
| 157 | void QLineEdit::setEchoMode(EchoMode mode) | - | ||||||||||||||||||||||||
| 158 | { | - | ||||||||||||||||||||||||
| 159 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 160 | if (mode == (EchoMode)d->control->echoMode()
| 0 | ||||||||||||||||||||||||
| 161 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 162 | Qt::InputMethodHints imHints = inputMethodHints(); | - | ||||||||||||||||||||||||
| 163 | imHints.setFlag(Qt::ImhHiddenText, mode == Password || mode == NoEcho); | - | ||||||||||||||||||||||||
| 164 | imHints.setFlag(Qt::ImhNoAutoUppercase, mode != Normal); | - | ||||||||||||||||||||||||
| 165 | imHints.setFlag(Qt::ImhNoPredictiveText, mode != Normal); | - | ||||||||||||||||||||||||
| 166 | imHints.setFlag(Qt::ImhSensitiveData, mode != Normal); | - | ||||||||||||||||||||||||
| 167 | setInputMethodHints(imHints); | - | ||||||||||||||||||||||||
| 168 | d->control->setEchoMode(mode); | - | ||||||||||||||||||||||||
| 169 | update(); | - | ||||||||||||||||||||||||
| 170 | - | |||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||
| 172 | - | |||||||||||||||||||||||||
| 173 | - | |||||||||||||||||||||||||
| 174 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 175 | const QValidator * QLineEdit::validator() const | - | ||||||||||||||||||||||||
| 176 | { | - | ||||||||||||||||||||||||
| 177 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 178 | return never executed: d->control->validator();return d->control->validator();never executed: return d->control->validator(); | 0 | ||||||||||||||||||||||||
| 179 | } | - | ||||||||||||||||||||||||
| 180 | void QLineEdit::setValidator(const QValidator *v) | - | ||||||||||||||||||||||||
| 181 | { | - | ||||||||||||||||||||||||
| 182 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 183 | d->control->setValidator(v); | - | ||||||||||||||||||||||||
| 184 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 185 | void QLineEdit::setCompleter(QCompleter *c) | - | ||||||||||||||||||||||||
| 186 | { | - | ||||||||||||||||||||||||
| 187 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 188 | if (c == d->control->completer()
| 0 | ||||||||||||||||||||||||
| 189 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 190 | if (d->control->completer()
| 0 | ||||||||||||||||||||||||
| 191 | disconnect(d->control->completer(), 0, this, 0); | - | ||||||||||||||||||||||||
| 192 | d->control->completer()->setWidget(0); | - | ||||||||||||||||||||||||
| 193 | if (d->control->completer()->parent() == this
| 0 | ||||||||||||||||||||||||
| 194 | delete d->control->completer(); never executed: delete d->control->completer(); | 0 | ||||||||||||||||||||||||
| 195 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 196 | d->control->setCompleter(c); | - | ||||||||||||||||||||||||
| 197 | if (!c
| 0 | ||||||||||||||||||||||||
| 198 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 199 | if (c->widget() == 0
| 0 | ||||||||||||||||||||||||
| 200 | c->setWidget(this); never executed: c->setWidget(this); | 0 | ||||||||||||||||||||||||
| 201 | if (hasFocus()
| 0 | ||||||||||||||||||||||||
| 202 | QObject::connect(d->control->completer(), qFlagLocation("2""activated(QString)" "\0" __FILE__ ":" "652"), | - | ||||||||||||||||||||||||
| 203 | this, qFlagLocation("1""setText(QString)" "\0" __FILE__ ":" "653")); | - | ||||||||||||||||||||||||
| 204 | QObject::connect(d->control->completer(), qFlagLocation("2""highlighted(QString)" "\0" __FILE__ ":" "654"), | - | ||||||||||||||||||||||||
| 205 | this, qFlagLocation("1""_q_completionHighlighted(QString)" "\0" __FILE__ ":" "655")); | - | ||||||||||||||||||||||||
| 206 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 207 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 208 | - | |||||||||||||||||||||||||
| 209 | - | |||||||||||||||||||||||||
| 210 | - | |||||||||||||||||||||||||
| 211 | - | |||||||||||||||||||||||||
| 212 | - | |||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||
| 214 | QCompleter *QLineEdit::completer() const | - | ||||||||||||||||||||||||
| 215 | { | - | ||||||||||||||||||||||||
| 216 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 217 | return never executed: d->control->completer();return d->control->completer();never executed: return d->control->completer(); | 0 | ||||||||||||||||||||||||
| 218 | } | - | ||||||||||||||||||||||||
| 219 | QSize QLineEdit::sizeHint() const | - | ||||||||||||||||||||||||
| 220 | { | - | ||||||||||||||||||||||||
| 221 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 222 | ensurePolished(); | - | ||||||||||||||||||||||||
| 223 | QFontMetrics fm(font()); | - | ||||||||||||||||||||||||
| 224 | int h = qMax(fm.height(), 14) + 2*d->verticalMargin | - | ||||||||||||||||||||||||
| 225 | + d->topTextMargin + d->bottomTextMargin | - | ||||||||||||||||||||||||
| 226 | + d->topmargin + d->bottommargin; | - | ||||||||||||||||||||||||
| 227 | int w = fm.width(QLatin1Char('x')) * 17 + 2*d->horizontalMargin | - | ||||||||||||||||||||||||
| 228 | + d->effectiveLeftTextMargin() + d->effectiveRightTextMargin() | - | ||||||||||||||||||||||||
| 229 | + d->leftmargin + d->rightmargin; | - | ||||||||||||||||||||||||
| 230 | QStyleOptionFrame opt; | - | ||||||||||||||||||||||||
| 231 | initStyleOption(&opt); | - | ||||||||||||||||||||||||
| 232 | return never executed: (style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(w, h).return (style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(w, h). expandedTo(QApplication::globalStrut()), this));never executed: return (style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(w, h). expandedTo(QApplication::globalStrut()), this)); | 0 | ||||||||||||||||||||||||
| 233 | expandedTo(QApplication::globalStrut()), this)); never executed: return (style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(w, h). expandedTo(QApplication::globalStrut()), this)); | 0 | ||||||||||||||||||||||||
| 234 | } | - | ||||||||||||||||||||||||
| 235 | QSize QLineEdit::minimumSizeHint() const | - | ||||||||||||||||||||||||
| 236 | { | - | ||||||||||||||||||||||||
| 237 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 238 | ensurePolished(); | - | ||||||||||||||||||||||||
| 239 | QFontMetrics fm = fontMetrics(); | - | ||||||||||||||||||||||||
| 240 | int h = fm.height() + qMax(2*d->verticalMargin, fm.leading()) | - | ||||||||||||||||||||||||
| 241 | + d->topTextMargin + d->bottomTextMargin | - | ||||||||||||||||||||||||
| 242 | + d->topmargin + d->bottommargin; | - | ||||||||||||||||||||||||
| 243 | int w = fm.maxWidth() | - | ||||||||||||||||||||||||
| 244 | + d->effectiveLeftTextMargin() + d->effectiveRightTextMargin() | - | ||||||||||||||||||||||||
| 245 | + d->leftmargin + d->rightmargin; | - | ||||||||||||||||||||||||
| 246 | QStyleOptionFrame opt; | - | ||||||||||||||||||||||||
| 247 | initStyleOption(&opt); | - | ||||||||||||||||||||||||
| 248 | return never executed: (style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(w, h).return (style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(w, h). expandedTo(QApplication::globalStrut()), this));never executed: return (style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(w, h). expandedTo(QApplication::globalStrut()), this)); | 0 | ||||||||||||||||||||||||
| 249 | expandedTo(QApplication::globalStrut()), this)); never executed: return (style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(w, h). expandedTo(QApplication::globalStrut()), this)); | 0 | ||||||||||||||||||||||||
| 250 | } | - | ||||||||||||||||||||||||
| 251 | int QLineEdit::cursorPosition() const | - | ||||||||||||||||||||||||
| 252 | { | - | ||||||||||||||||||||||||
| 253 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 254 | return never executed: d->control->cursorPosition();return d->control->cursorPosition();never executed: return d->control->cursorPosition(); | 0 | ||||||||||||||||||||||||
| 255 | } | - | ||||||||||||||||||||||||
| 256 | - | |||||||||||||||||||||||||
| 257 | void QLineEdit::setCursorPosition(int pos) | - | ||||||||||||||||||||||||
| 258 | { | - | ||||||||||||||||||||||||
| 259 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 260 | d->control->setCursorPosition(pos); | - | ||||||||||||||||||||||||
| 261 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 262 | - | |||||||||||||||||||||||||
| 263 | - | |||||||||||||||||||||||||
| 264 | - | |||||||||||||||||||||||||
| 265 | - | |||||||||||||||||||||||||
| 266 | - | |||||||||||||||||||||||||
| 267 | int QLineEdit::cursorPositionAt(const QPoint &pos) | - | ||||||||||||||||||||||||
| 268 | { | - | ||||||||||||||||||||||||
| 269 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 270 | return never executed: d->xToPos(pos.x());return d->xToPos(pos.x());never executed: return d->xToPos(pos.x()); | 0 | ||||||||||||||||||||||||
| 271 | } | - | ||||||||||||||||||||||||
| 272 | Qt::Alignment QLineEdit::alignment() const | - | ||||||||||||||||||||||||
| 273 | { | - | ||||||||||||||||||||||||
| 274 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 275 | return never executed: QFlag(d->alignment);return QFlag(d->alignment);never executed: return QFlag(d->alignment); | 0 | ||||||||||||||||||||||||
| 276 | } | - | ||||||||||||||||||||||||
| 277 | - | |||||||||||||||||||||||||
| 278 | void QLineEdit::setAlignment(Qt::Alignment alignment) | - | ||||||||||||||||||||||||
| 279 | { | - | ||||||||||||||||||||||||
| 280 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 281 | d->alignment = alignment; | - | ||||||||||||||||||||||||
| 282 | update(); | - | ||||||||||||||||||||||||
| 283 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 284 | void QLineEdit::cursorForward(bool mark, int steps) | - | ||||||||||||||||||||||||
| 285 | { | - | ||||||||||||||||||||||||
| 286 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 287 | d->control->cursorForward(mark, steps); | - | ||||||||||||||||||||||||
| 288 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 289 | void QLineEdit::cursorBackward(bool mark, int steps) | - | ||||||||||||||||||||||||
| 290 | { | - | ||||||||||||||||||||||||
| 291 | cursorForward(mark, -steps); | - | ||||||||||||||||||||||||
| 292 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 293 | - | |||||||||||||||||||||||||
| 294 | - | |||||||||||||||||||||||||
| 295 | - | |||||||||||||||||||||||||
| 296 | - | |||||||||||||||||||||||||
| 297 | - | |||||||||||||||||||||||||
| 298 | - | |||||||||||||||||||||||||
| 299 | - | |||||||||||||||||||||||||
| 300 | void QLineEdit::cursorWordForward(bool mark) | - | ||||||||||||||||||||||||
| 301 | { | - | ||||||||||||||||||||||||
| 302 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 303 | d->control->cursorWordForward(mark); | - | ||||||||||||||||||||||||
| 304 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 305 | void QLineEdit::cursorWordBackward(bool mark) | - | ||||||||||||||||||||||||
| 306 | { | - | ||||||||||||||||||||||||
| 307 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 308 | d->control->cursorWordBackward(mark); | - | ||||||||||||||||||||||||
| 309 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 310 | void QLineEdit::backspace() | - | ||||||||||||||||||||||||
| 311 | { | - | ||||||||||||||||||||||||
| 312 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 313 | d->control->backspace(); | - | ||||||||||||||||||||||||
| 314 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 315 | void QLineEdit::del() | - | ||||||||||||||||||||||||
| 316 | { | - | ||||||||||||||||||||||||
| 317 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 318 | d->control->del(); | - | ||||||||||||||||||||||||
| 319 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 320 | void QLineEdit::home(bool mark) | - | ||||||||||||||||||||||||
| 321 | { | - | ||||||||||||||||||||||||
| 322 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 323 | d->control->home(mark); | - | ||||||||||||||||||||||||
| 324 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 325 | void QLineEdit::end(bool mark) | - | ||||||||||||||||||||||||
| 326 | { | - | ||||||||||||||||||||||||
| 327 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 328 | d->control->end(mark); | - | ||||||||||||||||||||||||
| 329 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 330 | bool QLineEdit::isModified() const | - | ||||||||||||||||||||||||
| 331 | { | - | ||||||||||||||||||||||||
| 332 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 333 | return never executed: d->control->isModified();return d->control->isModified();never executed: return d->control->isModified(); | 0 | ||||||||||||||||||||||||
| 334 | } | - | ||||||||||||||||||||||||
| 335 | - | |||||||||||||||||||||||||
| 336 | void QLineEdit::setModified(bool modified) | - | ||||||||||||||||||||||||
| 337 | { | - | ||||||||||||||||||||||||
| 338 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 339 | d->control->setModified(modified); | - | ||||||||||||||||||||||||
| 340 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 341 | bool QLineEdit::hasSelectedText() const | - | ||||||||||||||||||||||||
| 342 | { | - | ||||||||||||||||||||||||
| 343 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 344 | return never executed: d->control->hasSelectedText();return d->control->hasSelectedText();never executed: return d->control->hasSelectedText(); | 0 | ||||||||||||||||||||||||
| 345 | } | - | ||||||||||||||||||||||||
| 346 | QString QLineEdit::selectedText() const | - | ||||||||||||||||||||||||
| 347 | { | - | ||||||||||||||||||||||||
| 348 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 349 | return never executed: d->control->selectedText();return d->control->selectedText();never executed: return d->control->selectedText(); | 0 | ||||||||||||||||||||||||
| 350 | } | - | ||||||||||||||||||||||||
| 351 | int QLineEdit::selectionStart() const | - | ||||||||||||||||||||||||
| 352 | { | - | ||||||||||||||||||||||||
| 353 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 354 | return never executed: d->control->selectionStart();return d->control->selectionStart();never executed: return d->control->selectionStart(); | 0 | ||||||||||||||||||||||||
| 355 | } | - | ||||||||||||||||||||||||
| 356 | void QLineEdit::setSelection(int start, int length) | - | ||||||||||||||||||||||||
| 357 | { | - | ||||||||||||||||||||||||
| 358 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 359 | if (__builtin_expect(!!(start < 0 || start > (int)d->control->end()), false)
| 0 | ||||||||||||||||||||||||
| 360 | QMessageLogger(__FILE__, 986, __PRETTY_FUNCTION__).warning("QLineEdit::setSelection: Invalid start position (%d)", start); | - | ||||||||||||||||||||||||
| 361 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 362 | } | - | ||||||||||||||||||||||||
| 363 | - | |||||||||||||||||||||||||
| 364 | d->control->setSelection(start, length); | - | ||||||||||||||||||||||||
| 365 | - | |||||||||||||||||||||||||
| 366 | if (d->control->hasSelectedText()
| 0 | ||||||||||||||||||||||||
| 367 | QStyleOptionFrame opt; | - | ||||||||||||||||||||||||
| 368 | initStyleOption(&opt); | - | ||||||||||||||||||||||||
| 369 | if (!style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, this)
| 0 | ||||||||||||||||||||||||
| 370 | d->setCursorVisible(false); never executed: d->setCursorVisible(false); | 0 | ||||||||||||||||||||||||
| 371 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 372 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 373 | bool QLineEdit::isUndoAvailable() const | - | ||||||||||||||||||||||||
| 374 | { | - | ||||||||||||||||||||||||
| 375 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 376 | return never executed: d->control->isUndoAvailable();return d->control->isUndoAvailable();never executed: return d->control->isUndoAvailable(); | 0 | ||||||||||||||||||||||||
| 377 | } | - | ||||||||||||||||||||||||
| 378 | bool QLineEdit::isRedoAvailable() const | - | ||||||||||||||||||||||||
| 379 | { | - | ||||||||||||||||||||||||
| 380 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 381 | return never executed: d->control->isRedoAvailable();return d->control->isRedoAvailable();never executed: return d->control->isRedoAvailable(); | 0 | ||||||||||||||||||||||||
| 382 | } | - | ||||||||||||||||||||||||
| 383 | bool QLineEdit::dragEnabled() const | - | ||||||||||||||||||||||||
| 384 | { | - | ||||||||||||||||||||||||
| 385 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 386 | return never executed: d->dragEnabled;return d->dragEnabled;never executed: return d->dragEnabled; | 0 | ||||||||||||||||||||||||
| 387 | } | - | ||||||||||||||||||||||||
| 388 | - | |||||||||||||||||||||||||
| 389 | void QLineEdit::setDragEnabled(bool b) | - | ||||||||||||||||||||||||
| 390 | { | - | ||||||||||||||||||||||||
| 391 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 392 | d->dragEnabled = b; | - | ||||||||||||||||||||||||
| 393 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 394 | Qt::CursorMoveStyle QLineEdit::cursorMoveStyle() const | - | ||||||||||||||||||||||||
| 395 | { | - | ||||||||||||||||||||||||
| 396 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 397 | return never executed: d->control->cursorMoveStyle();return d->control->cursorMoveStyle();never executed: return d->control->cursorMoveStyle(); | 0 | ||||||||||||||||||||||||
| 398 | } | - | ||||||||||||||||||||||||
| 399 | - | |||||||||||||||||||||||||
| 400 | void QLineEdit::setCursorMoveStyle(Qt::CursorMoveStyle style) | - | ||||||||||||||||||||||||
| 401 | { | - | ||||||||||||||||||||||||
| 402 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 403 | d->control->setCursorMoveStyle(style); | - | ||||||||||||||||||||||||
| 404 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 405 | bool QLineEdit::hasAcceptableInput() const | - | ||||||||||||||||||||||||
| 406 | { | - | ||||||||||||||||||||||||
| 407 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 408 | return never executed: d->control->hasAcceptableInput();return d->control->hasAcceptableInput();never executed: return d->control->hasAcceptableInput(); | 0 | ||||||||||||||||||||||||
| 409 | } | - | ||||||||||||||||||||||||
| 410 | void QLineEdit::setTextMargins(int left, int top, int right, int bottom) | - | ||||||||||||||||||||||||
| 411 | { | - | ||||||||||||||||||||||||
| 412 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 413 | d->leftTextMargin = left; | - | ||||||||||||||||||||||||
| 414 | d->topTextMargin = top; | - | ||||||||||||||||||||||||
| 415 | d->rightTextMargin = right; | - | ||||||||||||||||||||||||
| 416 | d->bottomTextMargin = bottom; | - | ||||||||||||||||||||||||
| 417 | updateGeometry(); | - | ||||||||||||||||||||||||
| 418 | update(); | - | ||||||||||||||||||||||||
| 419 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 420 | - | |||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||
| 422 | - | |||||||||||||||||||||||||
| 423 | - | |||||||||||||||||||||||||
| 424 | - | |||||||||||||||||||||||||
| 425 | - | |||||||||||||||||||||||||
| 426 | - | |||||||||||||||||||||||||
| 427 | void QLineEdit::setTextMargins(const QMargins &margins) | - | ||||||||||||||||||||||||
| 428 | { | - | ||||||||||||||||||||||||
| 429 | setTextMargins(margins.left(), margins.top(), margins.right(), margins.bottom()); | - | ||||||||||||||||||||||||
| 430 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 431 | - | |||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||
| 433 | - | |||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||
| 435 | - | |||||||||||||||||||||||||
| 436 | - | |||||||||||||||||||||||||
| 437 | - | |||||||||||||||||||||||||
| 438 | void QLineEdit::getTextMargins(int *left, int *top, int *right, int *bottom) const | - | ||||||||||||||||||||||||
| 439 | { | - | ||||||||||||||||||||||||
| 440 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 441 | if (left
| 0 | ||||||||||||||||||||||||
| 442 | * never executed: left = d->leftTextMargin;*left = d->leftTextMargin;never executed: *left = d->leftTextMargin; | 0 | ||||||||||||||||||||||||
| 443 | if (top
| 0 | ||||||||||||||||||||||||
| 444 | * never executed: top = d->topTextMargin;*top = d->topTextMargin;never executed: *top = d->topTextMargin; | 0 | ||||||||||||||||||||||||
| 445 | if (right
| 0 | ||||||||||||||||||||||||
| 446 | * never executed: right = d->rightTextMargin;*right = d->rightTextMargin;never executed: *right = d->rightTextMargin; | 0 | ||||||||||||||||||||||||
| 447 | if (bottom
| 0 | ||||||||||||||||||||||||
| 448 | * never executed: bottom = d->bottomTextMargin;*bottom = d->bottomTextMargin;never executed: *bottom = d->bottomTextMargin; | 0 | ||||||||||||||||||||||||
| 449 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 450 | - | |||||||||||||||||||||||||
| 451 | - | |||||||||||||||||||||||||
| 452 | - | |||||||||||||||||||||||||
| 453 | - | |||||||||||||||||||||||||
| 454 | - | |||||||||||||||||||||||||
| 455 | - | |||||||||||||||||||||||||
| 456 | - | |||||||||||||||||||||||||
| 457 | QMargins QLineEdit::textMargins() const | - | ||||||||||||||||||||||||
| 458 | { | - | ||||||||||||||||||||||||
| 459 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 460 | return never executed: QMargins(d->leftTextMargin, d->topTextMargin, d->rightTextMargin, d->bottomTextMargin);return QMargins(d->leftTextMargin, d->topTextMargin, d->rightTextMargin, d->bottomTextMargin);never executed: return QMargins(d->leftTextMargin, d->topTextMargin, d->rightTextMargin, d->bottomTextMargin); | 0 | ||||||||||||||||||||||||
| 461 | } | - | ||||||||||||||||||||||||
| 462 | QString QLineEdit::inputMask() const | - | ||||||||||||||||||||||||
| 463 | { | - | ||||||||||||||||||||||||
| 464 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 465 | return never executed: d->control->inputMask();return d->control->inputMask();never executed: return d->control->inputMask(); | 0 | ||||||||||||||||||||||||
| 466 | } | - | ||||||||||||||||||||||||
| 467 | - | |||||||||||||||||||||||||
| 468 | void QLineEdit::setInputMask(const QString &inputMask) | - | ||||||||||||||||||||||||
| 469 | { | - | ||||||||||||||||||||||||
| 470 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 471 | d->control->setInputMask(inputMask); | - | ||||||||||||||||||||||||
| 472 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 473 | void QLineEdit::selectAll() | - | ||||||||||||||||||||||||
| 474 | { | - | ||||||||||||||||||||||||
| 475 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 476 | d->control->selectAll(); | - | ||||||||||||||||||||||||
| 477 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 478 | - | |||||||||||||||||||||||||
| 479 | - | |||||||||||||||||||||||||
| 480 | - | |||||||||||||||||||||||||
| 481 | - | |||||||||||||||||||||||||
| 482 | - | |||||||||||||||||||||||||
| 483 | - | |||||||||||||||||||||||||
| 484 | - | |||||||||||||||||||||||||
| 485 | void QLineEdit::deselect() | - | ||||||||||||||||||||||||
| 486 | { | - | ||||||||||||||||||||||||
| 487 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 488 | d->control->deselect(); | - | ||||||||||||||||||||||||
| 489 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 490 | void QLineEdit::insert(const QString &newText) | - | ||||||||||||||||||||||||
| 491 | { | - | ||||||||||||||||||||||||
| 492 | - | |||||||||||||||||||||||||
| 493 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 494 | d->control->insert(newText); | - | ||||||||||||||||||||||||
| 495 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 496 | - | |||||||||||||||||||||||||
| 497 | - | |||||||||||||||||||||||||
| 498 | - | |||||||||||||||||||||||||
| 499 | - | |||||||||||||||||||||||||
| 500 | - | |||||||||||||||||||||||||
| 501 | - | |||||||||||||||||||||||||
| 502 | void QLineEdit::clear() | - | ||||||||||||||||||||||||
| 503 | { | - | ||||||||||||||||||||||||
| 504 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 505 | d->resetInputMethod(); | - | ||||||||||||||||||||||||
| 506 | d->control->clear(); | - | ||||||||||||||||||||||||
| 507 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 508 | - | |||||||||||||||||||||||||
| 509 | - | |||||||||||||||||||||||||
| 510 | - | |||||||||||||||||||||||||
| 511 | - | |||||||||||||||||||||||||
| 512 | - | |||||||||||||||||||||||||
| 513 | - | |||||||||||||||||||||||||
| 514 | void QLineEdit::undo() | - | ||||||||||||||||||||||||
| 515 | { | - | ||||||||||||||||||||||||
| 516 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 517 | d->resetInputMethod(); | - | ||||||||||||||||||||||||
| 518 | d->control->undo(); | - | ||||||||||||||||||||||||
| 519 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 520 | - | |||||||||||||||||||||||||
| 521 | - | |||||||||||||||||||||||||
| 522 | - | |||||||||||||||||||||||||
| 523 | - | |||||||||||||||||||||||||
| 524 | void QLineEdit::redo() | - | ||||||||||||||||||||||||
| 525 | { | - | ||||||||||||||||||||||||
| 526 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 527 | d->resetInputMethod(); | - | ||||||||||||||||||||||||
| 528 | d->control->redo(); | - | ||||||||||||||||||||||||
| 529 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 530 | bool QLineEdit::isReadOnly() const | - | ||||||||||||||||||||||||
| 531 | { | - | ||||||||||||||||||||||||
| 532 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 533 | return never executed: d->control->isReadOnly();return d->control->isReadOnly();never executed: return d->control->isReadOnly(); | 0 | ||||||||||||||||||||||||
| 534 | } | - | ||||||||||||||||||||||||
| 535 | - | |||||||||||||||||||||||||
| 536 | void QLineEdit::setReadOnly(bool enable) | - | ||||||||||||||||||||||||
| 537 | { | - | ||||||||||||||||||||||||
| 538 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 539 | if (d->control->isReadOnly() != enable
| 0 | ||||||||||||||||||||||||
| 540 | d->control->setReadOnly(enable); | - | ||||||||||||||||||||||||
| 541 | d->setClearButtonEnabled(!enable); | - | ||||||||||||||||||||||||
| 542 | setAttribute(Qt::WA_MacShowFocusRect, !enable); | - | ||||||||||||||||||||||||
| 543 | setAttribute(Qt::WA_InputMethodEnabled, d->shouldEnableInputMethod()); | - | ||||||||||||||||||||||||
| 544 | - | |||||||||||||||||||||||||
| 545 | setCursor(enable ? Qt::ArrowCursor : Qt::IBeamCursor); | - | ||||||||||||||||||||||||
| 546 | - | |||||||||||||||||||||||||
| 547 | QEvent event(QEvent::ReadOnlyChange); | - | ||||||||||||||||||||||||
| 548 | QCoreApplication::sendEvent(this, &event); | - | ||||||||||||||||||||||||
| 549 | update(); | - | ||||||||||||||||||||||||
| 550 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 551 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 552 | void QLineEdit::cut() | - | ||||||||||||||||||||||||
| 553 | { | - | ||||||||||||||||||||||||
| 554 | if (hasSelectedText()
| 0 | ||||||||||||||||||||||||
| 555 | copy(); | - | ||||||||||||||||||||||||
| 556 | del(); | - | ||||||||||||||||||||||||
| 557 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 558 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 559 | void QLineEdit::copy() const | - | ||||||||||||||||||||||||
| 560 | { | - | ||||||||||||||||||||||||
| 561 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 562 | d->control->copy(); | - | ||||||||||||||||||||||||
| 563 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 564 | void QLineEdit::paste() | - | ||||||||||||||||||||||||
| 565 | { | - | ||||||||||||||||||||||||
| 566 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 567 | d->control->paste(); | - | ||||||||||||||||||||||||
| 568 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 569 | - | |||||||||||||||||||||||||
| 570 | - | |||||||||||||||||||||||||
| 571 | - | |||||||||||||||||||||||||
| 572 | - | |||||||||||||||||||||||||
| 573 | - | |||||||||||||||||||||||||
| 574 | bool QLineEdit::event(QEvent * e) | - | ||||||||||||||||||||||||
| 575 | { | - | ||||||||||||||||||||||||
| 576 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 577 | if (e->type() == QEvent::Timer
| 0 | ||||||||||||||||||||||||
| 578 | - | |||||||||||||||||||||||||
| 579 | int timerId = ((QTimerEvent*)e)->timerId(); | - | ||||||||||||||||||||||||
| 580 | if (false) { dead code: { } | - | ||||||||||||||||||||||||
| 581 | - | |||||||||||||||||||||||||
| 582 | } dead code: else if (timerId == d->dndTimer.timerId(){ }
| - | ||||||||||||||||||||||||
| 583 | d->drag(); | - | ||||||||||||||||||||||||
| 584 | - | |||||||||||||||||||||||||
| 585 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 586 | else if (timerId == d->tripleClickTimer.timerId()
| 0 | ||||||||||||||||||||||||
| 587 | d->tripleClickTimer.stop(); never executed: d->tripleClickTimer.stop(); | 0 | ||||||||||||||||||||||||
| 588 | } never executed: else if (e->type() == QEvent::ContextMenuend of block
| 0 | ||||||||||||||||||||||||
| 589 | - | |||||||||||||||||||||||||
| 590 | if (d->control->composeMode()
| 0 | ||||||||||||||||||||||||
| 591 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||
| 592 | - | |||||||||||||||||||||||||
| 593 | - | |||||||||||||||||||||||||
| 594 | } never executed: else if (e->type() == QEvent::WindowActivateend of block
| 0 | ||||||||||||||||||||||||
| 595 | QTimer::singleShot(0, this, qFlagLocation("1""_q_handleWindowActivate()" "\0" __FILE__ ":" "1419")); | - | ||||||||||||||||||||||||
| 596 | - | |||||||||||||||||||||||||
| 597 | } never executed: else if (e->type() == QEvent::ShortcutOverrideend of block
| 0 | ||||||||||||||||||||||||
| 598 | QKeyEvent *ke = static_cast<QKeyEvent*>(e); | - | ||||||||||||||||||||||||
| 599 | d->control->processShortcutOverrideEvent(ke); | - | ||||||||||||||||||||||||
| 600 | - | |||||||||||||||||||||||||
| 601 | } never executed: else if (e->type() == QEvent::KeyReleaseend of block
| 0 | ||||||||||||||||||||||||
| 602 | d->control->updateCursorBlinking(); | - | ||||||||||||||||||||||||
| 603 | } never executed: else if (e->type() == QEvent::Showend of block
| 0 | ||||||||||||||||||||||||
| 604 | - | |||||||||||||||||||||||||
| 605 | if (hasFocus()
| 0 | ||||||||||||||||||||||||
| 606 | d->control->setBlinkingCursorEnabled(true); | - | ||||||||||||||||||||||||
| 607 | QStyleOptionFrame opt; | - | ||||||||||||||||||||||||
| 608 | initStyleOption(&opt); | - | ||||||||||||||||||||||||
| 609 | if ((!hasSelectedText()
| 0 | ||||||||||||||||||||||||
| 610 | || style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, this)
| 0 | ||||||||||||||||||||||||
| 611 | d->setCursorVisible(true); never executed: d->setCursorVisible(true); | 0 | ||||||||||||||||||||||||
| 612 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 613 | } never executed: else if (e->type() == QEvent::ActionRemovedend of block
| 0 | ||||||||||||||||||||||||
| 614 | d->removeAction(static_cast<QActionEvent *>(e)->action()); | - | ||||||||||||||||||||||||
| 615 | } never executed: else if (e->type() == QEvent::Resizeend of block
| 0 | ||||||||||||||||||||||||
| 616 | d->positionSideWidgets(); | - | ||||||||||||||||||||||||
| 617 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 618 | return never executed: QWidget::event(e);return QWidget::event(e);never executed: return QWidget::event(e); | 0 | ||||||||||||||||||||||||
| 619 | } | - | ||||||||||||||||||||||||
| 620 | - | |||||||||||||||||||||||||
| 621 | - | |||||||||||||||||||||||||
| 622 | - | |||||||||||||||||||||||||
| 623 | void QLineEdit::mousePressEvent(QMouseEvent* e) | - | ||||||||||||||||||||||||
| 624 | { | - | ||||||||||||||||||||||||
| 625 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 626 | - | |||||||||||||||||||||||||
| 627 | d->mousePressPos = e->pos(); | - | ||||||||||||||||||||||||
| 628 | - | |||||||||||||||||||||||||
| 629 | if (d->sendMouseEventToInputContext(e)
| 0 | ||||||||||||||||||||||||
| 630 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 631 | if (e->button() == Qt::RightButton
| 0 | ||||||||||||||||||||||||
| 632 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 633 | if (d->tripleClickTimer.isActive()
| 0 | ||||||||||||||||||||||||
| 634 | QApplication::startDragDistance()
| 0 | ||||||||||||||||||||||||
| 635 | selectAll(); | - | ||||||||||||||||||||||||
| 636 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 637 | } | - | ||||||||||||||||||||||||
| 638 | bool mark = e->modifiers() & Qt::ShiftModifier; | - | ||||||||||||||||||||||||
| 639 | - | |||||||||||||||||||||||||
| 640 | - | |||||||||||||||||||||||||
| 641 | - | |||||||||||||||||||||||||
| 642 | int cursor = d->xToPos(e->pos().x()); | - | ||||||||||||||||||||||||
| 643 | - | |||||||||||||||||||||||||
| 644 | if (!mark
| 0 | ||||||||||||||||||||||||
| 645 | e->button() == Qt::LeftButton
| 0 | ||||||||||||||||||||||||
| 646 | if (!d->dndTimer.isActive()
| 0 | ||||||||||||||||||||||||
| 647 | d->dndTimer.start(QApplication::startDragTime(), this); never executed: d->dndTimer.start(QApplication::startDragTime(), this); | 0 | ||||||||||||||||||||||||
| 648 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
| 649 | - | |||||||||||||||||||||||||
| 650 | { | - | ||||||||||||||||||||||||
| 651 | d->control->moveCursor(cursor, mark); | - | ||||||||||||||||||||||||
| 652 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 653 | } | - | ||||||||||||||||||||||||
| 654 | - | |||||||||||||||||||||||||
| 655 | - | |||||||||||||||||||||||||
| 656 | - | |||||||||||||||||||||||||
| 657 | void QLineEdit::mouseMoveEvent(QMouseEvent * e) | - | ||||||||||||||||||||||||
| 658 | { | - | ||||||||||||||||||||||||
| 659 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 660 | - | |||||||||||||||||||||||||
| 661 | if (e->buttons() & Qt::LeftButton
| 0 | ||||||||||||||||||||||||
| 662 | - | |||||||||||||||||||||||||
| 663 | if (d->dndTimer.isActive()
| 0 | ||||||||||||||||||||||||
| 664 | if ((
| 0 | ||||||||||||||||||||||||
| 665 | d->drag(); never executed: d->drag(); | 0 | ||||||||||||||||||||||||
| 666 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
| 667 | - | |||||||||||||||||||||||||
| 668 | { | - | ||||||||||||||||||||||||
| 669 | - | |||||||||||||||||||||||||
| 670 | const bool select = true; | - | ||||||||||||||||||||||||
| 671 | - | |||||||||||||||||||||||||
| 672 | - | |||||||||||||||||||||||||
| 673 | - | |||||||||||||||||||||||||
| 674 | - | |||||||||||||||||||||||||
| 675 | if (d->control->composeMode()
| 0 | ||||||||||||||||||||||||
| 676 | int startPos = d->xToPos(d->mousePressPos.x()); | - | ||||||||||||||||||||||||
| 677 | int currentPos = d->xToPos(e->pos().x()); | - | ||||||||||||||||||||||||
| 678 | if (startPos != currentPos
| 0 | ||||||||||||||||||||||||
| 679 | d->control->setSelection(startPos, currentPos - startPos); never executed: d->control->setSelection(startPos, currentPos - startPos); | 0 | ||||||||||||||||||||||||
| 680 | - | |||||||||||||||||||||||||
| 681 | } never executed: elseend of block | 0 | ||||||||||||||||||||||||
| 682 | - | |||||||||||||||||||||||||
| 683 | { | - | ||||||||||||||||||||||||
| 684 | d->control->moveCursor(d->xToPos(e->pos().x()), select); | - | ||||||||||||||||||||||||
| 685 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 686 | } | - | ||||||||||||||||||||||||
| 687 | } | - | ||||||||||||||||||||||||
| 688 | - | |||||||||||||||||||||||||
| 689 | d->sendMouseEventToInputContext(e); | - | ||||||||||||||||||||||||
| 690 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 691 | - | |||||||||||||||||||||||||
| 692 | - | |||||||||||||||||||||||||
| 693 | - | |||||||||||||||||||||||||
| 694 | void QLineEdit::mouseReleaseEvent(QMouseEvent* e) | - | ||||||||||||||||||||||||
| 695 | { | - | ||||||||||||||||||||||||
| 696 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 697 | if (d->sendMouseEventToInputContext(e)
| 0 | ||||||||||||||||||||||||
| 698 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 699 | - | |||||||||||||||||||||||||
| 700 | if (e->button() == Qt::LeftButton
| 0 | ||||||||||||||||||||||||
| 701 | if (d->dndTimer.isActive()
| 0 | ||||||||||||||||||||||||
| 702 | d->dndTimer.stop(); | - | ||||||||||||||||||||||||
| 703 | deselect(); | - | ||||||||||||||||||||||||
| 704 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 705 | } | - | ||||||||||||||||||||||||
| 706 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 707 | - | |||||||||||||||||||||||||
| 708 | - | |||||||||||||||||||||||||
| 709 | if (QApplication::clipboard()->supportsSelection()
| 0 | ||||||||||||||||||||||||
| 710 | if (e->button() == Qt::LeftButton
| 0 | ||||||||||||||||||||||||
| 711 | d->control->copy(QClipboard::Selection); | - | ||||||||||||||||||||||||
| 712 | } never executed: else if (!d->control->isReadOnly()end of block
| 0 | ||||||||||||||||||||||||
| 713 | deselect(); | - | ||||||||||||||||||||||||
| 714 | insert(QApplication::clipboard()->text(QClipboard::Selection)); | - | ||||||||||||||||||||||||
| 715 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 716 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 717 | - | |||||||||||||||||||||||||
| 718 | - | |||||||||||||||||||||||||
| 719 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||
| 720 | d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus); never executed: d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus); | 0 | ||||||||||||||||||||||||
| 721 | d->clickCausedFocus = 0; | - | ||||||||||||||||||||||||
| 722 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 723 | - | |||||||||||||||||||||||||
| 724 | - | |||||||||||||||||||||||||
| 725 | - | |||||||||||||||||||||||||
| 726 | void QLineEdit::mouseDoubleClickEvent(QMouseEvent* e) | - | ||||||||||||||||||||||||
| 727 | { | - | ||||||||||||||||||||||||
| 728 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 729 | - | |||||||||||||||||||||||||
| 730 | if (e->button() == Qt::LeftButton
| 0 | ||||||||||||||||||||||||
| 731 | int position = d->xToPos(e->pos().x()); | - | ||||||||||||||||||||||||
| 732 | - | |||||||||||||||||||||||||
| 733 | - | |||||||||||||||||||||||||
| 734 | - | |||||||||||||||||||||||||
| 735 | if (d->control->composeMode()
| 0 | ||||||||||||||||||||||||
| 736 | int preeditPos = d->control->cursor(); | - | ||||||||||||||||||||||||
| 737 | int posInPreedit = position - d->control->cursor(); | - | ||||||||||||||||||||||||
| 738 | int preeditLength = d->control->preeditAreaText().length(); | - | ||||||||||||||||||||||||
| 739 | bool positionOnPreedit = false; | - | ||||||||||||||||||||||||
| 740 | - | |||||||||||||||||||||||||
| 741 | if (posInPreedit >= 0
| 0 | ||||||||||||||||||||||||
| 742 | positionOnPreedit = true; never executed: positionOnPreedit = true; | 0 | ||||||||||||||||||||||||
| 743 | - | |||||||||||||||||||||||||
| 744 | int textLength = d->control->end(); | - | ||||||||||||||||||||||||
| 745 | d->control->commitPreedit(); | - | ||||||||||||||||||||||||
| 746 | int sizeChange = d->control->end() - textLength; | - | ||||||||||||||||||||||||
| 747 | - | |||||||||||||||||||||||||
| 748 | if (positionOnPreedit
| 0 | ||||||||||||||||||||||||
| 749 | if (sizeChange == 0
| 0 | ||||||||||||||||||||||||
| 750 | position = -1; never executed: position = -1; | 0 | ||||||||||||||||||||||||
| 751 | else | - | ||||||||||||||||||||||||
| 752 | - | |||||||||||||||||||||||||
| 753 | position = qBound(preeditPos, position, preeditPos + sizeChange); never executed: position = qBound(preeditPos, position, preeditPos + sizeChange); | 0 | ||||||||||||||||||||||||
| 754 | } else if (position > preeditPos
| 0 | ||||||||||||||||||||||||
| 755 | - | |||||||||||||||||||||||||
| 756 | position += (sizeChange - preeditLength); | - | ||||||||||||||||||||||||
| 757 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 758 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 759 | - | |||||||||||||||||||||||||
| 760 | - | |||||||||||||||||||||||||
| 761 | if (position >= 0
| 0 | ||||||||||||||||||||||||
| 762 | d->control->selectWordAtPos(position); never executed: d->control->selectWordAtPos(position); | 0 | ||||||||||||||||||||||||
| 763 | - | |||||||||||||||||||||||||
| 764 | d->tripleClickTimer.start(QApplication::doubleClickInterval(), this); | - | ||||||||||||||||||||||||
| 765 | d->tripleClick = e->pos(); | - | ||||||||||||||||||||||||
| 766 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 767 | d->sendMouseEventToInputContext(e); | - | ||||||||||||||||||||||||
| 768 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 769 | } | - | ||||||||||||||||||||||||
| 770 | void QLineEdit::keyPressEvent(QKeyEvent *event) | - | ||||||||||||||||||||||||
| 771 | { | - | ||||||||||||||||||||||||
| 772 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 773 | d->control->processKeyEvent(event); | - | ||||||||||||||||||||||||
| 774 | if (event->isAccepted()
| 0 | ||||||||||||||||||||||||
| 775 | if (layoutDirection() != d->control->layoutDirection()
| 0 | ||||||||||||||||||||||||
| 776 | setLayoutDirection(d->control->layoutDirection()); never executed: setLayoutDirection(d->control->layoutDirection()); | 0 | ||||||||||||||||||||||||
| 777 | d->control->updateCursorBlinking(); | - | ||||||||||||||||||||||||
| 778 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 779 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 780 | - | |||||||||||||||||||||||||
| 781 | - | |||||||||||||||||||||||||
| 782 | - | |||||||||||||||||||||||||
| 783 | - | |||||||||||||||||||||||||
| 784 | - | |||||||||||||||||||||||||
| 785 | - | |||||||||||||||||||||||||
| 786 | QRect QLineEdit::cursorRect() const | - | ||||||||||||||||||||||||
| 787 | { | - | ||||||||||||||||||||||||
| 788 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 789 | return never executed: d->cursorRect();return d->cursorRect();never executed: return d->cursorRect(); | 0 | ||||||||||||||||||||||||
| 790 | } | - | ||||||||||||||||||||||||
| 791 | - | |||||||||||||||||||||||||
| 792 | - | |||||||||||||||||||||||||
| 793 | - | |||||||||||||||||||||||||
| 794 | void QLineEdit::inputMethodEvent(QInputMethodEvent *e) | - | ||||||||||||||||||||||||
| 795 | { | - | ||||||||||||||||||||||||
| 796 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 797 | if (d->control->isReadOnly()
| 0 | ||||||||||||||||||||||||
| 798 | e->ignore(); | - | ||||||||||||||||||||||||
| 799 | return; never executed: return; | 0 | ||||||||||||||||||||||||
| 800 | } | - | ||||||||||||||||||||||||
| 801 | - | |||||||||||||||||||||||||
| 802 | if (echoMode() == PasswordEchoOnEdit
| 0 | ||||||||||||||||||||||||
| 803 | - | |||||||||||||||||||||||||
| 804 | - | |||||||||||||||||||||||||
| 805 | - | |||||||||||||||||||||||||
| 806 | d->updatePasswordEchoEditing(true); | - | ||||||||||||||||||||||||
| 807 | clear(); | - | ||||||||||||||||||||||||
| 808 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 809 | d->control->processInputMethodEvent(e); | - | ||||||||||||||||||||||||
| 810 | - | |||||||||||||||||||||||||
| 811 | - | |||||||||||||||||||||||||
| 812 | if (!e->commitString().isEmpty()
| 0 | ||||||||||||||||||||||||
| 813 | d->control->complete(Qt::Key_unknown); never executed: d->control->complete(Qt::Key_unknown); | 0 | ||||||||||||||||||||||||
| 814 | - | |||||||||||||||||||||||||
| 815 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 816 | - | |||||||||||||||||||||||||
| 817 | - | |||||||||||||||||||||||||
| 818 | - | |||||||||||||||||||||||||
| 819 | QVariant QLineEdit::inputMethodQuery(Qt::InputMethodQuery property) const | - | ||||||||||||||||||||||||
| 820 | { | - | ||||||||||||||||||||||||
| 821 | return never executed: inputMethodQuery(property, QVariant());return inputMethodQuery(property, QVariant());never executed: return inputMethodQuery(property, QVariant()); | 0 | ||||||||||||||||||||||||
| 822 | } | - | ||||||||||||||||||||||||
| 823 | - | |||||||||||||||||||||||||
| 824 | - | |||||||||||||||||||||||||
| 825 | - | |||||||||||||||||||||||||
| 826 | QVariant QLineEdit::inputMethodQuery(Qt::InputMethodQuery property, QVariant argument) const | - | ||||||||||||||||||||||||
| 827 | { | - | ||||||||||||||||||||||||
| 828 | const QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 829 | switch(property) { | - | ||||||||||||||||||||||||
| 830 | case never executed: Qt::ImCursorRectangle:case Qt::ImCursorRectangle:never executed: case Qt::ImCursorRectangle: | 0 | ||||||||||||||||||||||||
| 831 | return never executed: d->cursorRect();return d->cursorRect();never executed: return d->cursorRect(); | 0 | ||||||||||||||||||||||||
| 832 | case never executed: Qt::ImAnchorRectangle:case Qt::ImAnchorRectangle:never executed: case Qt::ImAnchorRectangle: | 0 | ||||||||||||||||||||||||
| 833 | return never executed: d->adjustedControlRect(d->control->anchorRect());return d->adjustedControlRect(d->control->anchorRect());never executed: return d->adjustedControlRect(d->control->anchorRect()); | 0 | ||||||||||||||||||||||||
| 834 | case never executed: Qt::ImFont:case Qt::ImFont:never executed: case Qt::ImFont: | 0 | ||||||||||||||||||||||||
| 835 | return never executed: font();return font();never executed: return font(); | 0 | ||||||||||||||||||||||||
| 836 | case never executed: Qt::ImCursorPosition:case Qt::ImCursorPosition:never executed: {case Qt::ImCursorPosition: | 0 | ||||||||||||||||||||||||
| 837 | const QPointF pt = argument.toPointF(); | - | ||||||||||||||||||||||||
| 838 | if (!pt.isNull()
| 0 | ||||||||||||||||||||||||
| 839 | return never executed: QVariant(d->xToPos(pt.x(), QTextLine::CursorBetweenCharacters));return QVariant(d->xToPos(pt.x(), QTextLine::CursorBetweenCharacters));never executed: return QVariant(d->xToPos(pt.x(), QTextLine::CursorBetweenCharacters)); | 0 | ||||||||||||||||||||||||
| 840 | return never executed: QVariant(d->control->cursor());return QVariant(d->control->cursor());never executed: }return QVariant(d->control->cursor()); | 0 | ||||||||||||||||||||||||
| 841 | case never executed: Qt::ImSurroundingText:case Qt::ImSurroundingText:never executed: case Qt::ImSurroundingText: | 0 | ||||||||||||||||||||||||
| 842 | return never executed: QVariant(d->control->text());return QVariant(d->control->text());never executed: return QVariant(d->control->text()); | 0 | ||||||||||||||||||||||||
| 843 | case never executed: Qt::ImCurrentSelection:case Qt::ImCurrentSelection:never executed: case Qt::ImCurrentSelection: | 0 | ||||||||||||||||||||||||
| 844 | return never executed: QVariant(selectedText());return QVariant(selectedText());never executed: return QVariant(selectedText()); | 0 | ||||||||||||||||||||||||
| 845 | case never executed: Qt::ImMaximumTextLength:case Qt::ImMaximumTextLength:never executed: case Qt::ImMaximumTextLength: | 0 | ||||||||||||||||||||||||
| 846 | return never executed: QVariant(maxLength());return QVariant(maxLength());never executed: return QVariant(maxLength()); | 0 | ||||||||||||||||||||||||
| 847 | case never executed: Qt::ImAnchorPosition:case Qt::ImAnchorPosition:never executed: case Qt::ImAnchorPosition: | 0 | ||||||||||||||||||||||||
| 848 | if (d->control->selectionStart() == d->control->selectionEnd()
| 0 | ||||||||||||||||||||||||
| 849 | return never executed: QVariant(d->control->cursor());return QVariant(d->control->cursor());never executed: return QVariant(d->control->cursor()); | 0 | ||||||||||||||||||||||||
| 850 | else if (d->control->selectionStart() == d->control->cursor()
| 0 | ||||||||||||||||||||||||
| 851 | return never executed: QVariant(d->control->selectionEnd());return QVariant(d->control->selectionEnd());never executed: return QVariant(d->control->selectionEnd()); | 0 | ||||||||||||||||||||||||
| 852 | else | - | ||||||||||||||||||||||||
| 853 | return never executed: QVariant(d->control->selectionStart());return QVariant(d->control->selectionStart());never executed: return QVariant(d->control->selectionStart()); | 0 | ||||||||||||||||||||||||
| 854 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 855 | return never executed: QWidget::inputMethodQuery(property);return QWidget::inputMethodQuery(property);never executed: return QWidget::inputMethodQuery(property); | 0 | ||||||||||||||||||||||||
| 856 | } | - | ||||||||||||||||||||||||
| 857 | } | - | ||||||||||||||||||||||||
| 858 | - | |||||||||||||||||||||||||
| 859 | - | |||||||||||||||||||||||||
| 860 | - | |||||||||||||||||||||||||
| 861 | - | |||||||||||||||||||||||||
| 862 | void QLineEdit::focusInEvent(QFocusEvent *e) | - | ||||||||||||||||||||||||
| 863 | { | - | ||||||||||||||||||||||||
| 864 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 865 | if (e->reason() == Qt::TabFocusReason
| 0 | ||||||||||||||||||||||||
| 866 | e->reason() == Qt::BacktabFocusReason
| 0 | ||||||||||||||||||||||||
| 867 | e->reason() == Qt::ShortcutFocusReason
| 0 | ||||||||||||||||||||||||
| 868 | if (!d->control->inputMask().isEmpty()
| 0 | ||||||||||||||||||||||||
| 869 | d->control->moveCursor(d->control->nextMaskBlank(0)); never executed: d->control->moveCursor(d->control->nextMaskBlank(0)); | 0 | ||||||||||||||||||||||||
| 870 | else if (!d->control->hasSelectedText()
| 0 | ||||||||||||||||||||||||
| 871 | selectAll(); never executed: selectAll(); | 0 | ||||||||||||||||||||||||
| 872 | } never executed: else if (e->reason() == Qt::MouseFocusReasonend of block
| 0 | ||||||||||||||||||||||||
| 873 | d->clickCausedFocus = 1; | - | ||||||||||||||||||||||||
| 874 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 875 | - | |||||||||||||||||||||||||
| 876 | - | |||||||||||||||||||||||||
| 877 | - | |||||||||||||||||||||||||
| 878 | d->control->setBlinkingCursorEnabled(true); | - | ||||||||||||||||||||||||
| 879 | QStyleOptionFrame opt; | - | ||||||||||||||||||||||||
| 880 | initStyleOption(&opt); | - | ||||||||||||||||||||||||
| 881 | if((!hasSelectedText()
| 0 | ||||||||||||||||||||||||
| 882 | || style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, this)
| 0 | ||||||||||||||||||||||||
| 883 | d->setCursorVisible(true); never executed: d->setCursorVisible(true); | 0 | ||||||||||||||||||||||||
| 884 | if (d->control->completer()
| 0 | ||||||||||||||||||||||||
| 885 | d->control->completer()->setWidget(this); | - | ||||||||||||||||||||||||
| 886 | QObject::connect(d->control->completer(), qFlagLocation("2""activated(QString)" "\0" __FILE__ ":" "1826"), | - | ||||||||||||||||||||||||
| 887 | this, qFlagLocation("1""setText(QString)" "\0" __FILE__ ":" "1827")); | - | ||||||||||||||||||||||||
| 888 | QObject::connect(d->control->completer(), qFlagLocation("2""highlighted(QString)" "\0" __FILE__ ":" "1828"), | - | ||||||||||||||||||||||||
| 889 | this, qFlagLocation("1""_q_completionHighlighted(QString)" "\0" __FILE__ ":" "1829")); | - | ||||||||||||||||||||||||
| 890 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 891 | - | |||||||||||||||||||||||||
| 892 | update(); | - | ||||||||||||||||||||||||
| 893 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 894 | - | |||||||||||||||||||||||||
| 895 | - | |||||||||||||||||||||||||
| 896 | - | |||||||||||||||||||||||||
| 897 | - | |||||||||||||||||||||||||
| 898 | void QLineEdit::focusOutEvent(QFocusEvent *e) | - | ||||||||||||||||||||||||
| 899 | { | - | ||||||||||||||||||||||||
| 900 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 901 | if (d->control->passwordEchoEditing()
| 0 | ||||||||||||||||||||||||
| 902 | - | |||||||||||||||||||||||||
| 903 | - | |||||||||||||||||||||||||
| 904 | d->updatePasswordEchoEditing(false); | - | ||||||||||||||||||||||||
| 905 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 906 | - | |||||||||||||||||||||||||
| 907 | Qt::FocusReason reason = e->reason(); | - | ||||||||||||||||||||||||
| 908 | if (reason != Qt::ActiveWindowFocusReason
| 0 | ||||||||||||||||||||||||
| 909 | reason != Qt::PopupFocusReason
| 0 | ||||||||||||||||||||||||
| 910 | deselect(); never executed: deselect(); | 0 | ||||||||||||||||||||||||
| 911 | - | |||||||||||||||||||||||||
| 912 | d->setCursorVisible(false); | - | ||||||||||||||||||||||||
| 913 | d->control->setBlinkingCursorEnabled(false); | - | ||||||||||||||||||||||||
| 914 | - | |||||||||||||||||||||||||
| 915 | - | |||||||||||||||||||||||||
| 916 | - | |||||||||||||||||||||||||
| 917 | - | |||||||||||||||||||||||||
| 918 | if (reason != Qt::PopupFocusReason
| 0 | ||||||||||||||||||||||||
| 919 | || !(QApplication::activePopupWidget()
| 0 | ||||||||||||||||||||||||
| 920 | if (hasAcceptableInput()
| 0 | ||||||||||||||||||||||||
| 921 | editingFinished(); never executed: editingFinished(); | 0 | ||||||||||||||||||||||||
| 922 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 923 | if (d->control->completer()
| 0 | ||||||||||||||||||||||||
| 924 | QObject::disconnect(d->control->completer(), 0, this, 0); | - | ||||||||||||||||||||||||
| 925 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 926 | - | |||||||||||||||||||||||||
| 927 | QWidget::focusOutEvent(e); | - | ||||||||||||||||||||||||
| 928 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 929 | - | |||||||||||||||||||||||||
| 930 | - | |||||||||||||||||||||||||
| 931 | - | |||||||||||||||||||||||||
| 932 | void QLineEdit::paintEvent(QPaintEvent *) | - | ||||||||||||||||||||||||
| 933 | { | - | ||||||||||||||||||||||||
| 934 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 935 | QPainter p(this); | - | ||||||||||||||||||||||||
| 936 | QPalette pal = palette(); | - | ||||||||||||||||||||||||
| 937 | - | |||||||||||||||||||||||||
| 938 | QStyleOptionFrame panel; | - | ||||||||||||||||||||||||
| 939 | initStyleOption(&panel); | - | ||||||||||||||||||||||||
| 940 | style()->drawPrimitive(QStyle::PE_PanelLineEdit, &panel, &p, this); | - | ||||||||||||||||||||||||
| 941 | QRect r = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this); | - | ||||||||||||||||||||||||
| 942 | r.setX(r.x() + d->effectiveLeftTextMargin()); | - | ||||||||||||||||||||||||
| 943 | r.setY(r.y() + d->topTextMargin); | - | ||||||||||||||||||||||||
| 944 | r.setRight(r.right() - d->effectiveRightTextMargin()); | - | ||||||||||||||||||||||||
| 945 | r.setBottom(r.bottom() - d->bottomTextMargin); | - | ||||||||||||||||||||||||
| 946 | p.setClipRect(r); | - | ||||||||||||||||||||||||
| 947 | - | |||||||||||||||||||||||||
| 948 | QFontMetrics fm = fontMetrics(); | - | ||||||||||||||||||||||||
| 949 | Qt::Alignment va = QStyle::visualAlignment(d->control->layoutDirection(), QFlag(d->alignment)); | - | ||||||||||||||||||||||||
| 950 | switch (va & Qt::AlignVertical_Mask) { | - | ||||||||||||||||||||||||
| 951 | case never executed: Qt::AlignBottom:case Qt::AlignBottom:never executed: case Qt::AlignBottom: | 0 | ||||||||||||||||||||||||
| 952 | d->vscroll = r.y() + r.height() - fm.height() - d->verticalMargin; | - | ||||||||||||||||||||||||
| 953 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 954 | case never executed: Qt::AlignTop:case Qt::AlignTop:never executed: case Qt::AlignTop: | 0 | ||||||||||||||||||||||||
| 955 | d->vscroll = r.y() + d->verticalMargin; | - | ||||||||||||||||||||||||
| 956 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 957 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 958 | - | |||||||||||||||||||||||||
| 959 | d->vscroll = r.y() + (r.height() - fm.height() + 1) / 2; | - | ||||||||||||||||||||||||
| 960 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 961 | } | - | ||||||||||||||||||||||||
| 962 | QRect lineRect(r.x() + d->horizontalMargin, d->vscroll, r.width() - 2*d->horizontalMargin, fm.height()); | - | ||||||||||||||||||||||||
| 963 | - | |||||||||||||||||||||||||
| 964 | if (d->shouldShowPlaceholderText()
| 0 | ||||||||||||||||||||||||
| 965 | if (!d->placeholderText.isEmpty()
| 0 | ||||||||||||||||||||||||
| 966 | QColor col = pal.text().color(); | - | ||||||||||||||||||||||||
| 967 | col.setAlpha(128); | - | ||||||||||||||||||||||||
| 968 | QPen oldpen = p.pen(); | - | ||||||||||||||||||||||||
| 969 | p.setPen(col); | - | ||||||||||||||||||||||||
| 970 | QString elidedText = fm.elidedText(d->placeholderText, Qt::ElideRight, lineRect.width()); | - | ||||||||||||||||||||||||
| 971 | p.drawText(lineRect, va, elidedText); | - | ||||||||||||||||||||||||
| 972 | p.setPen(oldpen); | - | ||||||||||||||||||||||||
| 973 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 974 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 975 | - | |||||||||||||||||||||||||
| 976 | int cix = qRound(d->control->cursorToX()); | - | ||||||||||||||||||||||||
| 977 | - | |||||||||||||||||||||||||
| 978 | - | |||||||||||||||||||||||||
| 979 | - | |||||||||||||||||||||||||
| 980 | - | |||||||||||||||||||||||||
| 981 | - | |||||||||||||||||||||||||
| 982 | - | |||||||||||||||||||||||||
| 983 | int widthUsed = qRound(d->control->naturalTextWidth()) + 1; | - | ||||||||||||||||||||||||
| 984 | if (widthUsed <= lineRect.width()
| 0 | ||||||||||||||||||||||||
| 985 | - | |||||||||||||||||||||||||
| 986 | switch (va & ~(Qt::AlignAbsolute|Qt::AlignVertical_Mask)) { | - | ||||||||||||||||||||||||
| 987 | case never executed: Qt::AlignRight:case Qt::AlignRight:never executed: case Qt::AlignRight: | 0 | ||||||||||||||||||||||||
| 988 | d->hscroll = widthUsed - lineRect.width() + 1; | - | ||||||||||||||||||||||||
| 989 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 990 | case never executed: Qt::AlignHCenter:case Qt::AlignHCenter:never executed: case Qt::AlignHCenter: | 0 | ||||||||||||||||||||||||
| 991 | d->hscroll = (widthUsed - lineRect.width()) / 2; | - | ||||||||||||||||||||||||
| 992 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 993 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 994 | - | |||||||||||||||||||||||||
| 995 | d->hscroll = 0; | - | ||||||||||||||||||||||||
| 996 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 997 | } | - | ||||||||||||||||||||||||
| 998 | } else if (cix - d->hscroll >= lineRect.width()
| 0 | ||||||||||||||||||||||||
| 999 | - | |||||||||||||||||||||||||
| 1000 | d->hscroll = cix - lineRect.width() + 1; | - | ||||||||||||||||||||||||
| 1001 | } never executed: else if (cix - d->hscroll < 0end of block
| 0 | ||||||||||||||||||||||||
| 1002 | - | |||||||||||||||||||||||||
| 1003 | d->hscroll = cix; | - | ||||||||||||||||||||||||
| 1004 | } never executed: else if (widthUsed - d->hscroll < lineRect.width()end of block
| 0 | ||||||||||||||||||||||||
| 1005 | - | |||||||||||||||||||||||||
| 1006 | - | |||||||||||||||||||||||||
| 1007 | d->hscroll = widthUsed - lineRect.width() + 1; | - | ||||||||||||||||||||||||
| 1008 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1009 | - | |||||||||||||||||||||||||
| 1010 | d->hscroll = qMax(0, d->hscroll); | - | ||||||||||||||||||||||||
| 1011 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1012 | - | |||||||||||||||||||||||||
| 1013 | - | |||||||||||||||||||||||||
| 1014 | QPoint topLeft = lineRect.topLeft() - QPoint(d->hscroll, d->control->ascent() - fm.ascent()); | - | ||||||||||||||||||||||||
| 1015 | - | |||||||||||||||||||||||||
| 1016 | - | |||||||||||||||||||||||||
| 1017 | - | |||||||||||||||||||||||||
| 1018 | if (QStyleSheetStyle* cssStyle = qobject_cast<QStyleSheetStyle*>(style())
| 0 | ||||||||||||||||||||||||
| 1019 | cssStyle->styleSheetPalette(this, &panel, &pal); | - | ||||||||||||||||||||||||
| 1020 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1021 | - | |||||||||||||||||||||||||
| 1022 | p.setPen(pal.text().color()); | - | ||||||||||||||||||||||||
| 1023 | - | |||||||||||||||||||||||||
| 1024 | int flags = QWidgetLineControl::DrawText; | - | ||||||||||||||||||||||||
| 1025 | - | |||||||||||||||||||||||||
| 1026 | - | |||||||||||||||||||||||||
| 1027 | - | |||||||||||||||||||||||||
| 1028 | - | |||||||||||||||||||||||||
| 1029 | if (d->control->hasSelectedText()
| 0 | ||||||||||||||||||||||||
| 1030 | flags |= QWidgetLineControl::DrawSelections; | - | ||||||||||||||||||||||||
| 1031 | - | |||||||||||||||||||||||||
| 1032 | if (d->control->palette() != pal
| 0 | ||||||||||||||||||||||||
| 1033 | || d->control->palette().currentColorGroup() != pal.currentColorGroup()
| 0 | ||||||||||||||||||||||||
| 1034 | d->control->setPalette(pal); never executed: d->control->setPalette(pal); | 0 | ||||||||||||||||||||||||
| 1035 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1036 | - | |||||||||||||||||||||||||
| 1037 | - | |||||||||||||||||||||||||
| 1038 | - | |||||||||||||||||||||||||
| 1039 | - | |||||||||||||||||||||||||
| 1040 | if (d->cursorVisible
| 0 | ||||||||||||||||||||||||
| 1041 | flags |= QWidgetLineControl::DrawCursor; never executed: flags |= QWidgetLineControl::DrawCursor; | 0 | ||||||||||||||||||||||||
| 1042 | - | |||||||||||||||||||||||||
| 1043 | d->control->setCursorWidth(style()->pixelMetric(QStyle::PM_TextCursorWidth)); | - | ||||||||||||||||||||||||
| 1044 | d->control->draw(&p, topLeft, r, flags); | - | ||||||||||||||||||||||||
| 1045 | - | |||||||||||||||||||||||||
| 1046 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1047 | - | |||||||||||||||||||||||||
| 1048 | - | |||||||||||||||||||||||||
| 1049 | - | |||||||||||||||||||||||||
| 1050 | - | |||||||||||||||||||||||||
| 1051 | - | |||||||||||||||||||||||||
| 1052 | void QLineEdit::dragMoveEvent(QDragMoveEvent *e) | - | ||||||||||||||||||||||||
| 1053 | { | - | ||||||||||||||||||||||||
| 1054 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1055 | if (!d->control->isReadOnly()
| 0 | ||||||||||||||||||||||||
| 1056 | e->acceptProposedAction(); | - | ||||||||||||||||||||||||
| 1057 | d->control->moveCursor(d->xToPos(e->pos().x()), false); | - | ||||||||||||||||||||||||
| 1058 | d->cursorVisible = true; | - | ||||||||||||||||||||||||
| 1059 | update(); | - | ||||||||||||||||||||||||
| 1060 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1061 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1062 | - | |||||||||||||||||||||||||
| 1063 | - | |||||||||||||||||||||||||
| 1064 | void QLineEdit::dragEnterEvent(QDragEnterEvent * e) | - | ||||||||||||||||||||||||
| 1065 | { | - | ||||||||||||||||||||||||
| 1066 | QLineEdit::dragMoveEvent(e); | - | ||||||||||||||||||||||||
| 1067 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1068 | - | |||||||||||||||||||||||||
| 1069 | - | |||||||||||||||||||||||||
| 1070 | void QLineEdit::dragLeaveEvent(QDragLeaveEvent *) | - | ||||||||||||||||||||||||
| 1071 | { | - | ||||||||||||||||||||||||
| 1072 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1073 | if (d->cursorVisible
| 0 | ||||||||||||||||||||||||
| 1074 | d->cursorVisible = false; | - | ||||||||||||||||||||||||
| 1075 | update(); | - | ||||||||||||||||||||||||
| 1076 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1077 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1078 | - | |||||||||||||||||||||||||
| 1079 | - | |||||||||||||||||||||||||
| 1080 | void QLineEdit::dropEvent(QDropEvent* e) | - | ||||||||||||||||||||||||
| 1081 | { | - | ||||||||||||||||||||||||
| 1082 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1083 | QString str = e->mimeData()->text(); | - | ||||||||||||||||||||||||
| 1084 | - | |||||||||||||||||||||||||
| 1085 | if (!str.isNull()
| 0 | ||||||||||||||||||||||||
| 1086 | if (e->source() == this
| 0 | ||||||||||||||||||||||||
| 1087 | deselect(); never executed: deselect(); | 0 | ||||||||||||||||||||||||
| 1088 | int cursorPos = d->xToPos(e->pos().x()); | - | ||||||||||||||||||||||||
| 1089 | int selStart = cursorPos; | - | ||||||||||||||||||||||||
| 1090 | int oldSelStart = d->control->selectionStart(); | - | ||||||||||||||||||||||||
| 1091 | int oldSelEnd = d->control->selectionEnd(); | - | ||||||||||||||||||||||||
| 1092 | d->control->moveCursor(cursorPos, false); | - | ||||||||||||||||||||||||
| 1093 | d->cursorVisible = false; | - | ||||||||||||||||||||||||
| 1094 | e->acceptProposedAction(); | - | ||||||||||||||||||||||||
| 1095 | insert(str); | - | ||||||||||||||||||||||||
| 1096 | if (e->source() == this
| 0 | ||||||||||||||||||||||||
| 1097 | if (e->dropAction() == Qt::MoveAction
| 0 | ||||||||||||||||||||||||
| 1098 | if (selStart > oldSelStart
| 0 | ||||||||||||||||||||||||
| 1099 | setSelection(oldSelStart, str.length()); never executed: setSelection(oldSelStart, str.length()); | 0 | ||||||||||||||||||||||||
| 1100 | else if (selStart > oldSelEnd
| 0 | ||||||||||||||||||||||||
| 1101 | setSelection(selStart - str.length(), str.length()); never executed: setSelection(selStart - str.length(), str.length()); | 0 | ||||||||||||||||||||||||
| 1102 | else | - | ||||||||||||||||||||||||
| 1103 | setSelection(selStart, str.length()); never executed: setSelection(selStart, str.length()); | 0 | ||||||||||||||||||||||||
| 1104 | } else { | - | ||||||||||||||||||||||||
| 1105 | setSelection(selStart, str.length()); | - | ||||||||||||||||||||||||
| 1106 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1107 | } | - | ||||||||||||||||||||||||
| 1108 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||
| 1109 | e->ignore(); | - | ||||||||||||||||||||||||
| 1110 | update(); | - | ||||||||||||||||||||||||
| 1111 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1112 | } | - | ||||||||||||||||||||||||
| 1113 | void QLineEdit::contextMenuEvent(QContextMenuEvent *event) | - | ||||||||||||||||||||||||
| 1114 | { | - | ||||||||||||||||||||||||
| 1115 | if (QMenu *menu = createStandardContextMenu()
| 0 | ||||||||||||||||||||||||
| 1116 | menu->setAttribute(Qt::WA_DeleteOnClose); | - | ||||||||||||||||||||||||
| 1117 | menu->popup(event->globalPos()); | - | ||||||||||||||||||||||||
| 1118 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1119 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1120 | - | |||||||||||||||||||||||||
| 1121 | static inline void setActionIcon(QAction *action, const QString &name) | - | ||||||||||||||||||||||||
| 1122 | { | - | ||||||||||||||||||||||||
| 1123 | const QIcon icon = QIcon::fromTheme(name); | - | ||||||||||||||||||||||||
| 1124 | if (!icon.isNull()
| 0 | ||||||||||||||||||||||||
| 1125 | action->setIcon(icon); never executed: action->setIcon(icon); | 0 | ||||||||||||||||||||||||
| 1126 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1127 | - | |||||||||||||||||||||||||
| 1128 | - | |||||||||||||||||||||||||
| 1129 | - | |||||||||||||||||||||||||
| 1130 | - | |||||||||||||||||||||||||
| 1131 | - | |||||||||||||||||||||||||
| 1132 | - | |||||||||||||||||||||||||
| 1133 | - | |||||||||||||||||||||||||
| 1134 | QMenu *QLineEdit::createStandardContextMenu() | - | ||||||||||||||||||||||||
| 1135 | { | - | ||||||||||||||||||||||||
| 1136 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1137 | QMenu *popup = new QMenu(this); | - | ||||||||||||||||||||||||
| 1138 | popup->setObjectName(QLatin1String("qt_edit_menu")); | - | ||||||||||||||||||||||||
| 1139 | QAction *action = 0; | - | ||||||||||||||||||||||||
| 1140 | - | |||||||||||||||||||||||||
| 1141 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||
| 1142 | action = popup->addAction(QLineEdit::tr("&Undo") + (!(static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.hasShortcutForKeySequence(QKeySequence::Undo) ? QLatin1Char('\t') + QKeySequence(QKeySequence::Undo).toString(QKeySequence::NativeText) : QString())); | - | ||||||||||||||||||||||||
| 1143 | action->setEnabled(d->control->isUndoAvailable()); | - | ||||||||||||||||||||||||
| 1144 | setActionIcon(action, ([]() -> QString { enum { Size = sizeof(u"" "edit-undo")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "edit-undo" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp;never executed: }()));return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 1145 | connect(action, qFlagLocation("2""triggered()" "\0" __FILE__ ":" "2114"), qFlagLocation("1""undo()" "\0" __FILE__ ":" "2114")); | - | ||||||||||||||||||||||||
| 1146 | - | |||||||||||||||||||||||||
| 1147 | action = popup->addAction(QLineEdit::tr("&Redo") + (!(static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.hasShortcutForKeySequence(QKeySequence::Redo) ? QLatin1Char('\t') + QKeySequence(QKeySequence::Redo).toString(QKeySequence::NativeText) : QString())); | - | ||||||||||||||||||||||||
| 1148 | action->setEnabled(d->control->isRedoAvailable()); | - | ||||||||||||||||||||||||
| 1149 | setActionIcon(action, ([]() -> QString { enum { Size = sizeof(u"" "edit-redo")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "edit-redo" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp;never executed: }()));return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 1150 | connect(action, qFlagLocation("2""triggered()" "\0" __FILE__ ":" "2119"), qFlagLocation("1""redo()" "\0" __FILE__ ":" "2119")); | - | ||||||||||||||||||||||||
| 1151 | - | |||||||||||||||||||||||||
| 1152 | popup->addSeparator(); | - | ||||||||||||||||||||||||
| 1153 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1154 | - | |||||||||||||||||||||||||
| 1155 | - | |||||||||||||||||||||||||
| 1156 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||
| 1157 | action = popup->addAction(QLineEdit::tr("Cu&t") + (!(static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.hasShortcutForKeySequence(QKeySequence::Cut) ? QLatin1Char('\t') + QKeySequence(QKeySequence::Cut).toString(QKeySequence::NativeText) : QString())); | - | ||||||||||||||||||||||||
| 1158 | action->setEnabled(!d->control->isReadOnly() && d->control->hasSelectedText() | - | ||||||||||||||||||||||||
| 1159 | && d->control->echoMode() == QLineEdit::Normal); | - | ||||||||||||||||||||||||
| 1160 | setActionIcon(action, ([]() -> QString { enum { Size = sizeof(u"" "edit-cut")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "edit-cut" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp;never executed: }()));return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 1161 | connect(action, qFlagLocation("2""triggered()" "\0" __FILE__ ":" "2130"), qFlagLocation("1""cut()" "\0" __FILE__ ":" "2130")); | - | ||||||||||||||||||||||||
| 1162 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1163 | - | |||||||||||||||||||||||||
| 1164 | action = popup->addAction(QLineEdit::tr("&Copy") + (!(static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.hasShortcutForKeySequence(QKeySequence::Copy) ? QLatin1Char('\t') + QKeySequence(QKeySequence::Copy).toString(QKeySequence::NativeText) : QString())); | - | ||||||||||||||||||||||||
| 1165 | action->setEnabled(d->control->hasSelectedText() | - | ||||||||||||||||||||||||
| 1166 | && d->control->echoMode() == QLineEdit::Normal); | - | ||||||||||||||||||||||||
| 1167 | setActionIcon(action, ([]() -> QString { enum { Size = sizeof(u"" "edit-copy")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "edit-copy" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp;never executed: }()));return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 1168 | connect(action, qFlagLocation("2""triggered()" "\0" __FILE__ ":" "2137"), qFlagLocation("1""copy()" "\0" __FILE__ ":" "2137")); | - | ||||||||||||||||||||||||
| 1169 | - | |||||||||||||||||||||||||
| 1170 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||
| 1171 | action = popup->addAction(QLineEdit::tr("&Paste") + (!(static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.hasShortcutForKeySequence(QKeySequence::Paste) ? QLatin1Char('\t') + QKeySequence(QKeySequence::Paste).toString(QKeySequence::NativeText) : QString())); | - | ||||||||||||||||||||||||
| 1172 | action->setEnabled(!d->control->isReadOnly() && !QApplication::clipboard()->text().isEmpty()); | - | ||||||||||||||||||||||||
| 1173 | setActionIcon(action, ([]() -> QString { enum { Size = sizeof(u"" "edit-paste")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "edit-paste" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp;never executed: }()));return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 1174 | connect(action, qFlagLocation("2""triggered()" "\0" __FILE__ ":" "2143"), qFlagLocation("1""paste()" "\0" __FILE__ ":" "2143")); | - | ||||||||||||||||||||||||
| 1175 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1176 | - | |||||||||||||||||||||||||
| 1177 | - | |||||||||||||||||||||||||
| 1178 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||
| 1179 | action = popup->addAction(QLineEdit::tr("Delete")); | - | ||||||||||||||||||||||||
| 1180 | action->setEnabled(!d->control->isReadOnly() && !d->control->text().isEmpty() && d->control->hasSelectedText()); | - | ||||||||||||||||||||||||
| 1181 | setActionIcon(action, ([]() -> QString { enum { Size = sizeof(u"" "edit-delete")/2 - 1 }; static const QStaticStringData<Size> qstring_literal = { { { { -1 } }, Size, 0, 0, sizeof(QStringData) }, u"" "edit-delete" }; QStringDataPtr holder = { qstring_literal.data_ptr() }; const QString qstring_literal_temp(holder); return never executed: qstring_literal_temp;return qstring_literal_temp;never executed: }()));return qstring_literal_temp; | 0 | ||||||||||||||||||||||||
| 1182 | connect(action, qFlagLocation("2""triggered()" "\0" __FILE__ ":" "2151"), d->control, qFlagLocation("1""_q_deleteSelected()" "\0" __FILE__ ":" "2151")); | - | ||||||||||||||||||||||||
| 1183 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1184 | - | |||||||||||||||||||||||||
| 1185 | if (!popup->isEmpty()
| 0 | ||||||||||||||||||||||||
| 1186 | popup->addSeparator(); never executed: popup->addSeparator(); | 0 | ||||||||||||||||||||||||
| 1187 | - | |||||||||||||||||||||||||
| 1188 | action = popup->addAction(QLineEdit::tr("Select All") + (!(static_cast<QApplication *>(QCoreApplication::instance()))->d_func()->shortcutMap.hasShortcutForKeySequence(QKeySequence::SelectAll) ? QLatin1Char('\t') + QKeySequence(QKeySequence::SelectAll).toString(QKeySequence::NativeText) : QString())); | - | ||||||||||||||||||||||||
| 1189 | action->setEnabled(!d->control->text().isEmpty() && !d->control->allSelected()); | - | ||||||||||||||||||||||||
| 1190 | d->selectAllAction = action; | - | ||||||||||||||||||||||||
| 1191 | connect(action, qFlagLocation("2""triggered()" "\0" __FILE__ ":" "2160"), qFlagLocation("1""selectAll()" "\0" __FILE__ ":" "2160")); | - | ||||||||||||||||||||||||
| 1192 | - | |||||||||||||||||||||||||
| 1193 | if (!d->control->isReadOnly()
| 0 | ||||||||||||||||||||||||
| 1194 | popup->addSeparator(); | - | ||||||||||||||||||||||||
| 1195 | QUnicodeControlCharacterMenu *ctrlCharacterMenu = new QUnicodeControlCharacterMenu(this, popup); | - | ||||||||||||||||||||||||
| 1196 | popup->addMenu(ctrlCharacterMenu); | - | ||||||||||||||||||||||||
| 1197 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1198 | return never executed: popup;return popup;never executed: return popup; | 0 | ||||||||||||||||||||||||
| 1199 | } | - | ||||||||||||||||||||||||
| 1200 | - | |||||||||||||||||||||||||
| 1201 | - | |||||||||||||||||||||||||
| 1202 | - | |||||||||||||||||||||||||
| 1203 | void QLineEdit::changeEvent(QEvent *ev) | - | ||||||||||||||||||||||||
| 1204 | { | - | ||||||||||||||||||||||||
| 1205 | QLineEditPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 1206 | switch(ev->type()) | - | ||||||||||||||||||||||||
| 1207 | { | - | ||||||||||||||||||||||||
| 1208 | case never executed: QEvent::ActivationChange:case QEvent::ActivationChange:never executed: case QEvent::ActivationChange: | 0 | ||||||||||||||||||||||||
| 1209 | if (!palette().isEqual(QPalette::Active, QPalette::Inactive)
| 0 | ||||||||||||||||||||||||
| 1210 | update(); never executed: update(); | 0 | ||||||||||||||||||||||||
| 1211 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1212 | case never executed: QEvent::FontChange:case QEvent::FontChange:never executed: case QEvent::FontChange: | 0 | ||||||||||||||||||||||||
| 1213 | d->control->setFont(font()); | - | ||||||||||||||||||||||||
| 1214 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1215 | case never executed: QEvent::StyleChange:case QEvent::StyleChange:never executed: case QEvent::StyleChange: | 0 | ||||||||||||||||||||||||
| 1216 | { | - | ||||||||||||||||||||||||
| 1217 | QStyleOptionFrame opt; | - | ||||||||||||||||||||||||
| 1218 | initStyleOption(&opt); | - | ||||||||||||||||||||||||
| 1219 | d->control->setPasswordCharacter(style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, this)); | - | ||||||||||||||||||||||||
| 1220 | d->control->setPasswordMaskDelay(style()->styleHint(QStyle::SH_LineEdit_PasswordMaskDelay, &opt, this)); | - | ||||||||||||||||||||||||
| 1221 | } | - | ||||||||||||||||||||||||
| 1222 | update(); | - | ||||||||||||||||||||||||
| 1223 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1224 | case never executed: QEvent::LayoutDirectionChange:case QEvent::LayoutDirectionChange:never executed: case QEvent::LayoutDirectionChange: | 0 | ||||||||||||||||||||||||
| 1225 | for (const auto &e : d->trailingSideWidgets) { | - | ||||||||||||||||||||||||
| 1226 | if (e.flags & QLineEditPrivate::SideWidgetClearButton
| 0 | ||||||||||||||||||||||||
| 1227 | static_cast< never executed: QLineEditIconButton *>(e.widget)->setIcon(d->clearButtonIcon());static_cast<QLineEditIconButton *>(e.widget)->setIcon(d->clearButtonIcon());never executed: static_cast<QLineEditIconButton *>(e.widget)->setIcon(d->clearButtonIcon()); | 0 | ||||||||||||||||||||||||
| 1228 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1229 | d->positionSideWidgets(); | - | ||||||||||||||||||||||||
| 1230 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1231 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||
| 1232 | break; never executed: break; | 0 | ||||||||||||||||||||||||
| 1233 | } | - | ||||||||||||||||||||||||
| 1234 | QWidget::changeEvent(ev); | - | ||||||||||||||||||||||||
| 1235 | } never executed: end of block | 0 | ||||||||||||||||||||||||
| 1236 | - | |||||||||||||||||||||||||
| 1237 | - | |||||||||||||||||||||||||
| 1238 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |