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