| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qabstractspinbox.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||||||||||||||
| 6 | QAbstractSpinBox::QAbstractSpinBox(QWidget *parent) | - | ||||||||||||||||||||||||||||||||||||
| 7 | : QWidget(*new QAbstractSpinBoxPrivate, parent, 0) | - | ||||||||||||||||||||||||||||||||||||
| 8 | { | - | ||||||||||||||||||||||||||||||||||||
| 9 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 10 | d->init(); | - | ||||||||||||||||||||||||||||||||||||
| 11 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 12 | - | |||||||||||||||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||||||||||||||
| 14 | - | |||||||||||||||||||||||||||||||||||||
| 15 | - | |||||||||||||||||||||||||||||||||||||
| 16 | QAbstractSpinBox::QAbstractSpinBox(QAbstractSpinBoxPrivate &dd, QWidget *parent) | - | ||||||||||||||||||||||||||||||||||||
| 17 | : QWidget(dd, parent, 0) | - | ||||||||||||||||||||||||||||||||||||
| 18 | { | - | ||||||||||||||||||||||||||||||||||||
| 19 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 20 | d->init(); | - | ||||||||||||||||||||||||||||||||||||
| 21 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 22 | - | |||||||||||||||||||||||||||||||||||||
| 23 | - | |||||||||||||||||||||||||||||||||||||
| 24 | - | |||||||||||||||||||||||||||||||||||||
| 25 | - | |||||||||||||||||||||||||||||||||||||
| 26 | - | |||||||||||||||||||||||||||||||||||||
| 27 | QAbstractSpinBox::~QAbstractSpinBox() | - | ||||||||||||||||||||||||||||||||||||
| 28 | { | - | ||||||||||||||||||||||||||||||||||||
| 29 | } | - | ||||||||||||||||||||||||||||||||||||
| 30 | QAbstractSpinBox::ButtonSymbols QAbstractSpinBox::buttonSymbols() const | - | ||||||||||||||||||||||||||||||||||||
| 31 | { | - | ||||||||||||||||||||||||||||||||||||
| 32 | const QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 33 | return never executed: d->buttonSymbols;return d->buttonSymbols;never executed: return d->buttonSymbols; | 0 | ||||||||||||||||||||||||||||||||||||
| 34 | } | - | ||||||||||||||||||||||||||||||||||||
| 35 | - | |||||||||||||||||||||||||||||||||||||
| 36 | void QAbstractSpinBox::setButtonSymbols(ButtonSymbols buttonSymbols) | - | ||||||||||||||||||||||||||||||||||||
| 37 | { | - | ||||||||||||||||||||||||||||||||||||
| 38 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 39 | if (d->buttonSymbols != buttonSymbols
| 0 | ||||||||||||||||||||||||||||||||||||
| 40 | d->buttonSymbols = buttonSymbols; | - | ||||||||||||||||||||||||||||||||||||
| 41 | d->updateEditFieldGeometry(); | - | ||||||||||||||||||||||||||||||||||||
| 42 | update(); | - | ||||||||||||||||||||||||||||||||||||
| 43 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 44 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 45 | QString QAbstractSpinBox::text() const | - | ||||||||||||||||||||||||||||||||||||
| 46 | { | - | ||||||||||||||||||||||||||||||||||||
| 47 | return never executed: lineEdit()->displayText();return lineEdit()->displayText();never executed: return lineEdit()->displayText(); | 0 | ||||||||||||||||||||||||||||||||||||
| 48 | } | - | ||||||||||||||||||||||||||||||||||||
| 49 | QString QAbstractSpinBox::specialValueText() const | - | ||||||||||||||||||||||||||||||||||||
| 50 | { | - | ||||||||||||||||||||||||||||||||||||
| 51 | const QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 52 | return never executed: d->specialValueText;return d->specialValueText;never executed: return d->specialValueText; | 0 | ||||||||||||||||||||||||||||||||||||
| 53 | } | - | ||||||||||||||||||||||||||||||||||||
| 54 | - | |||||||||||||||||||||||||||||||||||||
| 55 | void QAbstractSpinBox::setSpecialValueText(const QString &specialValueText) | - | ||||||||||||||||||||||||||||||||||||
| 56 | { | - | ||||||||||||||||||||||||||||||||||||
| 57 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||||||||||||||
| 59 | d->specialValueText = specialValueText; | - | ||||||||||||||||||||||||||||||||||||
| 60 | d->cachedSizeHint = QSize(); | - | ||||||||||||||||||||||||||||||||||||
| 61 | d->clearCache(); | - | ||||||||||||||||||||||||||||||||||||
| 62 | d->updateEdit(); | - | ||||||||||||||||||||||||||||||||||||
| 63 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 64 | bool QAbstractSpinBox::wrapping() const | - | ||||||||||||||||||||||||||||||||||||
| 65 | { | - | ||||||||||||||||||||||||||||||||||||
| 66 | const QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 67 | return never executed: d->wrapping;return d->wrapping;never executed: return d->wrapping; | 0 | ||||||||||||||||||||||||||||||||||||
| 68 | } | - | ||||||||||||||||||||||||||||||||||||
| 69 | - | |||||||||||||||||||||||||||||||||||||
| 70 | void QAbstractSpinBox::setWrapping(bool wrapping) | - | ||||||||||||||||||||||||||||||||||||
| 71 | { | - | ||||||||||||||||||||||||||||||||||||
| 72 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 73 | d->wrapping = wrapping; | - | ||||||||||||||||||||||||||||||||||||
| 74 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 75 | bool QAbstractSpinBox::isReadOnly() const | - | ||||||||||||||||||||||||||||||||||||
| 76 | { | - | ||||||||||||||||||||||||||||||||||||
| 77 | const QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 78 | return never executed: d->readOnly;return d->readOnly;never executed: return d->readOnly; | 0 | ||||||||||||||||||||||||||||||||||||
| 79 | } | - | ||||||||||||||||||||||||||||||||||||
| 80 | - | |||||||||||||||||||||||||||||||||||||
| 81 | void QAbstractSpinBox::setReadOnly(bool enable) | - | ||||||||||||||||||||||||||||||||||||
| 82 | { | - | ||||||||||||||||||||||||||||||||||||
| 83 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 84 | d->readOnly = enable; | - | ||||||||||||||||||||||||||||||||||||
| 85 | d->edit->setReadOnly(enable); | - | ||||||||||||||||||||||||||||||||||||
| 86 | QEvent event(QEvent::ReadOnlyChange); | - | ||||||||||||||||||||||||||||||||||||
| 87 | QApplication::sendEvent(this, &event); | - | ||||||||||||||||||||||||||||||||||||
| 88 | update(); | - | ||||||||||||||||||||||||||||||||||||
| 89 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 90 | bool QAbstractSpinBox::keyboardTracking() const | - | ||||||||||||||||||||||||||||||||||||
| 91 | { | - | ||||||||||||||||||||||||||||||||||||
| 92 | const QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 93 | return never executed: d->keyboardTracking;return d->keyboardTracking;never executed: return d->keyboardTracking; | 0 | ||||||||||||||||||||||||||||||||||||
| 94 | } | - | ||||||||||||||||||||||||||||||||||||
| 95 | - | |||||||||||||||||||||||||||||||||||||
| 96 | void QAbstractSpinBox::setKeyboardTracking(bool enable) | - | ||||||||||||||||||||||||||||||||||||
| 97 | { | - | ||||||||||||||||||||||||||||||||||||
| 98 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 99 | d->keyboardTracking = enable; | - | ||||||||||||||||||||||||||||||||||||
| 100 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 101 | bool QAbstractSpinBox::hasFrame() const | - | ||||||||||||||||||||||||||||||||||||
| 102 | { | - | ||||||||||||||||||||||||||||||||||||
| 103 | const QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 104 | return never executed: d->frame;return d->frame;never executed: return d->frame; | 0 | ||||||||||||||||||||||||||||||||||||
| 105 | } | - | ||||||||||||||||||||||||||||||||||||
| 106 | - | |||||||||||||||||||||||||||||||||||||
| 107 | - | |||||||||||||||||||||||||||||||||||||
| 108 | void QAbstractSpinBox::setFrame(bool enable) | - | ||||||||||||||||||||||||||||||||||||
| 109 | { | - | ||||||||||||||||||||||||||||||||||||
| 110 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 111 | d->frame = enable; | - | ||||||||||||||||||||||||||||||||||||
| 112 | update(); | - | ||||||||||||||||||||||||||||||||||||
| 113 | d->updateEditFieldGeometry(); | - | ||||||||||||||||||||||||||||||||||||
| 114 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 115 | void QAbstractSpinBox::setAccelerated(bool accelerate) | - | ||||||||||||||||||||||||||||||||||||
| 116 | { | - | ||||||||||||||||||||||||||||||||||||
| 117 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 118 | d->accelerate = accelerate; | - | ||||||||||||||||||||||||||||||||||||
| 119 | - | |||||||||||||||||||||||||||||||||||||
| 120 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 121 | bool QAbstractSpinBox::isAccelerated() const | - | ||||||||||||||||||||||||||||||||||||
| 122 | { | - | ||||||||||||||||||||||||||||||||||||
| 123 | const QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 124 | return never executed: d->accelerate;return d->accelerate;never executed: return d->accelerate; | 0 | ||||||||||||||||||||||||||||||||||||
| 125 | } | - | ||||||||||||||||||||||||||||||||||||
| 126 | bool QAbstractSpinBox::isGroupSeparatorShown() const | - | ||||||||||||||||||||||||||||||||||||
| 127 | { | - | ||||||||||||||||||||||||||||||||||||
| 128 | const QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 129 | return never executed: d->showGroupSeparator;return d->showGroupSeparator;never executed: return d->showGroupSeparator; | 0 | ||||||||||||||||||||||||||||||||||||
| 130 | } | - | ||||||||||||||||||||||||||||||||||||
| 131 | - | |||||||||||||||||||||||||||||||||||||
| 132 | void QAbstractSpinBox::setGroupSeparatorShown(bool shown) | - | ||||||||||||||||||||||||||||||||||||
| 133 | { | - | ||||||||||||||||||||||||||||||||||||
| 134 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 135 | if (d->showGroupSeparator == shown
| 0 | ||||||||||||||||||||||||||||||||||||
| 136 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 137 | d->showGroupSeparator = shown; | - | ||||||||||||||||||||||||||||||||||||
| 138 | d->setValue(d->value, EmitIfChanged); | - | ||||||||||||||||||||||||||||||||||||
| 139 | updateGeometry(); | - | ||||||||||||||||||||||||||||||||||||
| 140 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 141 | void QAbstractSpinBox::setCorrectionMode(CorrectionMode correctionMode) | - | ||||||||||||||||||||||||||||||||||||
| 142 | { | - | ||||||||||||||||||||||||||||||||||||
| 143 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 144 | d->correctionMode = correctionMode; | - | ||||||||||||||||||||||||||||||||||||
| 145 | - | |||||||||||||||||||||||||||||||||||||
| 146 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 147 | QAbstractSpinBox::CorrectionMode QAbstractSpinBox::correctionMode() const | - | ||||||||||||||||||||||||||||||||||||
| 148 | { | - | ||||||||||||||||||||||||||||||||||||
| 149 | const QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 150 | return never executed: d->correctionMode;return d->correctionMode;never executed: return d->correctionMode; | 0 | ||||||||||||||||||||||||||||||||||||
| 151 | } | - | ||||||||||||||||||||||||||||||||||||
| 152 | bool QAbstractSpinBox::hasAcceptableInput() const | - | ||||||||||||||||||||||||||||||||||||
| 153 | { | - | ||||||||||||||||||||||||||||||||||||
| 154 | const QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 155 | return never executed: d->edit->hasAcceptableInput();return d->edit->hasAcceptableInput();never executed: return d->edit->hasAcceptableInput(); | 0 | ||||||||||||||||||||||||||||||||||||
| 156 | } | - | ||||||||||||||||||||||||||||||||||||
| 157 | Qt::Alignment QAbstractSpinBox::alignment() const | - | ||||||||||||||||||||||||||||||||||||
| 158 | { | - | ||||||||||||||||||||||||||||||||||||
| 159 | const QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 160 | - | |||||||||||||||||||||||||||||||||||||
| 161 | return never executed: (Qt::Alignment)d->edit->alignment();return (Qt::Alignment)d->edit->alignment();never executed: return (Qt::Alignment)d->edit->alignment(); | 0 | ||||||||||||||||||||||||||||||||||||
| 162 | } | - | ||||||||||||||||||||||||||||||||||||
| 163 | - | |||||||||||||||||||||||||||||||||||||
| 164 | void QAbstractSpinBox::setAlignment(Qt::Alignment flag) | - | ||||||||||||||||||||||||||||||||||||
| 165 | { | - | ||||||||||||||||||||||||||||||||||||
| 166 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 167 | - | |||||||||||||||||||||||||||||||||||||
| 168 | d->edit->setAlignment(flag); | - | ||||||||||||||||||||||||||||||||||||
| 169 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 170 | - | |||||||||||||||||||||||||||||||||||||
| 171 | - | |||||||||||||||||||||||||||||||||||||
| 172 | - | |||||||||||||||||||||||||||||||||||||
| 173 | - | |||||||||||||||||||||||||||||||||||||
| 174 | - | |||||||||||||||||||||||||||||||||||||
| 175 | void QAbstractSpinBox::selectAll() | - | ||||||||||||||||||||||||||||||||||||
| 176 | { | - | ||||||||||||||||||||||||||||||||||||
| 177 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 178 | - | |||||||||||||||||||||||||||||||||||||
| 179 | - | |||||||||||||||||||||||||||||||||||||
| 180 | if (!d->specialValue()
| 0 | ||||||||||||||||||||||||||||||||||||
| 181 | const int tmp = d->edit->displayText().size() - d->suffix.size(); | - | ||||||||||||||||||||||||||||||||||||
| 182 | d->edit->setSelection(tmp, -(tmp - d->prefix.size())); | - | ||||||||||||||||||||||||||||||||||||
| 183 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 184 | d->edit->selectAll(); | - | ||||||||||||||||||||||||||||||||||||
| 185 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 186 | } | - | ||||||||||||||||||||||||||||||||||||
| 187 | - | |||||||||||||||||||||||||||||||||||||
| 188 | - | |||||||||||||||||||||||||||||||||||||
| 189 | - | |||||||||||||||||||||||||||||||||||||
| 190 | - | |||||||||||||||||||||||||||||||||||||
| 191 | - | |||||||||||||||||||||||||||||||||||||
| 192 | void QAbstractSpinBox::clear() | - | ||||||||||||||||||||||||||||||||||||
| 193 | { | - | ||||||||||||||||||||||||||||||||||||
| 194 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||||||||||||||
| 196 | d->edit->setText(d->prefix + d->suffix); | - | ||||||||||||||||||||||||||||||||||||
| 197 | d->edit->setCursorPosition(d->prefix.size()); | - | ||||||||||||||||||||||||||||||||||||
| 198 | d->cleared = true; | - | ||||||||||||||||||||||||||||||||||||
| 199 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 200 | QAbstractSpinBox::StepEnabled QAbstractSpinBox::stepEnabled() const | - | ||||||||||||||||||||||||||||||||||||
| 201 | { | - | ||||||||||||||||||||||||||||||||||||
| 202 | const QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 203 | if (d->readOnly
| 0 | ||||||||||||||||||||||||||||||||||||
| 204 | return never executed: StepNone;return StepNone;never executed: return StepNone; | 0 | ||||||||||||||||||||||||||||||||||||
| 205 | if (d->wrapping
| 0 | ||||||||||||||||||||||||||||||||||||
| 206 | return never executed: StepEnabled(StepUpEnabled | StepDownEnabled);return StepEnabled(StepUpEnabled | StepDownEnabled);never executed: return StepEnabled(StepUpEnabled | StepDownEnabled); | 0 | ||||||||||||||||||||||||||||||||||||
| 207 | StepEnabled ret = StepNone; | - | ||||||||||||||||||||||||||||||||||||
| 208 | if (d->variantCompare(d->value, d->maximum) < 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 209 | ret |= StepUpEnabled; | - | ||||||||||||||||||||||||||||||||||||
| 210 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 211 | if (d->variantCompare(d->value, d->minimum) > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 212 | ret |= StepDownEnabled; | - | ||||||||||||||||||||||||||||||||||||
| 213 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 214 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||||||||||||||||||||
| 215 | } | - | ||||||||||||||||||||||||||||||||||||
| 216 | QValidator::State QAbstractSpinBox::validate(QString & , int & ) const | - | ||||||||||||||||||||||||||||||||||||
| 217 | { | - | ||||||||||||||||||||||||||||||||||||
| 218 | return never executed: QValidator::Acceptable;return QValidator::Acceptable;never executed: return QValidator::Acceptable; | 0 | ||||||||||||||||||||||||||||||||||||
| 219 | } | - | ||||||||||||||||||||||||||||||||||||
| 220 | void QAbstractSpinBox::fixup(QString & ) const | - | ||||||||||||||||||||||||||||||||||||
| 221 | { | - | ||||||||||||||||||||||||||||||||||||
| 222 | } | - | ||||||||||||||||||||||||||||||||||||
| 223 | - | |||||||||||||||||||||||||||||||||||||
| 224 | - | |||||||||||||||||||||||||||||||||||||
| 225 | - | |||||||||||||||||||||||||||||||||||||
| 226 | - | |||||||||||||||||||||||||||||||||||||
| 227 | - | |||||||||||||||||||||||||||||||||||||
| 228 | - | |||||||||||||||||||||||||||||||||||||
| 229 | - | |||||||||||||||||||||||||||||||||||||
| 230 | void QAbstractSpinBox::stepUp() | - | ||||||||||||||||||||||||||||||||||||
| 231 | { | - | ||||||||||||||||||||||||||||||||||||
| 232 | stepBy(1); | - | ||||||||||||||||||||||||||||||||||||
| 233 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 234 | - | |||||||||||||||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||||||||||||||
| 237 | - | |||||||||||||||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||||||||||||||
| 239 | - | |||||||||||||||||||||||||||||||||||||
| 240 | - | |||||||||||||||||||||||||||||||||||||
| 241 | void QAbstractSpinBox::stepDown() | - | ||||||||||||||||||||||||||||||||||||
| 242 | { | - | ||||||||||||||||||||||||||||||||||||
| 243 | stepBy(-1); | - | ||||||||||||||||||||||||||||||||||||
| 244 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 245 | void QAbstractSpinBox::stepBy(int steps) | - | ||||||||||||||||||||||||||||||||||||
| 246 | { | - | ||||||||||||||||||||||||||||||||||||
| 247 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 248 | - | |||||||||||||||||||||||||||||||||||||
| 249 | const QVariant old = d->value; | - | ||||||||||||||||||||||||||||||||||||
| 250 | QString tmp = d->edit->displayText(); | - | ||||||||||||||||||||||||||||||||||||
| 251 | int cursorPos = d->edit->cursorPosition(); | - | ||||||||||||||||||||||||||||||||||||
| 252 | bool dontstep = false; | - | ||||||||||||||||||||||||||||||||||||
| 253 | EmitPolicy e = EmitIfChanged; | - | ||||||||||||||||||||||||||||||||||||
| 254 | if (d->pendingEmit
| 0 | ||||||||||||||||||||||||||||||||||||
| 255 | dontstep = validate(tmp, cursorPos) != QValidator::Acceptable; | - | ||||||||||||||||||||||||||||||||||||
| 256 | d->cleared = false; | - | ||||||||||||||||||||||||||||||||||||
| 257 | d->interpret(NeverEmit); | - | ||||||||||||||||||||||||||||||||||||
| 258 | if (d->value != old
| 0 | ||||||||||||||||||||||||||||||||||||
| 259 | e = AlwaysEmit; never executed: e = AlwaysEmit; | 0 | ||||||||||||||||||||||||||||||||||||
| 260 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 261 | if (!dontstep
| 0 | ||||||||||||||||||||||||||||||||||||
| 262 | d->setValue(d->bound(d->value + (d->singleStep * steps), old, steps), e); | - | ||||||||||||||||||||||||||||||||||||
| 263 | } never executed: else if (e == AlwaysEmitend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 264 | d->emitSignals(e, old); | - | ||||||||||||||||||||||||||||||||||||
| 265 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 266 | selectAll(); | - | ||||||||||||||||||||||||||||||||||||
| 267 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 268 | - | |||||||||||||||||||||||||||||||||||||
| 269 | - | |||||||||||||||||||||||||||||||||||||
| 270 | - | |||||||||||||||||||||||||||||||||||||
| 271 | - | |||||||||||||||||||||||||||||||||||||
| 272 | - | |||||||||||||||||||||||||||||||||||||
| 273 | QLineEdit *QAbstractSpinBox::lineEdit() const | - | ||||||||||||||||||||||||||||||||||||
| 274 | { | - | ||||||||||||||||||||||||||||||||||||
| 275 | const QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 276 | - | |||||||||||||||||||||||||||||||||||||
| 277 | return never executed: d->edit;return d->edit;never executed: return d->edit; | 0 | ||||||||||||||||||||||||||||||||||||
| 278 | } | - | ||||||||||||||||||||||||||||||||||||
| 279 | void QAbstractSpinBox::setLineEdit(QLineEdit *lineEdit) | - | ||||||||||||||||||||||||||||||||||||
| 280 | { | - | ||||||||||||||||||||||||||||||||||||
| 281 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 282 | - | |||||||||||||||||||||||||||||||||||||
| 283 | if (!lineEdit
| 0 | ||||||||||||||||||||||||||||||||||||
| 284 | ((!(lineEdit)) ? qt_assert("lineEdit",__FILE__,677) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 285 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 286 | } | - | ||||||||||||||||||||||||||||||||||||
| 287 | delete d->edit; | - | ||||||||||||||||||||||||||||||||||||
| 288 | d->edit = lineEdit; | - | ||||||||||||||||||||||||||||||||||||
| 289 | if (!d->edit->validator()
| 0 | ||||||||||||||||||||||||||||||||||||
| 290 | d->edit->setValidator(d->validator); never executed: d->edit->setValidator(d->validator); | 0 | ||||||||||||||||||||||||||||||||||||
| 291 | - | |||||||||||||||||||||||||||||||||||||
| 292 | if (d->edit->parent() != this
| 0 | ||||||||||||||||||||||||||||||||||||
| 293 | d->edit->setParent(this); never executed: d->edit->setParent(this); | 0 | ||||||||||||||||||||||||||||||||||||
| 294 | - | |||||||||||||||||||||||||||||||||||||
| 295 | d->edit->setFrame(false); | - | ||||||||||||||||||||||||||||||||||||
| 296 | d->edit->setFocusProxy(this); | - | ||||||||||||||||||||||||||||||||||||
| 297 | d->edit->setAcceptDrops(false); | - | ||||||||||||||||||||||||||||||||||||
| 298 | - | |||||||||||||||||||||||||||||||||||||
| 299 | if (d->type != QVariant::Invalid
| 0 | ||||||||||||||||||||||||||||||||||||
| 300 | connect(d->edit, qFlagLocation("2""textChanged(QString)" "\0" __FILE__ ":" "693"), | - | ||||||||||||||||||||||||||||||||||||
| 301 | this, qFlagLocation("1""_q_editorTextChanged(QString)" "\0" __FILE__ ":" "694")); | - | ||||||||||||||||||||||||||||||||||||
| 302 | connect(d->edit, qFlagLocation("2""cursorPositionChanged(int,int)" "\0" __FILE__ ":" "695"), | - | ||||||||||||||||||||||||||||||||||||
| 303 | this, qFlagLocation("1""_q_editorCursorPositionChanged(int,int)" "\0" __FILE__ ":" "696")); | - | ||||||||||||||||||||||||||||||||||||
| 304 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 305 | d->updateEditFieldGeometry(); | - | ||||||||||||||||||||||||||||||||||||
| 306 | d->edit->setContextMenuPolicy(Qt::NoContextMenu); | - | ||||||||||||||||||||||||||||||||||||
| 307 | d->edit->d_func()->control->setAccessibleObject(this); | - | ||||||||||||||||||||||||||||||||||||
| 308 | - | |||||||||||||||||||||||||||||||||||||
| 309 | if (isVisible()
| 0 | ||||||||||||||||||||||||||||||||||||
| 310 | d->edit->show(); never executed: d->edit->show(); | 0 | ||||||||||||||||||||||||||||||||||||
| 311 | if (isVisible()
| 0 | ||||||||||||||||||||||||||||||||||||
| 312 | d->updateEdit(); never executed: d->updateEdit(); | 0 | ||||||||||||||||||||||||||||||||||||
| 313 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 314 | - | |||||||||||||||||||||||||||||||||||||
| 315 | - | |||||||||||||||||||||||||||||||||||||
| 316 | - | |||||||||||||||||||||||||||||||||||||
| 317 | - | |||||||||||||||||||||||||||||||||||||
| 318 | - | |||||||||||||||||||||||||||||||||||||
| 319 | - | |||||||||||||||||||||||||||||||||||||
| 320 | - | |||||||||||||||||||||||||||||||||||||
| 321 | void QAbstractSpinBox::interpretText() | - | ||||||||||||||||||||||||||||||||||||
| 322 | { | - | ||||||||||||||||||||||||||||||||||||
| 323 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 324 | d->interpret(EmitIfChanged); | - | ||||||||||||||||||||||||||||||||||||
| 325 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 326 | - | |||||||||||||||||||||||||||||||||||||
| 327 | - | |||||||||||||||||||||||||||||||||||||
| 328 | - | |||||||||||||||||||||||||||||||||||||
| 329 | - | |||||||||||||||||||||||||||||||||||||
| 330 | - | |||||||||||||||||||||||||||||||||||||
| 331 | - | |||||||||||||||||||||||||||||||||||||
| 332 | - | |||||||||||||||||||||||||||||||||||||
| 333 | QVariant QAbstractSpinBox::inputMethodQuery(Qt::InputMethodQuery query) const | - | ||||||||||||||||||||||||||||||||||||
| 334 | { | - | ||||||||||||||||||||||||||||||||||||
| 335 | const QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 336 | const QVariant lineEditValue = d->edit->inputMethodQuery(query); | - | ||||||||||||||||||||||||||||||||||||
| 337 | switch (query) { | - | ||||||||||||||||||||||||||||||||||||
| 338 | case never executed: Qt::ImHints:case Qt::ImHints:never executed: case Qt::ImHints: | 0 | ||||||||||||||||||||||||||||||||||||
| 339 | if (const
| 0 | ||||||||||||||||||||||||||||||||||||
| 340 | return never executed: QVariant(hints | lineEditValue.toInt());return QVariant(hints | lineEditValue.toInt());never executed: return QVariant(hints | lineEditValue.toInt()); | 0 | ||||||||||||||||||||||||||||||||||||
| 341 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 342 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 343 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 344 | } | - | ||||||||||||||||||||||||||||||||||||
| 345 | return never executed: lineEditValue;return lineEditValue;never executed: return lineEditValue; | 0 | ||||||||||||||||||||||||||||||||||||
| 346 | } | - | ||||||||||||||||||||||||||||||||||||
| 347 | - | |||||||||||||||||||||||||||||||||||||
| 348 | - | |||||||||||||||||||||||||||||||||||||
| 349 | - | |||||||||||||||||||||||||||||||||||||
| 350 | - | |||||||||||||||||||||||||||||||||||||
| 351 | - | |||||||||||||||||||||||||||||||||||||
| 352 | bool QAbstractSpinBox::event(QEvent *event) | - | ||||||||||||||||||||||||||||||||||||
| 353 | { | - | ||||||||||||||||||||||||||||||||||||
| 354 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 355 | switch (event->type()) { | - | ||||||||||||||||||||||||||||||||||||
| 356 | case never executed: QEvent::FontChange:case QEvent::FontChange:never executed: case QEvent::FontChange: | 0 | ||||||||||||||||||||||||||||||||||||
| 357 | case never executed: QEvent::StyleChange:case QEvent::StyleChange:never executed: case QEvent::StyleChange: | 0 | ||||||||||||||||||||||||||||||||||||
| 358 | d->cachedSizeHint = d->cachedMinimumSizeHint = QSize(); | - | ||||||||||||||||||||||||||||||||||||
| 359 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 360 | case never executed: QEvent::ApplicationLayoutDirectionChange:case QEvent::ApplicationLayoutDirectionChange:never executed: case QEvent::ApplicationLayoutDirectionChange: | 0 | ||||||||||||||||||||||||||||||||||||
| 361 | case never executed: QEvent::LayoutDirectionChange:case QEvent::LayoutDirectionChange:never executed: case QEvent::LayoutDirectionChange: | 0 | ||||||||||||||||||||||||||||||||||||
| 362 | d->updateEditFieldGeometry(); | - | ||||||||||||||||||||||||||||||||||||
| 363 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 364 | case never executed: QEvent::HoverEnter:case QEvent::HoverEnter:never executed: case QEvent::HoverEnter: | 0 | ||||||||||||||||||||||||||||||||||||
| 365 | case never executed: QEvent::HoverLeave:case QEvent::HoverLeave:never executed: case QEvent::HoverLeave: | 0 | ||||||||||||||||||||||||||||||||||||
| 366 | case never executed: QEvent::HoverMove:case QEvent::HoverMove:never executed: case QEvent::HoverMove: | 0 | ||||||||||||||||||||||||||||||||||||
| 367 | d->updateHoverControl(static_cast<const QHoverEvent *>(event)->pos()); | - | ||||||||||||||||||||||||||||||||||||
| 368 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 369 | case never executed: QEvent::ShortcutOverride:case QEvent::ShortcutOverride:never executed: case QEvent::ShortcutOverride: | 0 | ||||||||||||||||||||||||||||||||||||
| 370 | if (d->edit->event(event)
| 0 | ||||||||||||||||||||||||||||||||||||
| 371 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 372 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 373 | case never executed: QEvent::InputMethod:case QEvent::InputMethod:never executed: case QEvent::InputMethod: | 0 | ||||||||||||||||||||||||||||||||||||
| 374 | return never executed: d->edit->event(event);return d->edit->event(event);never executed: return d->edit->event(event); | 0 | ||||||||||||||||||||||||||||||||||||
| 375 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 376 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 377 | } | - | ||||||||||||||||||||||||||||||||||||
| 378 | return never executed: QWidget::event(event);return QWidget::event(event);never executed: return QWidget::event(event); | 0 | ||||||||||||||||||||||||||||||||||||
| 379 | } | - | ||||||||||||||||||||||||||||||||||||
| 380 | - | |||||||||||||||||||||||||||||||||||||
| 381 | - | |||||||||||||||||||||||||||||||||||||
| 382 | - | |||||||||||||||||||||||||||||||||||||
| 383 | - | |||||||||||||||||||||||||||||||||||||
| 384 | - | |||||||||||||||||||||||||||||||||||||
| 385 | void QAbstractSpinBox::showEvent(QShowEvent *) | - | ||||||||||||||||||||||||||||||||||||
| 386 | { | - | ||||||||||||||||||||||||||||||||||||
| 387 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 388 | d->reset(); | - | ||||||||||||||||||||||||||||||||||||
| 389 | - | |||||||||||||||||||||||||||||||||||||
| 390 | if (d->ignoreUpdateEdit
| 0 | ||||||||||||||||||||||||||||||||||||
| 391 | d->ignoreUpdateEdit = false; | - | ||||||||||||||||||||||||||||||||||||
| 392 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 393 | d->updateEdit(); | - | ||||||||||||||||||||||||||||||||||||
| 394 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 395 | } | - | ||||||||||||||||||||||||||||||||||||
| 396 | - | |||||||||||||||||||||||||||||||||||||
| 397 | - | |||||||||||||||||||||||||||||||||||||
| 398 | - | |||||||||||||||||||||||||||||||||||||
| 399 | - | |||||||||||||||||||||||||||||||||||||
| 400 | - | |||||||||||||||||||||||||||||||||||||
| 401 | void QAbstractSpinBox::changeEvent(QEvent *event) | - | ||||||||||||||||||||||||||||||||||||
| 402 | { | - | ||||||||||||||||||||||||||||||||||||
| 403 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 404 | - | |||||||||||||||||||||||||||||||||||||
| 405 | switch (event->type()) { | - | ||||||||||||||||||||||||||||||||||||
| 406 | case never executed: QEvent::StyleChange:case QEvent::StyleChange:never executed: case QEvent::StyleChange: | 0 | ||||||||||||||||||||||||||||||||||||
| 407 | d->spinClickTimerInterval = style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatRate, 0, this); | - | ||||||||||||||||||||||||||||||||||||
| 408 | d->spinClickThresholdTimerInterval = | - | ||||||||||||||||||||||||||||||||||||
| 409 | style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatThreshold, 0, this); | - | ||||||||||||||||||||||||||||||||||||
| 410 | d->reset(); | - | ||||||||||||||||||||||||||||||||||||
| 411 | d->updateEditFieldGeometry(); | - | ||||||||||||||||||||||||||||||||||||
| 412 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 413 | case never executed: QEvent::EnabledChange:case QEvent::EnabledChange:never executed: case QEvent::EnabledChange: | 0 | ||||||||||||||||||||||||||||||||||||
| 414 | if (!isEnabled()
| 0 | ||||||||||||||||||||||||||||||||||||
| 415 | d->reset(); | - | ||||||||||||||||||||||||||||||||||||
| 416 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 417 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 418 | case never executed: QEvent::ActivationChange:case QEvent::ActivationChange:never executed: case QEvent::ActivationChange: | 0 | ||||||||||||||||||||||||||||||||||||
| 419 | if (!isActiveWindow()
| 0 | ||||||||||||||||||||||||||||||||||||
| 420 | d->reset(); | - | ||||||||||||||||||||||||||||||||||||
| 421 | if (d->pendingEmit
| 0 | ||||||||||||||||||||||||||||||||||||
| 422 | d->interpret(EmitIfChanged); never executed: d->interpret(EmitIfChanged); | 0 | ||||||||||||||||||||||||||||||||||||
| 423 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 424 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 425 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 426 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 427 | } | - | ||||||||||||||||||||||||||||||||||||
| 428 | QWidget::changeEvent(event); | - | ||||||||||||||||||||||||||||||||||||
| 429 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 430 | - | |||||||||||||||||||||||||||||||||||||
| 431 | - | |||||||||||||||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||||||||||||||
| 433 | - | |||||||||||||||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||||||||||||||
| 435 | void QAbstractSpinBox::resizeEvent(QResizeEvent *event) | - | ||||||||||||||||||||||||||||||||||||
| 436 | { | - | ||||||||||||||||||||||||||||||||||||
| 437 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 438 | QWidget::resizeEvent(event); | - | ||||||||||||||||||||||||||||||||||||
| 439 | - | |||||||||||||||||||||||||||||||||||||
| 440 | d->updateEditFieldGeometry(); | - | ||||||||||||||||||||||||||||||||||||
| 441 | update(); | - | ||||||||||||||||||||||||||||||||||||
| 442 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 443 | - | |||||||||||||||||||||||||||||||||||||
| 444 | - | |||||||||||||||||||||||||||||||||||||
| 445 | - | |||||||||||||||||||||||||||||||||||||
| 446 | - | |||||||||||||||||||||||||||||||||||||
| 447 | - | |||||||||||||||||||||||||||||||||||||
| 448 | QSize QAbstractSpinBox::sizeHint() const | - | ||||||||||||||||||||||||||||||||||||
| 449 | { | - | ||||||||||||||||||||||||||||||||||||
| 450 | const QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 451 | if (d->cachedSizeHint.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 452 | ensurePolished(); | - | ||||||||||||||||||||||||||||||||||||
| 453 | - | |||||||||||||||||||||||||||||||||||||
| 454 | const QFontMetrics fm(fontMetrics()); | - | ||||||||||||||||||||||||||||||||||||
| 455 | int h = d->edit->sizeHint().height(); | - | ||||||||||||||||||||||||||||||||||||
| 456 | int w = 0; | - | ||||||||||||||||||||||||||||||||||||
| 457 | QString s; | - | ||||||||||||||||||||||||||||||||||||
| 458 | QString fixedContent = d->prefix + d->suffix + QLatin1Char(' '); | - | ||||||||||||||||||||||||||||||||||||
| 459 | s = d->textFromValue(d->minimum); | - | ||||||||||||||||||||||||||||||||||||
| 460 | s.truncate(18); | - | ||||||||||||||||||||||||||||||||||||
| 461 | s += fixedContent; | - | ||||||||||||||||||||||||||||||||||||
| 462 | w = qMax(w, fm.width(s)); | - | ||||||||||||||||||||||||||||||||||||
| 463 | s = d->textFromValue(d->maximum); | - | ||||||||||||||||||||||||||||||||||||
| 464 | s.truncate(18); | - | ||||||||||||||||||||||||||||||||||||
| 465 | s += fixedContent; | - | ||||||||||||||||||||||||||||||||||||
| 466 | w = qMax(w, fm.width(s)); | - | ||||||||||||||||||||||||||||||||||||
| 467 | - | |||||||||||||||||||||||||||||||||||||
| 468 | if (d->specialValueText.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 469 | s = d->specialValueText; | - | ||||||||||||||||||||||||||||||||||||
| 470 | w = qMax(w, fm.width(s)); | - | ||||||||||||||||||||||||||||||||||||
| 471 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 472 | w += 2; | - | ||||||||||||||||||||||||||||||||||||
| 473 | - | |||||||||||||||||||||||||||||||||||||
| 474 | QStyleOptionSpinBox opt; | - | ||||||||||||||||||||||||||||||||||||
| 475 | initStyleOption(&opt); | - | ||||||||||||||||||||||||||||||||||||
| 476 | QSize hint(w, h); | - | ||||||||||||||||||||||||||||||||||||
| 477 | d->cachedSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this) | - | ||||||||||||||||||||||||||||||||||||
| 478 | .expandedTo(QApplication::globalStrut()); | - | ||||||||||||||||||||||||||||||||||||
| 479 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 480 | return never executed: d->cachedSizeHint;return d->cachedSizeHint;never executed: return d->cachedSizeHint; | 0 | ||||||||||||||||||||||||||||||||||||
| 481 | } | - | ||||||||||||||||||||||||||||||||||||
| 482 | - | |||||||||||||||||||||||||||||||||||||
| 483 | - | |||||||||||||||||||||||||||||||||||||
| 484 | - | |||||||||||||||||||||||||||||||||||||
| 485 | - | |||||||||||||||||||||||||||||||||||||
| 486 | - | |||||||||||||||||||||||||||||||||||||
| 487 | QSize QAbstractSpinBox::minimumSizeHint() const | - | ||||||||||||||||||||||||||||||||||||
| 488 | { | - | ||||||||||||||||||||||||||||||||||||
| 489 | const QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 490 | if (d->cachedMinimumSizeHint.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 491 | - | |||||||||||||||||||||||||||||||||||||
| 492 | ensurePolished(); | - | ||||||||||||||||||||||||||||||||||||
| 493 | - | |||||||||||||||||||||||||||||||||||||
| 494 | const QFontMetrics fm(fontMetrics()); | - | ||||||||||||||||||||||||||||||||||||
| 495 | int h = d->edit->minimumSizeHint().height(); | - | ||||||||||||||||||||||||||||||||||||
| 496 | int w = 0; | - | ||||||||||||||||||||||||||||||||||||
| 497 | - | |||||||||||||||||||||||||||||||||||||
| 498 | QString s; | - | ||||||||||||||||||||||||||||||||||||
| 499 | QString fixedContent = d->prefix + QLatin1Char(' '); | - | ||||||||||||||||||||||||||||||||||||
| 500 | s = d->textFromValue(d->minimum); | - | ||||||||||||||||||||||||||||||||||||
| 501 | s.truncate(18); | - | ||||||||||||||||||||||||||||||||||||
| 502 | s += fixedContent; | - | ||||||||||||||||||||||||||||||||||||
| 503 | w = qMax(w, fm.width(s)); | - | ||||||||||||||||||||||||||||||||||||
| 504 | s = d->textFromValue(d->maximum); | - | ||||||||||||||||||||||||||||||||||||
| 505 | s.truncate(18); | - | ||||||||||||||||||||||||||||||||||||
| 506 | s += fixedContent; | - | ||||||||||||||||||||||||||||||||||||
| 507 | w = qMax(w, fm.width(s)); | - | ||||||||||||||||||||||||||||||||||||
| 508 | - | |||||||||||||||||||||||||||||||||||||
| 509 | if (d->specialValueText.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 510 | s = d->specialValueText; | - | ||||||||||||||||||||||||||||||||||||
| 511 | w = qMax(w, fm.width(s)); | - | ||||||||||||||||||||||||||||||||||||
| 512 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 513 | w += 2; | - | ||||||||||||||||||||||||||||||||||||
| 514 | - | |||||||||||||||||||||||||||||||||||||
| 515 | QStyleOptionSpinBox opt; | - | ||||||||||||||||||||||||||||||||||||
| 516 | initStyleOption(&opt); | - | ||||||||||||||||||||||||||||||||||||
| 517 | QSize hint(w, h); | - | ||||||||||||||||||||||||||||||||||||
| 518 | - | |||||||||||||||||||||||||||||||||||||
| 519 | d->cachedMinimumSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this) | - | ||||||||||||||||||||||||||||||||||||
| 520 | .expandedTo(QApplication::globalStrut()); | - | ||||||||||||||||||||||||||||||||||||
| 521 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 522 | return never executed: d->cachedMinimumSizeHint;return d->cachedMinimumSizeHint;never executed: return d->cachedMinimumSizeHint; | 0 | ||||||||||||||||||||||||||||||||||||
| 523 | } | - | ||||||||||||||||||||||||||||||||||||
| 524 | - | |||||||||||||||||||||||||||||||||||||
| 525 | - | |||||||||||||||||||||||||||||||||||||
| 526 | - | |||||||||||||||||||||||||||||||||||||
| 527 | - | |||||||||||||||||||||||||||||||||||||
| 528 | - | |||||||||||||||||||||||||||||||||||||
| 529 | void QAbstractSpinBox::paintEvent(QPaintEvent *) | - | ||||||||||||||||||||||||||||||||||||
| 530 | { | - | ||||||||||||||||||||||||||||||||||||
| 531 | QStyleOptionSpinBox opt; | - | ||||||||||||||||||||||||||||||||||||
| 532 | initStyleOption(&opt); | - | ||||||||||||||||||||||||||||||||||||
| 533 | QStylePainter p(this); | - | ||||||||||||||||||||||||||||||||||||
| 534 | p.drawComplexControl(QStyle::CC_SpinBox, opt); | - | ||||||||||||||||||||||||||||||||||||
| 535 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 536 | void QAbstractSpinBox::keyPressEvent(QKeyEvent *event) | - | ||||||||||||||||||||||||||||||||||||
| 537 | { | - | ||||||||||||||||||||||||||||||||||||
| 538 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 539 | - | |||||||||||||||||||||||||||||||||||||
| 540 | if (!event->text().isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 541 | d->edit->setCursorPosition(d->prefix.size()); never executed: d->edit->setCursorPosition(d->prefix.size()); | 0 | ||||||||||||||||||||||||||||||||||||
| 542 | - | |||||||||||||||||||||||||||||||||||||
| 543 | int steps = 1; | - | ||||||||||||||||||||||||||||||||||||
| 544 | bool isPgUpOrDown = false; | - | ||||||||||||||||||||||||||||||||||||
| 545 | switch (event->key()) { | - | ||||||||||||||||||||||||||||||||||||
| 546 | case never executed: Qt::Key_PageUp:case Qt::Key_PageUp:never executed: case Qt::Key_PageUp: | 0 | ||||||||||||||||||||||||||||||||||||
| 547 | case never executed: Qt::Key_PageDown:case Qt::Key_PageDown:never executed: case Qt::Key_PageDown: | 0 | ||||||||||||||||||||||||||||||||||||
| 548 | steps *= 10; | - | ||||||||||||||||||||||||||||||||||||
| 549 | isPgUpOrDown = true; | - | ||||||||||||||||||||||||||||||||||||
| 550 | case never executed: Qt::Key_Up:case Qt::Key_Up:never executed: case Qt::Key_Up:code before this statement never executed: case Qt::Key_Up: | 0 | ||||||||||||||||||||||||||||||||||||
| 551 | case never executed: Qt::Key_Down:case Qt::Key_Down:never executed: {case Qt::Key_Down: | 0 | ||||||||||||||||||||||||||||||||||||
| 552 | event->accept(); | - | ||||||||||||||||||||||||||||||||||||
| 553 | const bool up = (event->key() == Qt::Key_PageUp
| 0 | ||||||||||||||||||||||||||||||||||||
| 554 | if (!(stepEnabled() & (up ? StepUpEnabled : StepDownEnabled))
| 0 | ||||||||||||||||||||||||||||||||||||
| 555 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 556 | if (!up
| 0 | ||||||||||||||||||||||||||||||||||||
| 557 | steps *= -1; never executed: steps *= -1; | 0 | ||||||||||||||||||||||||||||||||||||
| 558 | if (style()->styleHint(QStyle::SH_SpinBox_AnimateButton, 0, this)
| 0 | ||||||||||||||||||||||||||||||||||||
| 559 | d->buttonState = (Keyboard | (up ? Up : Down)); | - | ||||||||||||||||||||||||||||||||||||
| 560 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 561 | if (d->spinClickTimerId == -1
| 0 | ||||||||||||||||||||||||||||||||||||
| 562 | stepBy(steps); never executed: stepBy(steps); | 0 | ||||||||||||||||||||||||||||||||||||
| 563 | if(event->isAutoRepeat()
| 0 | ||||||||||||||||||||||||||||||||||||
| 564 | if(d->spinClickThresholdTimerId == -1
| 0 | ||||||||||||||||||||||||||||||||||||
| 565 | d->updateState(up, true); | - | ||||||||||||||||||||||||||||||||||||
| 566 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 567 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 568 | - | |||||||||||||||||||||||||||||||||||||
| 569 | QAccessibleValueChangeEvent event(this, d->value); | - | ||||||||||||||||||||||||||||||||||||
| 570 | QAccessible::updateAccessibility(&event); | - | ||||||||||||||||||||||||||||||||||||
| 571 | - | |||||||||||||||||||||||||||||||||||||
| 572 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 573 | } | - | ||||||||||||||||||||||||||||||||||||
| 574 | case never executed: Qt::Key_Enter:case Qt::Key_Enter:never executed: case Qt::Key_Enter: | 0 | ||||||||||||||||||||||||||||||||||||
| 575 | case never executed: Qt::Key_Return:case Qt::Key_Return:never executed: case Qt::Key_Return: | 0 | ||||||||||||||||||||||||||||||||||||
| 576 | d->edit->d_func()->control->clearUndo(); | - | ||||||||||||||||||||||||||||||||||||
| 577 | d->interpret(d->keyboardTracking ? AlwaysEmit : EmitIfChanged); | - | ||||||||||||||||||||||||||||||||||||
| 578 | selectAll(); | - | ||||||||||||||||||||||||||||||||||||
| 579 | event->ignore(); | - | ||||||||||||||||||||||||||||||||||||
| 580 | editingFinished(); | - | ||||||||||||||||||||||||||||||||||||
| 581 | d->edit->returnPressed(); | - | ||||||||||||||||||||||||||||||||||||
| 582 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 583 | case never executed: Qt::Key_U:case Qt::Key_U:never executed: case Qt::Key_U: | 0 | ||||||||||||||||||||||||||||||||||||
| 584 | if (event->modifiers() & Qt::ControlModifier
| 0 | ||||||||||||||||||||||||||||||||||||
| 585 | && QGuiApplication::platformName() == QLatin1String("xcb")
| 0 | ||||||||||||||||||||||||||||||||||||
| 586 | event->accept(); | - | ||||||||||||||||||||||||||||||||||||
| 587 | if (!isReadOnly()
| 0 | ||||||||||||||||||||||||||||||||||||
| 588 | clear(); never executed: clear(); | 0 | ||||||||||||||||||||||||||||||||||||
| 589 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 590 | } | - | ||||||||||||||||||||||||||||||||||||
| 591 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 592 | - | |||||||||||||||||||||||||||||||||||||
| 593 | case never executed: Qt::Key_End:case Qt::Key_End:never executed: case Qt::Key_End: | 0 | ||||||||||||||||||||||||||||||||||||
| 594 | case never executed: Qt::Key_Home:case Qt::Key_Home:never executed: case Qt::Key_Home: | 0 | ||||||||||||||||||||||||||||||||||||
| 595 | if (event->modifiers() & Qt::ShiftModifier
| 0 | ||||||||||||||||||||||||||||||||||||
| 596 | int currentPos = d->edit->cursorPosition(); | - | ||||||||||||||||||||||||||||||||||||
| 597 | const QString text = d->edit->displayText(); | - | ||||||||||||||||||||||||||||||||||||
| 598 | if (event->key() == Qt::Key_End
| 0 | ||||||||||||||||||||||||||||||||||||
| 599 | if ((currentPos == 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 600 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 601 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 602 | d->edit->setSelection(currentPos, text.size() - d->suffix.size() - currentPos); | - | ||||||||||||||||||||||||||||||||||||
| 603 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 604 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 605 | if ((currentPos == text.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 606 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 607 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 608 | d->edit->setSelection(currentPos, d->prefix.size() - currentPos); | - | ||||||||||||||||||||||||||||||||||||
| 609 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 610 | } | - | ||||||||||||||||||||||||||||||||||||
| 611 | event->accept(); | - | ||||||||||||||||||||||||||||||||||||
| 612 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 613 | } | - | ||||||||||||||||||||||||||||||||||||
| 614 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 615 | - | |||||||||||||||||||||||||||||||||||||
| 616 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 617 | - | |||||||||||||||||||||||||||||||||||||
| 618 | if (event == QKeySequence::SelectAll
| 0 | ||||||||||||||||||||||||||||||||||||
| 619 | selectAll(); | - | ||||||||||||||||||||||||||||||||||||
| 620 | event->accept(); | - | ||||||||||||||||||||||||||||||||||||
| 621 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 622 | } | - | ||||||||||||||||||||||||||||||||||||
| 623 | - | |||||||||||||||||||||||||||||||||||||
| 624 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 625 | } | - | ||||||||||||||||||||||||||||||||||||
| 626 | - | |||||||||||||||||||||||||||||||||||||
| 627 | d->edit->event(event); | - | ||||||||||||||||||||||||||||||||||||
| 628 | if (!d->edit->text().isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 629 | d->cleared = false; never executed: d->cleared = false; | 0 | ||||||||||||||||||||||||||||||||||||
| 630 | if (!isVisible()
| 0 | ||||||||||||||||||||||||||||||||||||
| 631 | d->ignoreUpdateEdit = true; never executed: d->ignoreUpdateEdit = true; | 0 | ||||||||||||||||||||||||||||||||||||
| 632 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 633 | - | |||||||||||||||||||||||||||||||||||||
| 634 | - | |||||||||||||||||||||||||||||||||||||
| 635 | - | |||||||||||||||||||||||||||||||||||||
| 636 | - | |||||||||||||||||||||||||||||||||||||
| 637 | - | |||||||||||||||||||||||||||||||||||||
| 638 | void QAbstractSpinBox::keyReleaseEvent(QKeyEvent *event) | - | ||||||||||||||||||||||||||||||||||||
| 639 | { | - | ||||||||||||||||||||||||||||||||||||
| 640 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 641 | - | |||||||||||||||||||||||||||||||||||||
| 642 | if (d->buttonState & Keyboard
| 0 | ||||||||||||||||||||||||||||||||||||
| 643 | d->reset(); | - | ||||||||||||||||||||||||||||||||||||
| 644 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 645 | d->edit->event(event); | - | ||||||||||||||||||||||||||||||||||||
| 646 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 647 | } | - | ||||||||||||||||||||||||||||||||||||
| 648 | - | |||||||||||||||||||||||||||||||||||||
| 649 | - | |||||||||||||||||||||||||||||||||||||
| 650 | - | |||||||||||||||||||||||||||||||||||||
| 651 | - | |||||||||||||||||||||||||||||||||||||
| 652 | - | |||||||||||||||||||||||||||||||||||||
| 653 | - | |||||||||||||||||||||||||||||||||||||
| 654 | void QAbstractSpinBox::wheelEvent(QWheelEvent *event) | - | ||||||||||||||||||||||||||||||||||||
| 655 | { | - | ||||||||||||||||||||||||||||||||||||
| 656 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 657 | d->wheelDeltaRemainder += event->angleDelta().y(); | - | ||||||||||||||||||||||||||||||||||||
| 658 | const int steps = d->wheelDeltaRemainder / 120; | - | ||||||||||||||||||||||||||||||||||||
| 659 | d->wheelDeltaRemainder -= steps * 120; | - | ||||||||||||||||||||||||||||||||||||
| 660 | if (stepEnabled() & (steps > 0 ? StepUpEnabled : StepDownEnabled)
| 0 | ||||||||||||||||||||||||||||||||||||
| 661 | stepBy(event->modifiers() & Qt::ControlModifier ? steps * 10 : steps); never executed: stepBy(event->modifiers() & Qt::ControlModifier ? steps * 10 : steps); | 0 | ||||||||||||||||||||||||||||||||||||
| 662 | event->accept(); | - | ||||||||||||||||||||||||||||||||||||
| 663 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 664 | - | |||||||||||||||||||||||||||||||||||||
| 665 | - | |||||||||||||||||||||||||||||||||||||
| 666 | - | |||||||||||||||||||||||||||||||||||||
| 667 | - | |||||||||||||||||||||||||||||||||||||
| 668 | - | |||||||||||||||||||||||||||||||||||||
| 669 | - | |||||||||||||||||||||||||||||||||||||
| 670 | void QAbstractSpinBox::focusInEvent(QFocusEvent *event) | - | ||||||||||||||||||||||||||||||||||||
| 671 | { | - | ||||||||||||||||||||||||||||||||||||
| 672 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 673 | - | |||||||||||||||||||||||||||||||||||||
| 674 | d->edit->event(event); | - | ||||||||||||||||||||||||||||||||||||
| 675 | if (event->reason() == Qt::TabFocusReason
| 0 | ||||||||||||||||||||||||||||||||||||
| 676 | selectAll(); | - | ||||||||||||||||||||||||||||||||||||
| 677 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 678 | QWidget::focusInEvent(event); | - | ||||||||||||||||||||||||||||||||||||
| 679 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 680 | - | |||||||||||||||||||||||||||||||||||||
| 681 | - | |||||||||||||||||||||||||||||||||||||
| 682 | - | |||||||||||||||||||||||||||||||||||||
| 683 | - | |||||||||||||||||||||||||||||||||||||
| 684 | - | |||||||||||||||||||||||||||||||||||||
| 685 | void QAbstractSpinBox::focusOutEvent(QFocusEvent *event) | - | ||||||||||||||||||||||||||||||||||||
| 686 | { | - | ||||||||||||||||||||||||||||||||||||
| 687 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 688 | - | |||||||||||||||||||||||||||||||||||||
| 689 | if (d->pendingEmit
| 0 | ||||||||||||||||||||||||||||||||||||
| 690 | d->interpret(EmitIfChanged); never executed: d->interpret(EmitIfChanged); | 0 | ||||||||||||||||||||||||||||||||||||
| 691 | - | |||||||||||||||||||||||||||||||||||||
| 692 | d->reset(); | - | ||||||||||||||||||||||||||||||||||||
| 693 | d->edit->event(event); | - | ||||||||||||||||||||||||||||||||||||
| 694 | d->updateEdit(); | - | ||||||||||||||||||||||||||||||||||||
| 695 | QWidget::focusOutEvent(event); | - | ||||||||||||||||||||||||||||||||||||
| 696 | - | |||||||||||||||||||||||||||||||||||||
| 697 | - | |||||||||||||||||||||||||||||||||||||
| 698 | - | |||||||||||||||||||||||||||||||||||||
| 699 | - | |||||||||||||||||||||||||||||||||||||
| 700 | - | |||||||||||||||||||||||||||||||||||||
| 701 | editingFinished(); | - | ||||||||||||||||||||||||||||||||||||
| 702 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 703 | - | |||||||||||||||||||||||||||||||||||||
| 704 | - | |||||||||||||||||||||||||||||||||||||
| 705 | - | |||||||||||||||||||||||||||||||||||||
| 706 | - | |||||||||||||||||||||||||||||||||||||
| 707 | - | |||||||||||||||||||||||||||||||||||||
| 708 | void QAbstractSpinBox::closeEvent(QCloseEvent *event) | - | ||||||||||||||||||||||||||||||||||||
| 709 | { | - | ||||||||||||||||||||||||||||||||||||
| 710 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 711 | - | |||||||||||||||||||||||||||||||||||||
| 712 | d->reset(); | - | ||||||||||||||||||||||||||||||||||||
| 713 | if (d->pendingEmit
| 0 | ||||||||||||||||||||||||||||||||||||
| 714 | d->interpret(EmitIfChanged); never executed: d->interpret(EmitIfChanged); | 0 | ||||||||||||||||||||||||||||||||||||
| 715 | QWidget::closeEvent(event); | - | ||||||||||||||||||||||||||||||||||||
| 716 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 717 | - | |||||||||||||||||||||||||||||||||||||
| 718 | - | |||||||||||||||||||||||||||||||||||||
| 719 | - | |||||||||||||||||||||||||||||||||||||
| 720 | - | |||||||||||||||||||||||||||||||||||||
| 721 | - | |||||||||||||||||||||||||||||||||||||
| 722 | void QAbstractSpinBox::hideEvent(QHideEvent *event) | - | ||||||||||||||||||||||||||||||||||||
| 723 | { | - | ||||||||||||||||||||||||||||||||||||
| 724 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 725 | d->reset(); | - | ||||||||||||||||||||||||||||||||||||
| 726 | if (d->pendingEmit
| 0 | ||||||||||||||||||||||||||||||||||||
| 727 | d->interpret(EmitIfChanged); never executed: d->interpret(EmitIfChanged); | 0 | ||||||||||||||||||||||||||||||||||||
| 728 | QWidget::hideEvent(event); | - | ||||||||||||||||||||||||||||||||||||
| 729 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 730 | - | |||||||||||||||||||||||||||||||||||||
| 731 | - | |||||||||||||||||||||||||||||||||||||
| 732 | - | |||||||||||||||||||||||||||||||||||||
| 733 | - | |||||||||||||||||||||||||||||||||||||
| 734 | - | |||||||||||||||||||||||||||||||||||||
| 735 | - | |||||||||||||||||||||||||||||||||||||
| 736 | void QAbstractSpinBox::timerEvent(QTimerEvent *event) | - | ||||||||||||||||||||||||||||||||||||
| 737 | { | - | ||||||||||||||||||||||||||||||||||||
| 738 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 739 | - | |||||||||||||||||||||||||||||||||||||
| 740 | bool doStep = false; | - | ||||||||||||||||||||||||||||||||||||
| 741 | if (event->timerId() == d->spinClickThresholdTimerId
| 0 | ||||||||||||||||||||||||||||||||||||
| 742 | killTimer(d->spinClickThresholdTimerId); | - | ||||||||||||||||||||||||||||||||||||
| 743 | d->spinClickThresholdTimerId = -1; | - | ||||||||||||||||||||||||||||||||||||
| 744 | d->effectiveSpinRepeatRate = d->buttonState & Keyboard
| 0 | ||||||||||||||||||||||||||||||||||||
| 745 | ? QGuiApplication::styleHints()->keyboardAutoRepeatRate() | - | ||||||||||||||||||||||||||||||||||||
| 746 | : d->spinClickTimerInterval; | - | ||||||||||||||||||||||||||||||||||||
| 747 | d->spinClickTimerId = startTimer(d->effectiveSpinRepeatRate); | - | ||||||||||||||||||||||||||||||||||||
| 748 | doStep = true; | - | ||||||||||||||||||||||||||||||||||||
| 749 | } never executed: else if (event->timerId() == d->spinClickTimerIdend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 750 | if (d->accelerate
| 0 | ||||||||||||||||||||||||||||||||||||
| 751 | d->acceleration = d->acceleration + (int)(d->effectiveSpinRepeatRate * 0.05); | - | ||||||||||||||||||||||||||||||||||||
| 752 | if (d->effectiveSpinRepeatRate - d->acceleration >= 10
| 0 | ||||||||||||||||||||||||||||||||||||
| 753 | killTimer(d->spinClickTimerId); | - | ||||||||||||||||||||||||||||||||||||
| 754 | d->spinClickTimerId = startTimer(d->effectiveSpinRepeatRate - d->acceleration); | - | ||||||||||||||||||||||||||||||||||||
| 755 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 756 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 757 | doStep = true; | - | ||||||||||||||||||||||||||||||||||||
| 758 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 759 | - | |||||||||||||||||||||||||||||||||||||
| 760 | if (doStep
| 0 | ||||||||||||||||||||||||||||||||||||
| 761 | const StepEnabled st = stepEnabled(); | - | ||||||||||||||||||||||||||||||||||||
| 762 | if (d->buttonState & Up
| 0 | ||||||||||||||||||||||||||||||||||||
| 763 | if (!(st & StepUpEnabled)
| 0 | ||||||||||||||||||||||||||||||||||||
| 764 | d->reset(); | - | ||||||||||||||||||||||||||||||||||||
| 765 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 766 | stepBy(1); | - | ||||||||||||||||||||||||||||||||||||
| 767 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 768 | } else if (d->buttonState & Down
| 0 | ||||||||||||||||||||||||||||||||||||
| 769 | if (!(st & StepDownEnabled)
| 0 | ||||||||||||||||||||||||||||||||||||
| 770 | d->reset(); | - | ||||||||||||||||||||||||||||||||||||
| 771 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 772 | stepBy(-1); | - | ||||||||||||||||||||||||||||||||||||
| 773 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 774 | } | - | ||||||||||||||||||||||||||||||||||||
| 775 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 776 | } | - | ||||||||||||||||||||||||||||||||||||
| 777 | QWidget::timerEvent(event); | - | ||||||||||||||||||||||||||||||||||||
| 778 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 779 | } | - | ||||||||||||||||||||||||||||||||||||
| 780 | - | |||||||||||||||||||||||||||||||||||||
| 781 | - | |||||||||||||||||||||||||||||||||||||
| 782 | - | |||||||||||||||||||||||||||||||||||||
| 783 | - | |||||||||||||||||||||||||||||||||||||
| 784 | - | |||||||||||||||||||||||||||||||||||||
| 785 | void QAbstractSpinBox::contextMenuEvent(QContextMenuEvent *event) | - | ||||||||||||||||||||||||||||||||||||
| 786 | { | - | ||||||||||||||||||||||||||||||||||||
| 787 | - | |||||||||||||||||||||||||||||||||||||
| 788 | - | |||||||||||||||||||||||||||||||||||||
| 789 | - | |||||||||||||||||||||||||||||||||||||
| 790 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 791 | - | |||||||||||||||||||||||||||||||||||||
| 792 | QPointer<QMenu> menu = d->edit->createStandardContextMenu(); | - | ||||||||||||||||||||||||||||||||||||
| 793 | if (!menu
| 0 | ||||||||||||||||||||||||||||||||||||
| 794 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 795 | - | |||||||||||||||||||||||||||||||||||||
| 796 | d->reset(); | - | ||||||||||||||||||||||||||||||||||||
| 797 | - | |||||||||||||||||||||||||||||||||||||
| 798 | QAction *selAll = new QAction(tr("&Select All"), menu); | - | ||||||||||||||||||||||||||||||||||||
| 799 | menu->insertAction(d->edit->d_func()->selectAllAction, | - | ||||||||||||||||||||||||||||||||||||
| 800 | selAll); | - | ||||||||||||||||||||||||||||||||||||
| 801 | menu->removeAction(d->edit->d_func()->selectAllAction); | - | ||||||||||||||||||||||||||||||||||||
| 802 | menu->addSeparator(); | - | ||||||||||||||||||||||||||||||||||||
| 803 | const uint se = stepEnabled(); | - | ||||||||||||||||||||||||||||||||||||
| 804 | QAction *up = menu->addAction(tr("&Step up")); | - | ||||||||||||||||||||||||||||||||||||
| 805 | up->setEnabled(se & StepUpEnabled); | - | ||||||||||||||||||||||||||||||||||||
| 806 | QAction *down = menu->addAction(tr("Step &down")); | - | ||||||||||||||||||||||||||||||||||||
| 807 | down->setEnabled(se & StepDownEnabled); | - | ||||||||||||||||||||||||||||||||||||
| 808 | menu->addSeparator(); | - | ||||||||||||||||||||||||||||||||||||
| 809 | - | |||||||||||||||||||||||||||||||||||||
| 810 | const QPointer<QAbstractSpinBox> that = this; | - | ||||||||||||||||||||||||||||||||||||
| 811 | const QPoint pos = (
| 0 | ||||||||||||||||||||||||||||||||||||
| 812 | ? event->globalPos() : mapToGlobal(QPoint(event->pos().x(), 0)) + QPoint(width() / 2, height() / 2); | - | ||||||||||||||||||||||||||||||||||||
| 813 | const QAction *action = menu->exec(pos); | - | ||||||||||||||||||||||||||||||||||||
| 814 | delete static_cast<QMenu *>(menu); | - | ||||||||||||||||||||||||||||||||||||
| 815 | if (that
| 0 | ||||||||||||||||||||||||||||||||||||
| 816 | if (action == up
| 0 | ||||||||||||||||||||||||||||||||||||
| 817 | stepBy(1); | - | ||||||||||||||||||||||||||||||||||||
| 818 | } never executed: else if (action == downend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 819 | stepBy(-1); | - | ||||||||||||||||||||||||||||||||||||
| 820 | } never executed: else if (action == selAllend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 821 | selectAll(); | - | ||||||||||||||||||||||||||||||||||||
| 822 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 823 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 824 | event->accept(); | - | ||||||||||||||||||||||||||||||||||||
| 825 | - | |||||||||||||||||||||||||||||||||||||
| 826 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 827 | - | |||||||||||||||||||||||||||||||||||||
| 828 | - | |||||||||||||||||||||||||||||||||||||
| 829 | - | |||||||||||||||||||||||||||||||||||||
| 830 | - | |||||||||||||||||||||||||||||||||||||
| 831 | - | |||||||||||||||||||||||||||||||||||||
| 832 | void QAbstractSpinBox::mouseMoveEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||||||||||||||
| 833 | { | - | ||||||||||||||||||||||||||||||||||||
| 834 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 835 | - | |||||||||||||||||||||||||||||||||||||
| 836 | d->updateHoverControl(event->pos()); | - | ||||||||||||||||||||||||||||||||||||
| 837 | - | |||||||||||||||||||||||||||||||||||||
| 838 | - | |||||||||||||||||||||||||||||||||||||
| 839 | if (d->spinClickTimerId != -1
| 0 | ||||||||||||||||||||||||||||||||||||
| 840 | const StepEnabled se = stepEnabled(); | - | ||||||||||||||||||||||||||||||||||||
| 841 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||
| 842 | d->updateState(true); never executed: d->updateState(true); | 0 | ||||||||||||||||||||||||||||||||||||
| 843 | else if ((
| 0 | ||||||||||||||||||||||||||||||||||||
| 844 | d->updateState(false); never executed: d->updateState(false); | 0 | ||||||||||||||||||||||||||||||||||||
| 845 | else | - | ||||||||||||||||||||||||||||||||||||
| 846 | d->reset(); never executed: d->reset(); | 0 | ||||||||||||||||||||||||||||||||||||
| 847 | event->accept(); | - | ||||||||||||||||||||||||||||||||||||
| 848 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 849 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 850 | - | |||||||||||||||||||||||||||||||||||||
| 851 | - | |||||||||||||||||||||||||||||||||||||
| 852 | - | |||||||||||||||||||||||||||||||||||||
| 853 | - | |||||||||||||||||||||||||||||||||||||
| 854 | - | |||||||||||||||||||||||||||||||||||||
| 855 | void QAbstractSpinBox::mousePressEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||||||||||||||
| 856 | { | - | ||||||||||||||||||||||||||||||||||||
| 857 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 858 | - | |||||||||||||||||||||||||||||||||||||
| 859 | if (event->button() != Qt::LeftButton
| 0 | ||||||||||||||||||||||||||||||||||||
| 860 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 861 | } | - | ||||||||||||||||||||||||||||||||||||
| 862 | - | |||||||||||||||||||||||||||||||||||||
| 863 | d->updateHoverControl(event->pos()); | - | ||||||||||||||||||||||||||||||||||||
| 864 | event->accept(); | - | ||||||||||||||||||||||||||||||||||||
| 865 | - | |||||||||||||||||||||||||||||||||||||
| 866 | const StepEnabled se = (
| 0 | ||||||||||||||||||||||||||||||||||||
| 867 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||
| 868 | d->updateState(true); | - | ||||||||||||||||||||||||||||||||||||
| 869 | } never executed: else if ((end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 870 | d->updateState(false); | - | ||||||||||||||||||||||||||||||||||||
| 871 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 872 | event->ignore(); | - | ||||||||||||||||||||||||||||||||||||
| 873 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 874 | } | - | ||||||||||||||||||||||||||||||||||||
| 875 | - | |||||||||||||||||||||||||||||||||||||
| 876 | - | |||||||||||||||||||||||||||||||||||||
| 877 | - | |||||||||||||||||||||||||||||||||||||
| 878 | - | |||||||||||||||||||||||||||||||||||||
| 879 | void QAbstractSpinBox::mouseReleaseEvent(QMouseEvent *event) | - | ||||||||||||||||||||||||||||||||||||
| 880 | { | - | ||||||||||||||||||||||||||||||||||||
| 881 | QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 882 | - | |||||||||||||||||||||||||||||||||||||
| 883 | if ((
| 0 | ||||||||||||||||||||||||||||||||||||
| 884 | d->reset(); never executed: d->reset(); | 0 | ||||||||||||||||||||||||||||||||||||
| 885 | event->accept(); | - | ||||||||||||||||||||||||||||||||||||
| 886 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 887 | QAbstractSpinBoxPrivate::QAbstractSpinBoxPrivate() | - | ||||||||||||||||||||||||||||||||||||
| 888 | : edit(0), type(QVariant::Invalid), spinClickTimerId(-1), | - | ||||||||||||||||||||||||||||||||||||
| 889 | spinClickTimerInterval(100), spinClickThresholdTimerId(-1), spinClickThresholdTimerInterval(-1), | - | ||||||||||||||||||||||||||||||||||||
| 890 | effectiveSpinRepeatRate(1), buttonState(None), cachedText(QLatin1String("\x01")), | - | ||||||||||||||||||||||||||||||||||||
| 891 | cachedState(QValidator::Invalid), pendingEmit(false), readOnly(false), wrapping(false), | - | ||||||||||||||||||||||||||||||||||||
| 892 | ignoreCursorPositionChanged(false), frame(true), accelerate(false), keyboardTracking(true), | - | ||||||||||||||||||||||||||||||||||||
| 893 | cleared(false), ignoreUpdateEdit(false), correctionMode(QAbstractSpinBox::CorrectToPreviousValue), | - | ||||||||||||||||||||||||||||||||||||
| 894 | acceleration(0), hoverControl(QStyle::SC_None), buttonSymbols(QAbstractSpinBox::UpDownArrows), validator(0), | - | ||||||||||||||||||||||||||||||||||||
| 895 | showGroupSeparator(0), wheelDeltaRemainder(0) | - | ||||||||||||||||||||||||||||||||||||
| 896 | { | - | ||||||||||||||||||||||||||||||||||||
| 897 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 898 | - | |||||||||||||||||||||||||||||||||||||
| 899 | - | |||||||||||||||||||||||||||||||||||||
| 900 | - | |||||||||||||||||||||||||||||||||||||
| 901 | - | |||||||||||||||||||||||||||||||||||||
| 902 | - | |||||||||||||||||||||||||||||||||||||
| 903 | QAbstractSpinBoxPrivate::~QAbstractSpinBoxPrivate() | - | ||||||||||||||||||||||||||||||||||||
| 904 | { | - | ||||||||||||||||||||||||||||||||||||
| 905 | } | - | ||||||||||||||||||||||||||||||||||||
| 906 | - | |||||||||||||||||||||||||||||||||||||
| 907 | - | |||||||||||||||||||||||||||||||||||||
| 908 | - | |||||||||||||||||||||||||||||||||||||
| 909 | - | |||||||||||||||||||||||||||||||||||||
| 910 | - | |||||||||||||||||||||||||||||||||||||
| 911 | - | |||||||||||||||||||||||||||||||||||||
| 912 | bool QAbstractSpinBoxPrivate::updateHoverControl(const QPoint &pos) | - | ||||||||||||||||||||||||||||||||||||
| 913 | { | - | ||||||||||||||||||||||||||||||||||||
| 914 | QAbstractSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||
| 915 | QRect lastHoverRect = hoverRect; | - | ||||||||||||||||||||||||||||||||||||
| 916 | QStyle::SubControl lastHoverControl = hoverControl; | - | ||||||||||||||||||||||||||||||||||||
| 917 | bool doesHover = q->testAttribute(Qt::WA_Hover); | - | ||||||||||||||||||||||||||||||||||||
| 918 | if (lastHoverControl != newHoverControl(pos)
| 0 | ||||||||||||||||||||||||||||||||||||
| 919 | q->update(lastHoverRect); | - | ||||||||||||||||||||||||||||||||||||
| 920 | q->update(hoverRect); | - | ||||||||||||||||||||||||||||||||||||
| 921 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||||||||||||||||||||
| 922 | } | - | ||||||||||||||||||||||||||||||||||||
| 923 | return never executed: !doesHover;return !doesHover;never executed: return !doesHover; | 0 | ||||||||||||||||||||||||||||||||||||
| 924 | } | - | ||||||||||||||||||||||||||||||||||||
| 925 | - | |||||||||||||||||||||||||||||||||||||
| 926 | - | |||||||||||||||||||||||||||||||||||||
| 927 | - | |||||||||||||||||||||||||||||||||||||
| 928 | - | |||||||||||||||||||||||||||||||||||||
| 929 | - | |||||||||||||||||||||||||||||||||||||
| 930 | - | |||||||||||||||||||||||||||||||||||||
| 931 | QStyle::SubControl QAbstractSpinBoxPrivate::newHoverControl(const QPoint &pos) | - | ||||||||||||||||||||||||||||||||||||
| 932 | { | - | ||||||||||||||||||||||||||||||||||||
| 933 | QAbstractSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||
| 934 | - | |||||||||||||||||||||||||||||||||||||
| 935 | QStyleOptionSpinBox opt; | - | ||||||||||||||||||||||||||||||||||||
| 936 | q->initStyleOption(&opt); | - | ||||||||||||||||||||||||||||||||||||
| 937 | opt.subControls = QStyle::SC_All; | - | ||||||||||||||||||||||||||||||||||||
| 938 | hoverControl = q->style()->hitTestComplexControl(QStyle::CC_SpinBox, &opt, pos, q); | - | ||||||||||||||||||||||||||||||||||||
| 939 | hoverRect = q->style()->subControlRect(QStyle::CC_SpinBox, &opt, hoverControl, q); | - | ||||||||||||||||||||||||||||||||||||
| 940 | return never executed: hoverControl;return hoverControl;never executed: return hoverControl; | 0 | ||||||||||||||||||||||||||||||||||||
| 941 | } | - | ||||||||||||||||||||||||||||||||||||
| 942 | - | |||||||||||||||||||||||||||||||||||||
| 943 | - | |||||||||||||||||||||||||||||||||||||
| 944 | - | |||||||||||||||||||||||||||||||||||||
| 945 | - | |||||||||||||||||||||||||||||||||||||
| 946 | - | |||||||||||||||||||||||||||||||||||||
| 947 | - | |||||||||||||||||||||||||||||||||||||
| 948 | QString QAbstractSpinBoxPrivate::stripped(const QString &t, int *pos) const | - | ||||||||||||||||||||||||||||||||||||
| 949 | { | - | ||||||||||||||||||||||||||||||||||||
| 950 | QStringRef text(&t); | - | ||||||||||||||||||||||||||||||||||||
| 951 | if (specialValueText.size() == 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 952 | int from = 0; | - | ||||||||||||||||||||||||||||||||||||
| 953 | int size = text.size(); | - | ||||||||||||||||||||||||||||||||||||
| 954 | bool changed = false; | - | ||||||||||||||||||||||||||||||||||||
| 955 | if (prefix.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 956 | from += prefix.size(); | - | ||||||||||||||||||||||||||||||||||||
| 957 | size -= from; | - | ||||||||||||||||||||||||||||||||||||
| 958 | changed = true; | - | ||||||||||||||||||||||||||||||||||||
| 959 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 960 | if (suffix.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 961 | size -= suffix.size(); | - | ||||||||||||||||||||||||||||||||||||
| 962 | changed = true; | - | ||||||||||||||||||||||||||||||||||||
| 963 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 964 | if (changed
| 0 | ||||||||||||||||||||||||||||||||||||
| 965 | text = text.mid(from, size); never executed: text = text.mid(from, size); | 0 | ||||||||||||||||||||||||||||||||||||
| 966 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 967 | - | |||||||||||||||||||||||||||||||||||||
| 968 | const int s = text.size(); | - | ||||||||||||||||||||||||||||||||||||
| 969 | text = text.trimmed(); | - | ||||||||||||||||||||||||||||||||||||
| 970 | if (pos
| 0 | ||||||||||||||||||||||||||||||||||||
| 971 | (* never executed: pos) -= (s - text.size());(*pos) -= (s - text.size());never executed: (*pos) -= (s - text.size()); | 0 | ||||||||||||||||||||||||||||||||||||
| 972 | return never executed: text.toString();return text.toString();never executed: return text.toString(); | 0 | ||||||||||||||||||||||||||||||||||||
| 973 | - | |||||||||||||||||||||||||||||||||||||
| 974 | } | - | ||||||||||||||||||||||||||||||||||||
| 975 | - | |||||||||||||||||||||||||||||||||||||
| 976 | void QAbstractSpinBoxPrivate::updateEditFieldGeometry() | - | ||||||||||||||||||||||||||||||||||||
| 977 | { | - | ||||||||||||||||||||||||||||||||||||
| 978 | QAbstractSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||
| 979 | QStyleOptionSpinBox opt; | - | ||||||||||||||||||||||||||||||||||||
| 980 | q->initStyleOption(&opt); | - | ||||||||||||||||||||||||||||||||||||
| 981 | opt.subControls = QStyle::SC_SpinBoxEditField; | - | ||||||||||||||||||||||||||||||||||||
| 982 | edit->setGeometry(q->style()->subControlRect(QStyle::CC_SpinBox, &opt, | - | ||||||||||||||||||||||||||||||||||||
| 983 | QStyle::SC_SpinBoxEditField, q)); | - | ||||||||||||||||||||||||||||||||||||
| 984 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 985 | - | |||||||||||||||||||||||||||||||||||||
| 986 | - | |||||||||||||||||||||||||||||||||||||
| 987 | - | |||||||||||||||||||||||||||||||||||||
| 988 | - | |||||||||||||||||||||||||||||||||||||
| 989 | - | |||||||||||||||||||||||||||||||||||||
| 990 | bool QAbstractSpinBoxPrivate::specialValue() const | - | ||||||||||||||||||||||||||||||||||||
| 991 | { | - | ||||||||||||||||||||||||||||||||||||
| 992 | return never executed: (value == minimum && !specialValueText.isEmpty());return (value == minimum && !specialValueText.isEmpty());never executed: return (value == minimum && !specialValueText.isEmpty()); | 0 | ||||||||||||||||||||||||||||||||||||
| 993 | } | - | ||||||||||||||||||||||||||||||||||||
| 994 | - | |||||||||||||||||||||||||||||||||||||
| 995 | - | |||||||||||||||||||||||||||||||||||||
| 996 | - | |||||||||||||||||||||||||||||||||||||
| 997 | - | |||||||||||||||||||||||||||||||||||||
| 998 | - | |||||||||||||||||||||||||||||||||||||
| 999 | - | |||||||||||||||||||||||||||||||||||||
| 1000 | void QAbstractSpinBoxPrivate::emitSignals(EmitPolicy, const QVariant &) | - | ||||||||||||||||||||||||||||||||||||
| 1001 | { | - | ||||||||||||||||||||||||||||||||||||
| 1002 | } | - | ||||||||||||||||||||||||||||||||||||
| 1003 | void QAbstractSpinBoxPrivate::_q_editorTextChanged(const QString &t) | - | ||||||||||||||||||||||||||||||||||||
| 1004 | { | - | ||||||||||||||||||||||||||||||||||||
| 1005 | QAbstractSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||
| 1006 | - | |||||||||||||||||||||||||||||||||||||
| 1007 | if (keyboardTracking
| 0 | ||||||||||||||||||||||||||||||||||||
| 1008 | QString tmp = t; | - | ||||||||||||||||||||||||||||||||||||
| 1009 | int pos = edit->cursorPosition(); | - | ||||||||||||||||||||||||||||||||||||
| 1010 | QValidator::State state = q->validate(tmp, pos); | - | ||||||||||||||||||||||||||||||||||||
| 1011 | if (state == QValidator::Acceptable
| 0 | ||||||||||||||||||||||||||||||||||||
| 1012 | const QVariant v = valueFromText(tmp); | - | ||||||||||||||||||||||||||||||||||||
| 1013 | setValue(v, EmitIfChanged, tmp != t); | - | ||||||||||||||||||||||||||||||||||||
| 1014 | pendingEmit = false; | - | ||||||||||||||||||||||||||||||||||||
| 1015 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1016 | pendingEmit = true; | - | ||||||||||||||||||||||||||||||||||||
| 1017 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1018 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 1019 | pendingEmit = true; | - | ||||||||||||||||||||||||||||||||||||
| 1020 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1021 | } | - | ||||||||||||||||||||||||||||||||||||
| 1022 | void QAbstractSpinBoxPrivate::_q_editorCursorPositionChanged(int oldpos, int newpos) | - | ||||||||||||||||||||||||||||||||||||
| 1023 | { | - | ||||||||||||||||||||||||||||||||||||
| 1024 | if (!edit->hasSelectedText()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1025 | ignoreCursorPositionChanged = true; | - | ||||||||||||||||||||||||||||||||||||
| 1026 | - | |||||||||||||||||||||||||||||||||||||
| 1027 | bool allowSelection = true; | - | ||||||||||||||||||||||||||||||||||||
| 1028 | int pos = -1; | - | ||||||||||||||||||||||||||||||||||||
| 1029 | if (newpos < prefix.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1030 | if (oldpos == 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1031 | allowSelection = false; | - | ||||||||||||||||||||||||||||||||||||
| 1032 | pos = prefix.size(); | - | ||||||||||||||||||||||||||||||||||||
| 1033 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1034 | pos = oldpos; | - | ||||||||||||||||||||||||||||||||||||
| 1035 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1036 | } else if (newpos > edit->text().size() - suffix.size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1037 | && newpos != edit->text().size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1038 | if (oldpos == edit->text().size()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1039 | pos = edit->text().size() - suffix.size(); | - | ||||||||||||||||||||||||||||||||||||
| 1040 | allowSelection = false; | - | ||||||||||||||||||||||||||||||||||||
| 1041 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1042 | pos = edit->text().size(); | - | ||||||||||||||||||||||||||||||||||||
| 1043 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1044 | } | - | ||||||||||||||||||||||||||||||||||||
| 1045 | if (pos != -1
| 0 | ||||||||||||||||||||||||||||||||||||
| 1046 | const int selSize = edit->selectionStart() >= 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1047 | ? (edit->selectedText().size() | - | ||||||||||||||||||||||||||||||||||||
| 1048 | * (newpos < pos ? -1 : 1)) - newpos + pos | - | ||||||||||||||||||||||||||||||||||||
| 1049 | : 0; | - | ||||||||||||||||||||||||||||||||||||
| 1050 | - | |||||||||||||||||||||||||||||||||||||
| 1051 | const QSignalBlocker blocker(edit); | - | ||||||||||||||||||||||||||||||||||||
| 1052 | if (selSize != 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1053 | edit->setSelection(pos - selSize, selSize); | - | ||||||||||||||||||||||||||||||||||||
| 1054 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1055 | edit->setCursorPosition(pos); | - | ||||||||||||||||||||||||||||||||||||
| 1056 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1057 | } | - | ||||||||||||||||||||||||||||||||||||
| 1058 | ignoreCursorPositionChanged = false; | - | ||||||||||||||||||||||||||||||||||||
| 1059 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1060 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1061 | - | |||||||||||||||||||||||||||||||||||||
| 1062 | - | |||||||||||||||||||||||||||||||||||||
| 1063 | - | |||||||||||||||||||||||||||||||||||||
| 1064 | - | |||||||||||||||||||||||||||||||||||||
| 1065 | - | |||||||||||||||||||||||||||||||||||||
| 1066 | - | |||||||||||||||||||||||||||||||||||||
| 1067 | - | |||||||||||||||||||||||||||||||||||||
| 1068 | void QAbstractSpinBoxPrivate::init() | - | ||||||||||||||||||||||||||||||||||||
| 1069 | { | - | ||||||||||||||||||||||||||||||||||||
| 1070 | QAbstractSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||
| 1071 | - | |||||||||||||||||||||||||||||||||||||
| 1072 | q->setLineEdit(new QLineEdit(q)); | - | ||||||||||||||||||||||||||||||||||||
| 1073 | edit->setObjectName(QLatin1String("qt_spinbox_lineedit")); | - | ||||||||||||||||||||||||||||||||||||
| 1074 | validator = new QSpinBoxValidator(q, this); | - | ||||||||||||||||||||||||||||||||||||
| 1075 | edit->setValidator(validator); | - | ||||||||||||||||||||||||||||||||||||
| 1076 | - | |||||||||||||||||||||||||||||||||||||
| 1077 | QStyleOptionSpinBox opt; | - | ||||||||||||||||||||||||||||||||||||
| 1078 | q->initStyleOption(&opt); | - | ||||||||||||||||||||||||||||||||||||
| 1079 | spinClickTimerInterval = q->style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatRate, &opt, q); | - | ||||||||||||||||||||||||||||||||||||
| 1080 | spinClickThresholdTimerInterval = q->style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatThreshold, &opt, q); | - | ||||||||||||||||||||||||||||||||||||
| 1081 | q->setFocusPolicy(Qt::WheelFocus); | - | ||||||||||||||||||||||||||||||||||||
| 1082 | q->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, QSizePolicy::SpinBox)); | - | ||||||||||||||||||||||||||||||||||||
| 1083 | q->setAttribute(Qt::WA_InputMethodEnabled); | - | ||||||||||||||||||||||||||||||||||||
| 1084 | - | |||||||||||||||||||||||||||||||||||||
| 1085 | q->setAttribute(Qt::WA_MacShowFocusRect); | - | ||||||||||||||||||||||||||||||||||||
| 1086 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1087 | void QAbstractSpinBoxPrivate::reset() | - | ||||||||||||||||||||||||||||||||||||
| 1088 | { | - | ||||||||||||||||||||||||||||||||||||
| 1089 | QAbstractSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||
| 1090 | - | |||||||||||||||||||||||||||||||||||||
| 1091 | buttonState = None; | - | ||||||||||||||||||||||||||||||||||||
| 1092 | if (q
| 0 | ||||||||||||||||||||||||||||||||||||
| 1093 | if (spinClickTimerId != -1
| 0 | ||||||||||||||||||||||||||||||||||||
| 1094 | q->killTimer(spinClickTimerId); never executed: q->killTimer(spinClickTimerId); | 0 | ||||||||||||||||||||||||||||||||||||
| 1095 | if (spinClickThresholdTimerId != -1
| 0 | ||||||||||||||||||||||||||||||||||||
| 1096 | q->killTimer(spinClickThresholdTimerId); never executed: q->killTimer(spinClickThresholdTimerId); | 0 | ||||||||||||||||||||||||||||||||||||
| 1097 | spinClickTimerId = spinClickThresholdTimerId = -1; | - | ||||||||||||||||||||||||||||||||||||
| 1098 | acceleration = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1099 | q->update(); | - | ||||||||||||||||||||||||||||||||||||
| 1100 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1101 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1102 | - | |||||||||||||||||||||||||||||||||||||
| 1103 | - | |||||||||||||||||||||||||||||||||||||
| 1104 | - | |||||||||||||||||||||||||||||||||||||
| 1105 | - | |||||||||||||||||||||||||||||||||||||
| 1106 | - | |||||||||||||||||||||||||||||||||||||
| 1107 | - | |||||||||||||||||||||||||||||||||||||
| 1108 | - | |||||||||||||||||||||||||||||||||||||
| 1109 | void QAbstractSpinBoxPrivate::updateState(bool up, bool fromKeyboard ) | - | ||||||||||||||||||||||||||||||||||||
| 1110 | { | - | ||||||||||||||||||||||||||||||||||||
| 1111 | QAbstractSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||
| 1112 | if ((up
| 0 | ||||||||||||||||||||||||||||||||||||
| 1113 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1114 | reset(); | - | ||||||||||||||||||||||||||||||||||||
| 1115 | if (q
| 0 | ||||||||||||||||||||||||||||||||||||
| 1116 | : QAbstractSpinBox::StepDownEnabled))
| 0 | ||||||||||||||||||||||||||||||||||||
| 1117 | spinClickThresholdTimerId = q->startTimer(spinClickThresholdTimerInterval); | - | ||||||||||||||||||||||||||||||||||||
| 1118 | buttonState = (up
| 0 | ||||||||||||||||||||||||||||||||||||
| 1119 | q->stepBy(up ? 1 : -1); | - | ||||||||||||||||||||||||||||||||||||
| 1120 | - | |||||||||||||||||||||||||||||||||||||
| 1121 | QAccessibleValueChangeEvent event(q, value); | - | ||||||||||||||||||||||||||||||||||||
| 1122 | QAccessible::updateAccessibility(&event); | - | ||||||||||||||||||||||||||||||||||||
| 1123 | - | |||||||||||||||||||||||||||||||||||||
| 1124 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1125 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1126 | void QAbstractSpinBox::initStyleOption(QStyleOptionSpinBox *option) const | - | ||||||||||||||||||||||||||||||||||||
| 1127 | { | - | ||||||||||||||||||||||||||||||||||||
| 1128 | if (!option
| 0 | ||||||||||||||||||||||||||||||||||||
| 1129 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1130 | - | |||||||||||||||||||||||||||||||||||||
| 1131 | const QAbstractSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||||||||||||||
| 1132 | option->initFrom(this); | - | ||||||||||||||||||||||||||||||||||||
| 1133 | option->activeSubControls = QStyle::SC_None; | - | ||||||||||||||||||||||||||||||||||||
| 1134 | option->buttonSymbols = d->buttonSymbols; | - | ||||||||||||||||||||||||||||||||||||
| 1135 | option->subControls = QStyle::SC_SpinBoxFrame | QStyle::SC_SpinBoxEditField; | - | ||||||||||||||||||||||||||||||||||||
| 1136 | if (d->buttonSymbols != QAbstractSpinBox::NoButtons
| 0 | ||||||||||||||||||||||||||||||||||||
| 1137 | option->subControls |= QStyle::SC_SpinBoxUp | QStyle::SC_SpinBoxDown; | - | ||||||||||||||||||||||||||||||||||||
| 1138 | if (d->buttonState & Up
| 0 | ||||||||||||||||||||||||||||||||||||
| 1139 | option->activeSubControls = QStyle::SC_SpinBoxUp; | - | ||||||||||||||||||||||||||||||||||||
| 1140 | } never executed: else if (d->buttonState & Downend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 1141 | option->activeSubControls = QStyle::SC_SpinBoxDown; | - | ||||||||||||||||||||||||||||||||||||
| 1142 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1143 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1144 | - | |||||||||||||||||||||||||||||||||||||
| 1145 | if (d->buttonState
| 0 | ||||||||||||||||||||||||||||||||||||
| 1146 | option->state |= QStyle::State_Sunken; | - | ||||||||||||||||||||||||||||||||||||
| 1147 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1148 | option->activeSubControls = d->hoverControl; | - | ||||||||||||||||||||||||||||||||||||
| 1149 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1150 | - | |||||||||||||||||||||||||||||||||||||
| 1151 | option->stepEnabled = style()->styleHint(QStyle::SH_SpinControls_DisableOnBounds)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1152 | ? stepEnabled() | - | ||||||||||||||||||||||||||||||||||||
| 1153 | : (QAbstractSpinBox::StepDownEnabled|QAbstractSpinBox::StepUpEnabled); | - | ||||||||||||||||||||||||||||||||||||
| 1154 | - | |||||||||||||||||||||||||||||||||||||
| 1155 | option->frame = d->frame; | - | ||||||||||||||||||||||||||||||||||||
| 1156 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1157 | QVariant QAbstractSpinBoxPrivate::bound(const QVariant &val, const QVariant &old, int steps) const | - | ||||||||||||||||||||||||||||||||||||
| 1158 | { | - | ||||||||||||||||||||||||||||||||||||
| 1159 | QVariant v = val; | - | ||||||||||||||||||||||||||||||||||||
| 1160 | if (!wrapping
| 0 | ||||||||||||||||||||||||||||||||||||
| 1161 | if (variantCompare(v, minimum) < 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1162 | v = wrapping
| 0 | ||||||||||||||||||||||||||||||||||||
| 1163 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1164 | if (variantCompare(v, maximum) > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1165 | v = wrapping
| 0 | ||||||||||||||||||||||||||||||||||||
| 1166 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1167 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1168 | const bool wasMin = old == minimum; | - | ||||||||||||||||||||||||||||||||||||
| 1169 | const bool wasMax = old == maximum; | - | ||||||||||||||||||||||||||||||||||||
| 1170 | const int oldcmp = variantCompare(v, old); | - | ||||||||||||||||||||||||||||||||||||
| 1171 | const int maxcmp = variantCompare(v, maximum); | - | ||||||||||||||||||||||||||||||||||||
| 1172 | const int mincmp = variantCompare(v, minimum); | - | ||||||||||||||||||||||||||||||||||||
| 1173 | const bool wrapped = (oldcmp > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1174 | if (maxcmp > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1175 | v = ((wasMax
| 0 | ||||||||||||||||||||||||||||||||||||
| 1176 | ? minimum : maximum; | - | ||||||||||||||||||||||||||||||||||||
| 1177 | } never executed: else if (wrappedend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 1178 | v = ((wasMax
| 0 | ||||||||||||||||||||||||||||||||||||
| 1179 | } never executed: else if (mincmp < 0end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 1180 | v = (!wasMax
| 0 | ||||||||||||||||||||||||||||||||||||
| 1181 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1182 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1183 | - | |||||||||||||||||||||||||||||||||||||
| 1184 | return never executed: v;return v;never executed: return v; | 0 | ||||||||||||||||||||||||||||||||||||
| 1185 | } | - | ||||||||||||||||||||||||||||||||||||
| 1186 | void QAbstractSpinBoxPrivate::setValue(const QVariant &val, EmitPolicy ep, | - | ||||||||||||||||||||||||||||||||||||
| 1187 | bool doUpdate) | - | ||||||||||||||||||||||||||||||||||||
| 1188 | { | - | ||||||||||||||||||||||||||||||||||||
| 1189 | QAbstractSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||
| 1190 | const QVariant old = value; | - | ||||||||||||||||||||||||||||||||||||
| 1191 | value = bound(val); | - | ||||||||||||||||||||||||||||||||||||
| 1192 | pendingEmit = false; | - | ||||||||||||||||||||||||||||||||||||
| 1193 | cleared = false; | - | ||||||||||||||||||||||||||||||||||||
| 1194 | if (doUpdate
| 0 | ||||||||||||||||||||||||||||||||||||
| 1195 | updateEdit(); | - | ||||||||||||||||||||||||||||||||||||
| 1196 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1197 | q->update(); | - | ||||||||||||||||||||||||||||||||||||
| 1198 | - | |||||||||||||||||||||||||||||||||||||
| 1199 | if (ep == AlwaysEmit
| 0 | ||||||||||||||||||||||||||||||||||||
| 1200 | emitSignals(ep, old); | - | ||||||||||||||||||||||||||||||||||||
| 1201 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1202 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1203 | - | |||||||||||||||||||||||||||||||||||||
| 1204 | - | |||||||||||||||||||||||||||||||||||||
| 1205 | - | |||||||||||||||||||||||||||||||||||||
| 1206 | - | |||||||||||||||||||||||||||||||||||||
| 1207 | - | |||||||||||||||||||||||||||||||||||||
| 1208 | - | |||||||||||||||||||||||||||||||||||||
| 1209 | - | |||||||||||||||||||||||||||||||||||||
| 1210 | void QAbstractSpinBoxPrivate::updateEdit() | - | ||||||||||||||||||||||||||||||||||||
| 1211 | { | - | ||||||||||||||||||||||||||||||||||||
| 1212 | QAbstractSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||
| 1213 | if (type == QVariant::Invalid
| 0 | ||||||||||||||||||||||||||||||||||||
| 1214 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1215 | const QString newText = specialValue()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1216 | if (newText == edit->displayText()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1217 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1218 | - | |||||||||||||||||||||||||||||||||||||
| 1219 | const bool empty = edit->text().isEmpty(); | - | ||||||||||||||||||||||||||||||||||||
| 1220 | int cursor = edit->cursorPosition(); | - | ||||||||||||||||||||||||||||||||||||
| 1221 | int selsize = edit->selectedText().size(); | - | ||||||||||||||||||||||||||||||||||||
| 1222 | const QSignalBlocker blocker(edit); | - | ||||||||||||||||||||||||||||||||||||
| 1223 | edit->setText(newText); | - | ||||||||||||||||||||||||||||||||||||
| 1224 | - | |||||||||||||||||||||||||||||||||||||
| 1225 | if (!specialValue()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1226 | cursor = qBound(prefix.size(), cursor, edit->displayText().size() - suffix.size()); | - | ||||||||||||||||||||||||||||||||||||
| 1227 | - | |||||||||||||||||||||||||||||||||||||
| 1228 | if (selsize > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1229 | edit->setSelection(cursor, selsize); | - | ||||||||||||||||||||||||||||||||||||
| 1230 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1231 | edit->setCursorPosition(empty ? prefix.size() : cursor); | - | ||||||||||||||||||||||||||||||||||||
| 1232 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1233 | } | - | ||||||||||||||||||||||||||||||||||||
| 1234 | q->update(); | - | ||||||||||||||||||||||||||||||||||||
| 1235 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1236 | - | |||||||||||||||||||||||||||||||||||||
| 1237 | - | |||||||||||||||||||||||||||||||||||||
| 1238 | - | |||||||||||||||||||||||||||||||||||||
| 1239 | - | |||||||||||||||||||||||||||||||||||||
| 1240 | - | |||||||||||||||||||||||||||||||||||||
| 1241 | - | |||||||||||||||||||||||||||||||||||||
| 1242 | - | |||||||||||||||||||||||||||||||||||||
| 1243 | void QAbstractSpinBoxPrivate::setRange(const QVariant &min, const QVariant &max) | - | ||||||||||||||||||||||||||||||||||||
| 1244 | { | - | ||||||||||||||||||||||||||||||||||||
| 1245 | QAbstractSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||
| 1246 | - | |||||||||||||||||||||||||||||||||||||
| 1247 | clearCache(); | - | ||||||||||||||||||||||||||||||||||||
| 1248 | minimum = min; | - | ||||||||||||||||||||||||||||||||||||
| 1249 | maximum = (variantCompare(min, max) < 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1250 | cachedSizeHint = QSize(); | - | ||||||||||||||||||||||||||||||||||||
| 1251 | cachedMinimumSizeHint = QSize(); | - | ||||||||||||||||||||||||||||||||||||
| 1252 | - | |||||||||||||||||||||||||||||||||||||
| 1253 | reset(); | - | ||||||||||||||||||||||||||||||||||||
| 1254 | if (!(bound(value) == value)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1255 | setValue(bound(value), EmitIfChanged); | - | ||||||||||||||||||||||||||||||||||||
| 1256 | } never executed: else if (value == minimumend of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 1257 | updateEdit(); | - | ||||||||||||||||||||||||||||||||||||
| 1258 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1259 | - | |||||||||||||||||||||||||||||||||||||
| 1260 | q->updateGeometry(); | - | ||||||||||||||||||||||||||||||||||||
| 1261 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1262 | - | |||||||||||||||||||||||||||||||||||||
| 1263 | - | |||||||||||||||||||||||||||||||||||||
| 1264 | - | |||||||||||||||||||||||||||||||||||||
| 1265 | - | |||||||||||||||||||||||||||||||||||||
| 1266 | - | |||||||||||||||||||||||||||||||||||||
| 1267 | - | |||||||||||||||||||||||||||||||||||||
| 1268 | - | |||||||||||||||||||||||||||||||||||||
| 1269 | QVariant QAbstractSpinBoxPrivate::getZeroVariant() const | - | ||||||||||||||||||||||||||||||||||||
| 1270 | { | - | ||||||||||||||||||||||||||||||||||||
| 1271 | QVariant ret; | - | ||||||||||||||||||||||||||||||||||||
| 1272 | switch (type) { | - | ||||||||||||||||||||||||||||||||||||
| 1273 | case never executed: QVariant::Int:case QVariant::Int:never executed: ret = QVariant((int)0); break;case QVariant::Int:never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1274 | case never executed: QVariant::Double:case QVariant::Double:never executed: ret = QVariant((double)0.0); break;case QVariant::Double:never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1275 | default never executed: :default:never executed: break;default:never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1276 | } | - | ||||||||||||||||||||||||||||||||||||
| 1277 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||||||||||||||||||||
| 1278 | } | - | ||||||||||||||||||||||||||||||||||||
| 1279 | QString QAbstractSpinBoxPrivate::textFromValue(const QVariant &) const | - | ||||||||||||||||||||||||||||||||||||
| 1280 | { | - | ||||||||||||||||||||||||||||||||||||
| 1281 | return never executed: QString();return QString();never executed: return QString(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1282 | } | - | ||||||||||||||||||||||||||||||||||||
| 1283 | QVariant QAbstractSpinBoxPrivate::valueFromText(const QString &) const | - | ||||||||||||||||||||||||||||||||||||
| 1284 | { | - | ||||||||||||||||||||||||||||||||||||
| 1285 | return never executed: QVariant();return QVariant();never executed: return QVariant(); | 0 | ||||||||||||||||||||||||||||||||||||
| 1286 | } | - | ||||||||||||||||||||||||||||||||||||
| 1287 | - | |||||||||||||||||||||||||||||||||||||
| 1288 | - | |||||||||||||||||||||||||||||||||||||
| 1289 | - | |||||||||||||||||||||||||||||||||||||
| 1290 | - | |||||||||||||||||||||||||||||||||||||
| 1291 | - | |||||||||||||||||||||||||||||||||||||
| 1292 | - | |||||||||||||||||||||||||||||||||||||
| 1293 | - | |||||||||||||||||||||||||||||||||||||
| 1294 | void QAbstractSpinBoxPrivate::interpret(EmitPolicy ep) | - | ||||||||||||||||||||||||||||||||||||
| 1295 | { | - | ||||||||||||||||||||||||||||||||||||
| 1296 | QAbstractSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||||||||||||||
| 1297 | if (type == QVariant::Invalid
| 0 | ||||||||||||||||||||||||||||||||||||
| 1298 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||||||||
| 1299 | - | |||||||||||||||||||||||||||||||||||||
| 1300 | QVariant v = getZeroVariant(); | - | ||||||||||||||||||||||||||||||||||||
| 1301 | bool doInterpret = true; | - | ||||||||||||||||||||||||||||||||||||
| 1302 | QString tmp = edit->displayText(); | - | ||||||||||||||||||||||||||||||||||||
| 1303 | int pos = edit->cursorPosition(); | - | ||||||||||||||||||||||||||||||||||||
| 1304 | const int oldpos = pos; | - | ||||||||||||||||||||||||||||||||||||
| 1305 | - | |||||||||||||||||||||||||||||||||||||
| 1306 | if (q->validate(tmp, pos) != QValidator::Acceptable
| 0 | ||||||||||||||||||||||||||||||||||||
| 1307 | const QString copy = tmp; | - | ||||||||||||||||||||||||||||||||||||
| 1308 | q->fixup(tmp); | - | ||||||||||||||||||||||||||||||||||||
| 1309 | if (false) QMessageLogger(__FILE__, 1858, __PRETTY_FUNCTION__).debug() << "QAbstractSpinBoxPrivate::interpret() text '" dead code: QMessageLogger(__FILE__, 1858, __PRETTY_FUNCTION__).debug() << "QAbstractSpinBoxPrivate::interpret() text '" << edit->displayText() << "' >> '" << copy << '\'' << "' >> '" << tmp << '\''; | - | ||||||||||||||||||||||||||||||||||||
| 1310 | << edit->displayText() dead code: QMessageLogger(__FILE__, 1858, __PRETTY_FUNCTION__).debug() << "QAbstractSpinBoxPrivate::interpret() text '" << edit->displayText() << "' >> '" << copy << '\'' << "' >> '" << tmp << '\''; | - | ||||||||||||||||||||||||||||||||||||
| 1311 | << "' >> '" << copy << '\'' dead code: QMessageLogger(__FILE__, 1858, __PRETTY_FUNCTION__).debug() << "QAbstractSpinBoxPrivate::interpret() text '" << edit->displayText() << "' >> '" << copy << '\'' << "' >> '" << tmp << '\''; | - | ||||||||||||||||||||||||||||||||||||
| 1312 | << "' >> '" << tmp << '\''; dead code: QMessageLogger(__FILE__, 1858, __PRETTY_FUNCTION__).debug() << "QAbstractSpinBoxPrivate::interpret() text '" << edit->displayText() << "' >> '" << copy << '\'' << "' >> '" << tmp << '\''; | - | ||||||||||||||||||||||||||||||||||||
| 1313 | - | |||||||||||||||||||||||||||||||||||||
| 1314 | doInterpret = tmp != copy
| 0 | ||||||||||||||||||||||||||||||||||||
| 1315 | if (!doInterpret
| 0 | ||||||||||||||||||||||||||||||||||||
| 1316 | v = (correctionMode == QAbstractSpinBox::CorrectToNearestValue
| 0 | ||||||||||||||||||||||||||||||||||||
| 1317 | ? variantBound(minimum, v, maximum) : value); | - | ||||||||||||||||||||||||||||||||||||
| 1318 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1319 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1320 | if (doInterpret
| 0 | ||||||||||||||||||||||||||||||||||||
| 1321 | v = valueFromText(tmp); | - | ||||||||||||||||||||||||||||||||||||
| 1322 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1323 | clearCache(); | - | ||||||||||||||||||||||||||||||||||||
| 1324 | setValue(v, ep, true); | - | ||||||||||||||||||||||||||||||||||||
| 1325 | if (oldpos != pos
| 0 | ||||||||||||||||||||||||||||||||||||
| 1326 | edit->setCursorPosition(pos); never executed: edit->setCursorPosition(pos); | 0 | ||||||||||||||||||||||||||||||||||||
| 1327 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1328 | - | |||||||||||||||||||||||||||||||||||||
| 1329 | void QAbstractSpinBoxPrivate::clearCache() const | - | ||||||||||||||||||||||||||||||||||||
| 1330 | { | - | ||||||||||||||||||||||||||||||||||||
| 1331 | cachedText.clear(); | - | ||||||||||||||||||||||||||||||||||||
| 1332 | cachedValue.clear(); | - | ||||||||||||||||||||||||||||||||||||
| 1333 | cachedState = QValidator::Acceptable; | - | ||||||||||||||||||||||||||||||||||||
| 1334 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1335 | QSpinBoxValidator::QSpinBoxValidator(QAbstractSpinBox *qp, QAbstractSpinBoxPrivate *dp) | - | ||||||||||||||||||||||||||||||||||||
| 1336 | : QValidator(qp), qptr(qp), dptr(dp) | - | ||||||||||||||||||||||||||||||||||||
| 1337 | { | - | ||||||||||||||||||||||||||||||||||||
| 1338 | setObjectName(QLatin1String("qt_spinboxvalidator")); | - | ||||||||||||||||||||||||||||||||||||
| 1339 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1340 | QValidator::State QSpinBoxValidator::validate(QString &input, int &pos) const | - | ||||||||||||||||||||||||||||||||||||
| 1341 | { | - | ||||||||||||||||||||||||||||||||||||
| 1342 | if (dptr->specialValueText.size() > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1343 | return never executed: QValidator::Acceptable;return QValidator::Acceptable;never executed: return QValidator::Acceptable; | 0 | ||||||||||||||||||||||||||||||||||||
| 1344 | - | |||||||||||||||||||||||||||||||||||||
| 1345 | if (!dptr->prefix.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1346 | input.prepend(dptr->prefix); | - | ||||||||||||||||||||||||||||||||||||
| 1347 | pos += dptr->prefix.length(); | - | ||||||||||||||||||||||||||||||||||||
| 1348 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1349 | - | |||||||||||||||||||||||||||||||||||||
| 1350 | if (!dptr->suffix.isEmpty()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1351 | input.append(dptr->suffix); never executed: input.append(dptr->suffix); | 0 | ||||||||||||||||||||||||||||||||||||
| 1352 | - | |||||||||||||||||||||||||||||||||||||
| 1353 | return never executed: qptr->validate(input, pos);return qptr->validate(input, pos);never executed: return qptr->validate(input, pos); | 0 | ||||||||||||||||||||||||||||||||||||
| 1354 | } | - | ||||||||||||||||||||||||||||||||||||
| 1355 | - | |||||||||||||||||||||||||||||||||||||
| 1356 | - | |||||||||||||||||||||||||||||||||||||
| 1357 | - | |||||||||||||||||||||||||||||||||||||
| 1358 | - | |||||||||||||||||||||||||||||||||||||
| 1359 | - | |||||||||||||||||||||||||||||||||||||
| 1360 | void QSpinBoxValidator::fixup(QString &input) const | - | ||||||||||||||||||||||||||||||||||||
| 1361 | { | - | ||||||||||||||||||||||||||||||||||||
| 1362 | qptr->fixup(input); | - | ||||||||||||||||||||||||||||||||||||
| 1363 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1364 | QVariant operator+(const QVariant &arg1, const QVariant &arg2) | - | ||||||||||||||||||||||||||||||||||||
| 1365 | { | - | ||||||||||||||||||||||||||||||||||||
| 1366 | QVariant ret; | - | ||||||||||||||||||||||||||||||||||||
| 1367 | if (__builtin_expect(!!(arg1.type() != arg2.type()), false)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1368 | QMessageLogger(__FILE__, 1942, __PRETTY_FUNCTION__).warning("QAbstractSpinBox: Internal error: Different types (%s vs %s) (%s:%d)", never executed: QMessageLogger(__FILE__, 1942, __PRETTY_FUNCTION__).warning("QAbstractSpinBox: Internal error: Different types (%s vs %s) (%s:%d)", arg1.typeName(), arg2.typeName(), __FILE__, 1943); | 0 | ||||||||||||||||||||||||||||||||||||
| 1369 | arg1.typeName(), arg2.typeName(), __FILE__, 1943); never executed: QMessageLogger(__FILE__, 1942, __PRETTY_FUNCTION__).warning("QAbstractSpinBox: Internal error: Different types (%s vs %s) (%s:%d)", arg1.typeName(), arg2.typeName(), __FILE__, 1943); | 0 | ||||||||||||||||||||||||||||||||||||
| 1370 | switch (arg1.type()) { | - | ||||||||||||||||||||||||||||||||||||
| 1371 | case never executed: QVariant::Int:case QVariant::Int:never executed: {case QVariant::Int: | 0 | ||||||||||||||||||||||||||||||||||||
| 1372 | const int int1 = arg1.toInt(); | - | ||||||||||||||||||||||||||||||||||||
| 1373 | const int int2 = arg2.toInt(); | - | ||||||||||||||||||||||||||||||||||||
| 1374 | if (int1 > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1375 | - | |||||||||||||||||||||||||||||||||||||
| 1376 | ret = QVariant(2147483647); | - | ||||||||||||||||||||||||||||||||||||
| 1377 | } never executed: else if (int1 < 0end of block
| 0 | ||||||||||||||||||||||||||||||||||||
| 1378 | - | |||||||||||||||||||||||||||||||||||||
| 1379 | ret = QVariant((-2147483647 - 1)); | - | ||||||||||||||||||||||||||||||||||||
| 1380 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1381 | ret = QVariant(int1 + int2); | - | ||||||||||||||||||||||||||||||||||||
| 1382 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1383 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1384 | } | - | ||||||||||||||||||||||||||||||||||||
| 1385 | case never executed: QVariant::Double:case QVariant::Double:never executed: ret = QVariant(arg1.toDouble() + arg2.toDouble()); break;case QVariant::Double:never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1386 | case never executed: QVariant::DateTime:case QVariant::DateTime:never executed: {case QVariant::DateTime: | 0 | ||||||||||||||||||||||||||||||||||||
| 1387 | QDateTime a2 = arg2.toDateTime(); | - | ||||||||||||||||||||||||||||||||||||
| 1388 | QDateTime a1 = arg1.toDateTime().addDays(QDateTime(QDate(100, 1, 1), QTime(0, 0, 0, 0)).daysTo(a2)); | - | ||||||||||||||||||||||||||||||||||||
| 1389 | a1.setTime(a1.time().addMSecs(QTime().msecsTo(a2.time()))); | - | ||||||||||||||||||||||||||||||||||||
| 1390 | ret = QVariant(a1); | - | ||||||||||||||||||||||||||||||||||||
| 1391 | } | - | ||||||||||||||||||||||||||||||||||||
| 1392 | default never executed: :default:never executed: default:code before this statement never executed: break;default:never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1393 | } | - | ||||||||||||||||||||||||||||||||||||
| 1394 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||||||||||||||||||||
| 1395 | } | - | ||||||||||||||||||||||||||||||||||||
| 1396 | - | |||||||||||||||||||||||||||||||||||||
| 1397 | - | |||||||||||||||||||||||||||||||||||||
| 1398 | - | |||||||||||||||||||||||||||||||||||||
| 1399 | - | |||||||||||||||||||||||||||||||||||||
| 1400 | - | |||||||||||||||||||||||||||||||||||||
| 1401 | - | |||||||||||||||||||||||||||||||||||||
| 1402 | - | |||||||||||||||||||||||||||||||||||||
| 1403 | QVariant operator-(const QVariant &arg1, const QVariant &arg2) | - | ||||||||||||||||||||||||||||||||||||
| 1404 | { | - | ||||||||||||||||||||||||||||||||||||
| 1405 | QVariant ret; | - | ||||||||||||||||||||||||||||||||||||
| 1406 | if (__builtin_expect(!!(arg1.type() != arg2.type()), false)
| 0 | ||||||||||||||||||||||||||||||||||||
| 1407 | QMessageLogger(__FILE__, 1981, __PRETTY_FUNCTION__).warning("QAbstractSpinBox: Internal error: Different types (%s vs %s) (%s:%d)", never executed: QMessageLogger(__FILE__, 1981, __PRETTY_FUNCTION__).warning("QAbstractSpinBox: Internal error: Different types (%s vs %s) (%s:%d)", arg1.typeName(), arg2.typeName(), __FILE__, 1982); | 0 | ||||||||||||||||||||||||||||||||||||
| 1408 | arg1.typeName(), arg2.typeName(), __FILE__, 1982); never executed: QMessageLogger(__FILE__, 1981, __PRETTY_FUNCTION__).warning("QAbstractSpinBox: Internal error: Different types (%s vs %s) (%s:%d)", arg1.typeName(), arg2.typeName(), __FILE__, 1982); | 0 | ||||||||||||||||||||||||||||||||||||
| 1409 | switch (arg1.type()) { | - | ||||||||||||||||||||||||||||||||||||
| 1410 | case never executed: QVariant::Int:case QVariant::Int:never executed: ret = QVariant(arg1.toInt() - arg2.toInt()); break;case QVariant::Int:never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1411 | case never executed: QVariant::Double:case QVariant::Double:never executed: ret = QVariant(arg1.toDouble() - arg2.toDouble()); break;case QVariant::Double:never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1412 | case never executed: QVariant::DateTime:case QVariant::DateTime:never executed: {case QVariant::DateTime: | 0 | ||||||||||||||||||||||||||||||||||||
| 1413 | QDateTime a1 = arg1.toDateTime(); | - | ||||||||||||||||||||||||||||||||||||
| 1414 | QDateTime a2 = arg2.toDateTime(); | - | ||||||||||||||||||||||||||||||||||||
| 1415 | int days = a2.daysTo(a1); | - | ||||||||||||||||||||||||||||||||||||
| 1416 | int secs = a2.secsTo(a1); | - | ||||||||||||||||||||||||||||||||||||
| 1417 | int msecs = qMax(0, a1.time().msec() - a2.time().msec()); | - | ||||||||||||||||||||||||||||||||||||
| 1418 | if (days < 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1419 | ret = arg1; | - | ||||||||||||||||||||||||||||||||||||
| 1420 | } never executed: else {end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1421 | QDateTime dt = a2.addDays(days).addSecs(secs); | - | ||||||||||||||||||||||||||||||||||||
| 1422 | if (msecs > 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1423 | dt.setTime(dt.time().addMSecs(msecs)); never executed: dt.setTime(dt.time().addMSecs(msecs)); | 0 | ||||||||||||||||||||||||||||||||||||
| 1424 | ret = QVariant(dt); | - | ||||||||||||||||||||||||||||||||||||
| 1425 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1426 | } | - | ||||||||||||||||||||||||||||||||||||
| 1427 | default never executed: :default:never executed: default:code before this statement never executed: break;default:never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1428 | } | - | ||||||||||||||||||||||||||||||||||||
| 1429 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||||||||||||||||||||
| 1430 | } | - | ||||||||||||||||||||||||||||||||||||
| 1431 | - | |||||||||||||||||||||||||||||||||||||
| 1432 | - | |||||||||||||||||||||||||||||||||||||
| 1433 | - | |||||||||||||||||||||||||||||||||||||
| 1434 | - | |||||||||||||||||||||||||||||||||||||
| 1435 | - | |||||||||||||||||||||||||||||||||||||
| 1436 | - | |||||||||||||||||||||||||||||||||||||
| 1437 | QVariant operator*(const QVariant &arg1, double multiplier) | - | ||||||||||||||||||||||||||||||||||||
| 1438 | { | - | ||||||||||||||||||||||||||||||||||||
| 1439 | QVariant ret; | - | ||||||||||||||||||||||||||||||||||||
| 1440 | - | |||||||||||||||||||||||||||||||||||||
| 1441 | switch (arg1.type()) { | - | ||||||||||||||||||||||||||||||||||||
| 1442 | case never executed: QVariant::Int:case QVariant::Int:never executed: case QVariant::Int: | 0 | ||||||||||||||||||||||||||||||||||||
| 1443 | ret = static_cast<int>(qBound<double>((-2147483647 - 1), arg1.toInt() * multiplier, 2147483647)); | - | ||||||||||||||||||||||||||||||||||||
| 1444 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1445 | case never executed: QVariant::Double:case QVariant::Double:never executed: ret = QVariant(arg1.toDouble() * multiplier); break;case QVariant::Double:never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1446 | case never executed: QVariant::DateTime:case QVariant::DateTime:never executed: {case QVariant::DateTime: | 0 | ||||||||||||||||||||||||||||||||||||
| 1447 | double days = QDate(100, 1, 1).daysTo(arg1.toDateTime().date()) * multiplier; | - | ||||||||||||||||||||||||||||||||||||
| 1448 | int daysInt = (int)days; | - | ||||||||||||||||||||||||||||||||||||
| 1449 | days -= daysInt; | - | ||||||||||||||||||||||||||||||||||||
| 1450 | long msecs = (long)((QTime(0, 0, 0, 0).msecsTo(arg1.toDateTime().time()) * multiplier) | - | ||||||||||||||||||||||||||||||||||||
| 1451 | + (days * (24 * 3600 * 1000))); | - | ||||||||||||||||||||||||||||||||||||
| 1452 | ret = QDateTime(QDate().addDays(int(days)), QTime().addMSecs(msecs)); | - | ||||||||||||||||||||||||||||||||||||
| 1453 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1454 | } | - | ||||||||||||||||||||||||||||||||||||
| 1455 | default never executed: :default:never executed: ret = arg1; break;default:never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1456 | } | - | ||||||||||||||||||||||||||||||||||||
| 1457 | - | |||||||||||||||||||||||||||||||||||||
| 1458 | return never executed: ret;return ret;never executed: return ret; | 0 | ||||||||||||||||||||||||||||||||||||
| 1459 | } | - | ||||||||||||||||||||||||||||||||||||
| 1460 | - | |||||||||||||||||||||||||||||||||||||
| 1461 | - | |||||||||||||||||||||||||||||||||||||
| 1462 | - | |||||||||||||||||||||||||||||||||||||
| 1463 | double operator/(const QVariant &arg1, const QVariant &arg2) | - | ||||||||||||||||||||||||||||||||||||
| 1464 | { | - | ||||||||||||||||||||||||||||||||||||
| 1465 | double a1 = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1466 | double a2 = 0; | - | ||||||||||||||||||||||||||||||||||||
| 1467 | - | |||||||||||||||||||||||||||||||||||||
| 1468 | switch (arg1.type()) { | - | ||||||||||||||||||||||||||||||||||||
| 1469 | case never executed: QVariant::Int:case QVariant::Int:never executed: case QVariant::Int: | 0 | ||||||||||||||||||||||||||||||||||||
| 1470 | a1 = (double)arg1.toInt(); | - | ||||||||||||||||||||||||||||||||||||
| 1471 | a2 = (double)arg2.toInt(); | - | ||||||||||||||||||||||||||||||||||||
| 1472 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1473 | case never executed: QVariant::Double:case QVariant::Double:never executed: case QVariant::Double: | 0 | ||||||||||||||||||||||||||||||||||||
| 1474 | a1 = arg1.toDouble(); | - | ||||||||||||||||||||||||||||||||||||
| 1475 | a2 = arg2.toDouble(); | - | ||||||||||||||||||||||||||||||||||||
| 1476 | break; never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1477 | case never executed: QVariant::DateTime:case QVariant::DateTime:never executed: case QVariant::DateTime: | 0 | ||||||||||||||||||||||||||||||||||||
| 1478 | a1 = QDate(100, 1, 1).daysTo(arg1.toDate()); | - | ||||||||||||||||||||||||||||||||||||
| 1479 | a2 = QDate(100, 1, 1).daysTo(arg2.toDate()); | - | ||||||||||||||||||||||||||||||||||||
| 1480 | a1 += (double)QTime(0, 0, 0, 0).msecsTo(arg1.toDateTime().time()) / (long)(3600 * 24 * 1000); | - | ||||||||||||||||||||||||||||||||||||
| 1481 | a2 += (double)QTime(0, 0, 0, 0).msecsTo(arg2.toDateTime().time()) / (long)(3600 * 24 * 1000); | - | ||||||||||||||||||||||||||||||||||||
| 1482 | default never executed: :default:never executed: default:code before this statement never executed: break;default:never executed: break; | 0 | ||||||||||||||||||||||||||||||||||||
| 1483 | } | - | ||||||||||||||||||||||||||||||||||||
| 1484 | - | |||||||||||||||||||||||||||||||||||||
| 1485 | return never executed: (a1 != 0 && a2 != 0) ? (a1 / a2) : 0.0;return (a1 != 0 && a2 != 0) ? (a1 / a2) : 0.0;never executed: return (a1 != 0 && a2 != 0) ? (a1 / a2) : 0.0; | 0 | ||||||||||||||||||||||||||||||||||||
| 1486 | } | - | ||||||||||||||||||||||||||||||||||||
| 1487 | - | |||||||||||||||||||||||||||||||||||||
| 1488 | int QAbstractSpinBoxPrivate::variantCompare(const QVariant &arg1, const QVariant &arg2) | - | ||||||||||||||||||||||||||||||||||||
| 1489 | { | - | ||||||||||||||||||||||||||||||||||||
| 1490 | switch (arg2.type()) { | - | ||||||||||||||||||||||||||||||||||||
| 1491 | case never executed: QVariant::Date:case QVariant::Date:never executed: case QVariant::Date: | 0 | ||||||||||||||||||||||||||||||||||||
| 1492 | ((!(arg1.type() == QVariant::Date)) ? qt_assert_x("QAbstractSpinBoxPrivate::variantCompare", QString(QString::fromLatin1("Internal error 1 (%1)"). arg(QString::fromLatin1(arg1.typeName()))).toLocal8Bit().constData(), | - | ||||||||||||||||||||||||||||||||||||
| 1493 | - | |||||||||||||||||||||||||||||||||||||
| 1494 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
| 1495 | , | - | ||||||||||||||||||||||||||||||||||||
| 1496 | - | |||||||||||||||||||||||||||||||||||||
| 1497 | 2068 | - | ||||||||||||||||||||||||||||||||||||
| 1498 | ) : qt_noop()) | - | ||||||||||||||||||||||||||||||||||||
| 1499 | - | |||||||||||||||||||||||||||||||||||||
| 1500 | ; | - | ||||||||||||||||||||||||||||||||||||
| 1501 | if (arg1.toDate() == arg2.toDate()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1502 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 1503 | } else if (arg1.toDate() < arg2.toDate()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1504 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
| 1505 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 1506 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 1507 | } | - | ||||||||||||||||||||||||||||||||||||
| 1508 | case never executed: QVariant::Time:case QVariant::Time:never executed: case QVariant::Time: | 0 | ||||||||||||||||||||||||||||||||||||
| 1509 | ((!(arg1.type() == QVariant::Time)) ? qt_assert_x("QAbstractSpinBoxPrivate::variantCompare", QString(QString::fromLatin1("Internal error 2 (%1)"). arg(QString::fromLatin1(arg1.typeName()))).toLocal8Bit().constData(), | - | ||||||||||||||||||||||||||||||||||||
| 1510 | - | |||||||||||||||||||||||||||||||||||||
| 1511 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
| 1512 | , | - | ||||||||||||||||||||||||||||||||||||
| 1513 | - | |||||||||||||||||||||||||||||||||||||
| 1514 | 2079 | - | ||||||||||||||||||||||||||||||||||||
| 1515 | ) : qt_noop()) | - | ||||||||||||||||||||||||||||||||||||
| 1516 | - | |||||||||||||||||||||||||||||||||||||
| 1517 | ; | - | ||||||||||||||||||||||||||||||||||||
| 1518 | if (arg1.toTime() == arg2.toTime()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1519 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 1520 | } else if (arg1.toTime() < arg2.toTime()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1521 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
| 1522 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 1523 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 1524 | } | - | ||||||||||||||||||||||||||||||||||||
| 1525 | - | |||||||||||||||||||||||||||||||||||||
| 1526 | - | |||||||||||||||||||||||||||||||||||||
| 1527 | case never executed: QVariant::DateTime:case QVariant::DateTime:never executed: case QVariant::DateTime: | 0 | ||||||||||||||||||||||||||||||||||||
| 1528 | if (arg1.toDateTime() == arg2.toDateTime()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1529 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 1530 | } else if (arg1.toDateTime() < arg2.toDateTime()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1531 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
| 1532 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 1533 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 1534 | } | - | ||||||||||||||||||||||||||||||||||||
| 1535 | case never executed: QVariant::Int:case QVariant::Int:never executed: case QVariant::Int: | 0 | ||||||||||||||||||||||||||||||||||||
| 1536 | if (arg1.toInt() == arg2.toInt()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1537 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 1538 | } else if (arg1.toInt() < arg2.toInt()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1539 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
| 1540 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 1541 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 1542 | } | - | ||||||||||||||||||||||||||||||||||||
| 1543 | case never executed: QVariant::Double:case QVariant::Double:never executed: case QVariant::Double: | 0 | ||||||||||||||||||||||||||||||||||||
| 1544 | if (arg1.toDouble() == arg2.toDouble()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1545 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 1546 | } else if (arg1.toDouble() < arg2.toDouble()
| 0 | ||||||||||||||||||||||||||||||||||||
| 1547 | return never executed: -1;return -1;never executed: return -1; | 0 | ||||||||||||||||||||||||||||||||||||
| 1548 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 1549 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||||||||||||||||||||
| 1550 | } | - | ||||||||||||||||||||||||||||||||||||
| 1551 | case never executed: QVariant::Invalid:case QVariant::Invalid:never executed: case QVariant::Invalid: | 0 | ||||||||||||||||||||||||||||||||||||
| 1552 | if (arg2.type() == QVariant::Invalid
| 0 | ||||||||||||||||||||||||||||||||||||
| 1553 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||||||||||||||||||||
| 1554 | default never executed: :default:never executed: default:code before this statement never executed: default: | 0 | ||||||||||||||||||||||||||||||||||||
| 1555 | ((!(0)) ? qt_assert_x("QAbstractSpinBoxPrivate::variantCompare", QString(QString::fromLatin1("Internal error 3 (%1 %2)"). arg(QString::fromLatin1(arg1.typeName())). arg(QString::fromLatin1(arg2.typeName()))).toLocal8Bit().constData(), | - | ||||||||||||||||||||||||||||||||||||
| 1556 | - | |||||||||||||||||||||||||||||||||||||
| 1557 | - | |||||||||||||||||||||||||||||||||||||
| 1558 | __FILE__ | - | ||||||||||||||||||||||||||||||||||||
| 1559 | , | - | ||||||||||||||||||||||||||||||||||||
| 1560 | - | |||||||||||||||||||||||||||||||||||||
| 1561 | - | |||||||||||||||||||||||||||||||||||||
| 1562 | 2120 | - | ||||||||||||||||||||||||||||||||||||
| 1563 | ) : qt_noop()) | - | ||||||||||||||||||||||||||||||||||||
| 1564 | - | |||||||||||||||||||||||||||||||||||||
| 1565 | - | |||||||||||||||||||||||||||||||||||||
| 1566 | ; | - | ||||||||||||||||||||||||||||||||||||
| 1567 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||||||||
| 1568 | return never executed: -2;return -2;never executed: return -2; | 0 | ||||||||||||||||||||||||||||||||||||
| 1569 | } | - | ||||||||||||||||||||||||||||||||||||
| 1570 | - | |||||||||||||||||||||||||||||||||||||
| 1571 | QVariant QAbstractSpinBoxPrivate::variantBound(const QVariant &min, | - | ||||||||||||||||||||||||||||||||||||
| 1572 | const QVariant &value, | - | ||||||||||||||||||||||||||||||||||||
| 1573 | const QVariant &max) | - | ||||||||||||||||||||||||||||||||||||
| 1574 | { | - | ||||||||||||||||||||||||||||||||||||
| 1575 | ((!(variantCompare(min, max) <= 0)) ? qt_assert("variantCompare(min, max) <= 0",__FILE__,2129) : qt_noop()); | - | ||||||||||||||||||||||||||||||||||||
| 1576 | if (variantCompare(min, value) < 0
| 0 | ||||||||||||||||||||||||||||||||||||
| 1577 | const int compMax = variantCompare(value, max); | - | ||||||||||||||||||||||||||||||||||||
| 1578 | return never executed: (compMax < 0 ? value : max);return (compMax < 0 ? value : max);never executed: return (compMax < 0 ? value : max); | 0 | ||||||||||||||||||||||||||||||||||||
| 1579 | } else { | - | ||||||||||||||||||||||||||||||||||||
| 1580 | return never executed: min;return min;never executed: return min; | 0 | ||||||||||||||||||||||||||||||||||||
| 1581 | } | - | ||||||||||||||||||||||||||||||||||||
| 1582 | } | - | ||||||||||||||||||||||||||||||||||||
| 1583 | - | |||||||||||||||||||||||||||||||||||||
| 1584 | - | |||||||||||||||||||||||||||||||||||||
| 1585 | - | |||||||||||||||||||||||||||||||||||||
| 1586 | - | |||||||||||||||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |