| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/widgets/qspinbox.cpp | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||||||||
| 2 | - | |||||||||||||||||||||||||
| 3 | - | |||||||||||||||||||||||||
| 4 | - | |||||||||||||||||||||||||
| 5 | - | |||||||||||||||||||||||||
| 6 | - | |||||||||||||||||||||||||
| 7 | class QSpinBoxPrivate : public QAbstractSpinBoxPrivate | - | ||||||||||||||||||||||||
| 8 | { | - | ||||||||||||||||||||||||
| 9 | inline QSpinBox* q_func() { return static_cast<QSpinBox *>(q_ptr); } inline const QSpinBox* q_func() const { return static_cast<const QSpinBox *>(q_ptr); } friend class QSpinBox; | - | ||||||||||||||||||||||||
| 10 | public: | - | ||||||||||||||||||||||||
| 11 | QSpinBoxPrivate(); | - | ||||||||||||||||||||||||
| 12 | void emitSignals(EmitPolicy ep, const QVariant &) override; | - | ||||||||||||||||||||||||
| 13 | - | |||||||||||||||||||||||||
| 14 | virtual QVariant valueFromText(const QString &n) const override; | - | ||||||||||||||||||||||||
| 15 | virtual QString textFromValue(const QVariant &n) const override; | - | ||||||||||||||||||||||||
| 16 | QVariant validateAndInterpret(QString &input, int &pos, | - | ||||||||||||||||||||||||
| 17 | QValidator::State &state) const; | - | ||||||||||||||||||||||||
| 18 | - | |||||||||||||||||||||||||
| 19 | inline void init() { | - | ||||||||||||||||||||||||
| 20 | QSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||
| 21 | q->setInputMethodHints(Qt::ImhDigitsOnly); | - | ||||||||||||||||||||||||
| 22 | setLayoutItemMargins(QStyle::SE_SpinBoxLayoutItem); | - | ||||||||||||||||||||||||
| 23 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 24 | - | |||||||||||||||||||||||||
| 25 | int displayIntegerBase; | - | ||||||||||||||||||||||||
| 26 | }; | - | ||||||||||||||||||||||||
| 27 | - | |||||||||||||||||||||||||
| 28 | class QDoubleSpinBoxPrivate : public QAbstractSpinBoxPrivate | - | ||||||||||||||||||||||||
| 29 | { | - | ||||||||||||||||||||||||
| 30 | inline QDoubleSpinBox* q_func() { return static_cast<QDoubleSpinBox *>(q_ptr); } inline const QDoubleSpinBox* q_func() const { return static_cast<const QDoubleSpinBox *>(q_ptr); } friend class QDoubleSpinBox; | - | ||||||||||||||||||||||||
| 31 | public: | - | ||||||||||||||||||||||||
| 32 | QDoubleSpinBoxPrivate(); | - | ||||||||||||||||||||||||
| 33 | void emitSignals(EmitPolicy ep, const QVariant &) override; | - | ||||||||||||||||||||||||
| 34 | - | |||||||||||||||||||||||||
| 35 | virtual QVariant valueFromText(const QString &n) const override; | - | ||||||||||||||||||||||||
| 36 | virtual QString textFromValue(const QVariant &n) const override; | - | ||||||||||||||||||||||||
| 37 | QVariant validateAndInterpret(QString &input, int &pos, | - | ||||||||||||||||||||||||
| 38 | QValidator::State &state) const; | - | ||||||||||||||||||||||||
| 39 | double round(double input) const; | - | ||||||||||||||||||||||||
| 40 | - | |||||||||||||||||||||||||
| 41 | int decimals; | - | ||||||||||||||||||||||||
| 42 | - | |||||||||||||||||||||||||
| 43 | inline void init() { | - | ||||||||||||||||||||||||
| 44 | QDoubleSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||
| 45 | q->setInputMethodHints(Qt::ImhFormattedNumbersOnly); | - | ||||||||||||||||||||||||
| 46 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 47 | - | |||||||||||||||||||||||||
| 48 | - | |||||||||||||||||||||||||
| 49 | double actualMin; | - | ||||||||||||||||||||||||
| 50 | double actualMax; | - | ||||||||||||||||||||||||
| 51 | }; | - | ||||||||||||||||||||||||
| 52 | QSpinBox::QSpinBox(QWidget *parent) | - | ||||||||||||||||||||||||
| 53 | : QAbstractSpinBox(*new QSpinBoxPrivate, parent) | - | ||||||||||||||||||||||||
| 54 | { | - | ||||||||||||||||||||||||
| 55 | QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 56 | d->init(); | - | ||||||||||||||||||||||||
| 57 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 58 | - | |||||||||||||||||||||||||
| 59 | - | |||||||||||||||||||||||||
| 60 | - | |||||||||||||||||||||||||
| 61 | - | |||||||||||||||||||||||||
| 62 | QSpinBox::~QSpinBox() {} | - | ||||||||||||||||||||||||
| 63 | int QSpinBox::value() const | - | ||||||||||||||||||||||||
| 64 | { | - | ||||||||||||||||||||||||
| 65 | const QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 66 |     return never executed:   d->value.toInt();return d->value.toInt();never executed:  return d->value.toInt(); | 0 | ||||||||||||||||||||||||
| 67 | } | - | ||||||||||||||||||||||||
| 68 | - | |||||||||||||||||||||||||
| 69 | void QSpinBox::setValue(int value) | - | ||||||||||||||||||||||||
| 70 | { | - | ||||||||||||||||||||||||
| 71 | QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 72 | d->setValue(QVariant(value), EmitIfChanged); | - | ||||||||||||||||||||||||
| 73 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 74 | QString QSpinBox::prefix() const | - | ||||||||||||||||||||||||
| 75 | { | - | ||||||||||||||||||||||||
| 76 | const QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 77 |     return never executed:   d->prefix;return d->prefix;never executed:  return d->prefix; | 0 | ||||||||||||||||||||||||
| 78 | } | - | ||||||||||||||||||||||||
| 79 | - | |||||||||||||||||||||||||
| 80 | void QSpinBox::setPrefix(const QString &prefix) | - | ||||||||||||||||||||||||
| 81 | { | - | ||||||||||||||||||||||||
| 82 | QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 83 | - | |||||||||||||||||||||||||
| 84 | d->prefix = prefix; | - | ||||||||||||||||||||||||
| 85 | d->updateEdit(); | - | ||||||||||||||||||||||||
| 86 | - | |||||||||||||||||||||||||
| 87 | d->cachedSizeHint = QSize(); | - | ||||||||||||||||||||||||
| 88 | d->cachedMinimumSizeHint = QSize(); | - | ||||||||||||||||||||||||
| 89 | updateGeometry(); | - | ||||||||||||||||||||||||
| 90 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 91 | QString QSpinBox::suffix() const | - | ||||||||||||||||||||||||
| 92 | { | - | ||||||||||||||||||||||||
| 93 | const QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 94 | - | |||||||||||||||||||||||||
| 95 |     return never executed:   d->suffix;return d->suffix;never executed:  return d->suffix; | 0 | ||||||||||||||||||||||||
| 96 | } | - | ||||||||||||||||||||||||
| 97 | - | |||||||||||||||||||||||||
| 98 | void QSpinBox::setSuffix(const QString &suffix) | - | ||||||||||||||||||||||||
| 99 | { | - | ||||||||||||||||||||||||
| 100 | QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 101 | - | |||||||||||||||||||||||||
| 102 | d->suffix = suffix; | - | ||||||||||||||||||||||||
| 103 | d->updateEdit(); | - | ||||||||||||||||||||||||
| 104 | - | |||||||||||||||||||||||||
| 105 | d->cachedSizeHint = QSize(); | - | ||||||||||||||||||||||||
| 106 | updateGeometry(); | - | ||||||||||||||||||||||||
| 107 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 108 | QString QSpinBox::cleanText() const | - | ||||||||||||||||||||||||
| 109 | { | - | ||||||||||||||||||||||||
| 110 | const QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 111 | - | |||||||||||||||||||||||||
| 112 |     return never executed:   d->stripped(d->edit->displayText());return d->stripped(d->edit->displayText());never executed:  return d->stripped(d->edit->displayText()); | 0 | ||||||||||||||||||||||||
| 113 | } | - | ||||||||||||||||||||||||
| 114 | int QSpinBox::singleStep() const | - | ||||||||||||||||||||||||
| 115 | { | - | ||||||||||||||||||||||||
| 116 | const QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 117 | - | |||||||||||||||||||||||||
| 118 |     return never executed:   d->singleStep.toInt();return d->singleStep.toInt();never executed:  return d->singleStep.toInt(); | 0 | ||||||||||||||||||||||||
| 119 | } | - | ||||||||||||||||||||||||
| 120 | - | |||||||||||||||||||||||||
| 121 | void QSpinBox::setSingleStep(int value) | - | ||||||||||||||||||||||||
| 122 | { | - | ||||||||||||||||||||||||
| 123 | QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 124 |     if (value >= 0
  | 0 | ||||||||||||||||||||||||
| 125 | d->singleStep = QVariant(value); | - | ||||||||||||||||||||||||
| 126 | d->updateEdit(); | - | ||||||||||||||||||||||||
| 127 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 128 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 129 | int QSpinBox::minimum() const | - | ||||||||||||||||||||||||
| 130 | { | - | ||||||||||||||||||||||||
| 131 | const QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 132 | - | |||||||||||||||||||||||||
| 133 |     return never executed:   d->minimum.toInt();return d->minimum.toInt();never executed:  return d->minimum.toInt(); | 0 | ||||||||||||||||||||||||
| 134 | } | - | ||||||||||||||||||||||||
| 135 | - | |||||||||||||||||||||||||
| 136 | void QSpinBox::setMinimum(int minimum) | - | ||||||||||||||||||||||||
| 137 | { | - | ||||||||||||||||||||||||
| 138 | QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 139 | const QVariant m(minimum); | - | ||||||||||||||||||||||||
| 140 | d->setRange(m, (d->variantCompare(d->maximum, m) > 0 ? d->maximum : m)); | - | ||||||||||||||||||||||||
| 141 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 142 | int QSpinBox::maximum() const | - | ||||||||||||||||||||||||
| 143 | { | - | ||||||||||||||||||||||||
| 144 | const QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 145 | - | |||||||||||||||||||||||||
| 146 |     return never executed:   d->maximum.toInt();return d->maximum.toInt();never executed:  return d->maximum.toInt(); | 0 | ||||||||||||||||||||||||
| 147 | } | - | ||||||||||||||||||||||||
| 148 | - | |||||||||||||||||||||||||
| 149 | void QSpinBox::setMaximum(int maximum) | - | ||||||||||||||||||||||||
| 150 | { | - | ||||||||||||||||||||||||
| 151 | QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 152 | const QVariant m(maximum); | - | ||||||||||||||||||||||||
| 153 | d->setRange((d->variantCompare(d->minimum, m) < 0 ? d->minimum : m), m); | - | ||||||||||||||||||||||||
| 154 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 155 | void QSpinBox::setRange(int minimum, int maximum) | - | ||||||||||||||||||||||||
| 156 | { | - | ||||||||||||||||||||||||
| 157 | QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 158 | d->setRange(QVariant(minimum), QVariant(maximum)); | - | ||||||||||||||||||||||||
| 159 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 160 | int QSpinBox::displayIntegerBase() const | - | ||||||||||||||||||||||||
| 161 | { | - | ||||||||||||||||||||||||
| 162 | const QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 163 |     return never executed:   d->displayIntegerBase;return d->displayIntegerBase;never executed:  return d->displayIntegerBase; | 0 | ||||||||||||||||||||||||
| 164 | } | - | ||||||||||||||||||||||||
| 165 | - | |||||||||||||||||||||||||
| 166 | void QSpinBox::setDisplayIntegerBase(int base) | - | ||||||||||||||||||||||||
| 167 | { | - | ||||||||||||||||||||||||
| 168 | QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 169 | - | |||||||||||||||||||||||||
| 170 |     if (base < 2
 
  | 0 | ||||||||||||||||||||||||
| 171 | QMessageLogger(__FILE__, 442, __PRETTY_FUNCTION__).warning("QSpinBox::setDisplayIntegerBase: Invalid base (%d)", base); | - | ||||||||||||||||||||||||
| 172 | base = 10; | - | ||||||||||||||||||||||||
| 173 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 174 | - | |||||||||||||||||||||||||
| 175 |     if (base != d->displayIntegerBase
  | 0 | ||||||||||||||||||||||||
| 176 | d->displayIntegerBase = base; | - | ||||||||||||||||||||||||
| 177 | d->updateEdit(); | - | ||||||||||||||||||||||||
| 178 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 179 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 180 | QString QSpinBox::textFromValue(int value) const | - | ||||||||||||||||||||||||
| 181 | { | - | ||||||||||||||||||||||||
| 182 | const QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 183 | QString str; | - | ||||||||||||||||||||||||
| 184 | - | |||||||||||||||||||||||||
| 185 |     if (d->displayIntegerBase != 10
  | 0 | ||||||||||||||||||||||||
| 186 | str = QString::number(qAbs(value), d->displayIntegerBase); | - | ||||||||||||||||||||||||
| 187 |         if (value < 0
  | 0 | ||||||||||||||||||||||||
| 188 |             str.prepend('-'); never executed:  str.prepend('-'); | 0 | ||||||||||||||||||||||||
| 189 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 190 | str = locale().toString(value); | - | ||||||||||||||||||||||||
| 191 |         if (!d->showGroupSeparator
 
 
  | 0 | ||||||||||||||||||||||||
| 192 | str.remove(locale().groupSeparator()); | - | ||||||||||||||||||||||||
| 193 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 194 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||
| 196 |     return never executed:   str;return str;never executed:  return str; | 0 | ||||||||||||||||||||||||
| 197 | } | - | ||||||||||||||||||||||||
| 198 | int QSpinBox::valueFromText(const QString &text) const | - | ||||||||||||||||||||||||
| 199 | { | - | ||||||||||||||||||||||||
| 200 | const QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 201 | - | |||||||||||||||||||||||||
| 202 | QString copy = text; | - | ||||||||||||||||||||||||
| 203 | int pos = d->edit->cursorPosition(); | - | ||||||||||||||||||||||||
| 204 | QValidator::State state = QValidator::Acceptable; | - | ||||||||||||||||||||||||
| 205 |     return never executed:   d->validateAndInterpret(copy, pos, state).toInt();return d->validateAndInterpret(copy, pos, state).toInt();never executed:  return d->validateAndInterpret(copy, pos, state).toInt(); | 0 | ||||||||||||||||||||||||
| 206 | } | - | ||||||||||||||||||||||||
| 207 | - | |||||||||||||||||||||||||
| 208 | - | |||||||||||||||||||||||||
| 209 | - | |||||||||||||||||||||||||
| 210 | - | |||||||||||||||||||||||||
| 211 | QValidator::State QSpinBox::validate(QString &text, int &pos) const | - | ||||||||||||||||||||||||
| 212 | { | - | ||||||||||||||||||||||||
| 213 | const QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 214 | - | |||||||||||||||||||||||||
| 215 | QValidator::State state; | - | ||||||||||||||||||||||||
| 216 | d->validateAndInterpret(text, pos, state); | - | ||||||||||||||||||||||||
| 217 |     return never executed:   state;return state;never executed:  return state; | 0 | ||||||||||||||||||||||||
| 218 | } | - | ||||||||||||||||||||||||
| 219 | - | |||||||||||||||||||||||||
| 220 | - | |||||||||||||||||||||||||
| 221 | - | |||||||||||||||||||||||||
| 222 | - | |||||||||||||||||||||||||
| 223 | - | |||||||||||||||||||||||||
| 224 | void QSpinBox::fixup(QString &input) const | - | ||||||||||||||||||||||||
| 225 | { | - | ||||||||||||||||||||||||
| 226 |     if (!isGroupSeparatorShown()
  | 0 | ||||||||||||||||||||||||
| 227 |         input.remove(locale().groupSeparator()); never executed:  input.remove(locale().groupSeparator()); | 0 | ||||||||||||||||||||||||
| 228 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 229 | QDoubleSpinBox::QDoubleSpinBox(QWidget *parent) | - | ||||||||||||||||||||||||
| 230 | : QAbstractSpinBox(*new QDoubleSpinBoxPrivate, parent) | - | ||||||||||||||||||||||||
| 231 | { | - | ||||||||||||||||||||||||
| 232 | QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 233 | d->init(); | - | ||||||||||||||||||||||||
| 234 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 235 | - | |||||||||||||||||||||||||
| 236 | - | |||||||||||||||||||||||||
| 237 | - | |||||||||||||||||||||||||
| 238 | - | |||||||||||||||||||||||||
| 239 | QDoubleSpinBox::~QDoubleSpinBox() {} | - | ||||||||||||||||||||||||
| 240 | double QDoubleSpinBox::value() const | - | ||||||||||||||||||||||||
| 241 | { | - | ||||||||||||||||||||||||
| 242 | const QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 243 | - | |||||||||||||||||||||||||
| 244 |     return never executed:   d->value.toDouble();return d->value.toDouble();never executed:  return d->value.toDouble(); | 0 | ||||||||||||||||||||||||
| 245 | } | - | ||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||
| 247 | void QDoubleSpinBox::setValue(double value) | - | ||||||||||||||||||||||||
| 248 | { | - | ||||||||||||||||||||||||
| 249 | QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 250 | QVariant v(d->round(value)); | - | ||||||||||||||||||||||||
| 251 | d->setValue(v, EmitIfChanged); | - | ||||||||||||||||||||||||
| 252 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 253 | QString QDoubleSpinBox::prefix() const | - | ||||||||||||||||||||||||
| 254 | { | - | ||||||||||||||||||||||||
| 255 | const QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 256 | - | |||||||||||||||||||||||||
| 257 |     return never executed:   d->prefix;return d->prefix;never executed:  return d->prefix; | 0 | ||||||||||||||||||||||||
| 258 | } | - | ||||||||||||||||||||||||
| 259 | - | |||||||||||||||||||||||||
| 260 | void QDoubleSpinBox::setPrefix(const QString &prefix) | - | ||||||||||||||||||||||||
| 261 | { | - | ||||||||||||||||||||||||
| 262 | QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 263 | - | |||||||||||||||||||||||||
| 264 | d->prefix = prefix; | - | ||||||||||||||||||||||||
| 265 | d->updateEdit(); | - | ||||||||||||||||||||||||
| 266 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 267 | QString QDoubleSpinBox::suffix() const | - | ||||||||||||||||||||||||
| 268 | { | - | ||||||||||||||||||||||||
| 269 | const QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 270 | - | |||||||||||||||||||||||||
| 271 |     return never executed:   d->suffix;return d->suffix;never executed:  return d->suffix; | 0 | ||||||||||||||||||||||||
| 272 | } | - | ||||||||||||||||||||||||
| 273 | - | |||||||||||||||||||||||||
| 274 | void QDoubleSpinBox::setSuffix(const QString &suffix) | - | ||||||||||||||||||||||||
| 275 | { | - | ||||||||||||||||||||||||
| 276 | QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 277 | - | |||||||||||||||||||||||||
| 278 | d->suffix = suffix; | - | ||||||||||||||||||||||||
| 279 | d->updateEdit(); | - | ||||||||||||||||||||||||
| 280 | - | |||||||||||||||||||||||||
| 281 | d->cachedSizeHint = QSize(); | - | ||||||||||||||||||||||||
| 282 | updateGeometry(); | - | ||||||||||||||||||||||||
| 283 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 284 | QString QDoubleSpinBox::cleanText() const | - | ||||||||||||||||||||||||
| 285 | { | - | ||||||||||||||||||||||||
| 286 | const QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 287 | - | |||||||||||||||||||||||||
| 288 |     return never executed:   d->stripped(d->edit->displayText());return d->stripped(d->edit->displayText());never executed:  return d->stripped(d->edit->displayText()); | 0 | ||||||||||||||||||||||||
| 289 | } | - | ||||||||||||||||||||||||
| 290 | double QDoubleSpinBox::singleStep() const | - | ||||||||||||||||||||||||
| 291 | { | - | ||||||||||||||||||||||||
| 292 | const QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 293 | - | |||||||||||||||||||||||||
| 294 |     return never executed:   d->singleStep.toDouble();return d->singleStep.toDouble();never executed:  return d->singleStep.toDouble(); | 0 | ||||||||||||||||||||||||
| 295 | } | - | ||||||||||||||||||||||||
| 296 | - | |||||||||||||||||||||||||
| 297 | void QDoubleSpinBox::setSingleStep(double value) | - | ||||||||||||||||||||||||
| 298 | { | - | ||||||||||||||||||||||||
| 299 | QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 300 | - | |||||||||||||||||||||||||
| 301 |     if (value >= 0
  | 0 | ||||||||||||||||||||||||
| 302 | d->singleStep = value; | - | ||||||||||||||||||||||||
| 303 | d->updateEdit(); | - | ||||||||||||||||||||||||
| 304 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 305 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 306 | double QDoubleSpinBox::minimum() const | - | ||||||||||||||||||||||||
| 307 | { | - | ||||||||||||||||||||||||
| 308 | const QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 309 | - | |||||||||||||||||||||||||
| 310 |     return never executed:   d->minimum.toDouble();return d->minimum.toDouble();never executed:  return d->minimum.toDouble(); | 0 | ||||||||||||||||||||||||
| 311 | } | - | ||||||||||||||||||||||||
| 312 | - | |||||||||||||||||||||||||
| 313 | void QDoubleSpinBox::setMinimum(double minimum) | - | ||||||||||||||||||||||||
| 314 | { | - | ||||||||||||||||||||||||
| 315 | QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 316 | d->actualMin = minimum; | - | ||||||||||||||||||||||||
| 317 | const QVariant m(d->round(minimum)); | - | ||||||||||||||||||||||||
| 318 | d->setRange(m, (d->variantCompare(d->maximum, m) > 0 ? d->maximum : m)); | - | ||||||||||||||||||||||||
| 319 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 320 | double QDoubleSpinBox::maximum() const | - | ||||||||||||||||||||||||
| 321 | { | - | ||||||||||||||||||||||||
| 322 | const QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 323 | - | |||||||||||||||||||||||||
| 324 |     return never executed:   d->maximum.toDouble();return d->maximum.toDouble();never executed:  return d->maximum.toDouble(); | 0 | ||||||||||||||||||||||||
| 325 | } | - | ||||||||||||||||||||||||
| 326 | - | |||||||||||||||||||||||||
| 327 | void QDoubleSpinBox::setMaximum(double maximum) | - | ||||||||||||||||||||||||
| 328 | { | - | ||||||||||||||||||||||||
| 329 | QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 330 | d->actualMax = maximum; | - | ||||||||||||||||||||||||
| 331 | const QVariant m(d->round(maximum)); | - | ||||||||||||||||||||||||
| 332 | d->setRange((d->variantCompare(d->minimum, m) < 0 ? d->minimum : m), m); | - | ||||||||||||||||||||||||
| 333 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 334 | void QDoubleSpinBox::setRange(double minimum, double maximum) | - | ||||||||||||||||||||||||
| 335 | { | - | ||||||||||||||||||||||||
| 336 | QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 337 | d->actualMin = minimum; | - | ||||||||||||||||||||||||
| 338 | d->actualMax = maximum; | - | ||||||||||||||||||||||||
| 339 | d->setRange(QVariant(d->round(minimum)), QVariant(d->round(maximum))); | - | ||||||||||||||||||||||||
| 340 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 341 | int QDoubleSpinBox::decimals() const | - | ||||||||||||||||||||||||
| 342 | { | - | ||||||||||||||||||||||||
| 343 | const QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 344 | - | |||||||||||||||||||||||||
| 345 |     return never executed:   d->decimals;return d->decimals;never executed:  return d->decimals; | 0 | ||||||||||||||||||||||||
| 346 | } | - | ||||||||||||||||||||||||
| 347 | - | |||||||||||||||||||||||||
| 348 | void QDoubleSpinBox::setDecimals(int decimals) | - | ||||||||||||||||||||||||
| 349 | { | - | ||||||||||||||||||||||||
| 350 | QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 351 | d->decimals = qBound(0, decimals, 308 + 15); | - | ||||||||||||||||||||||||
| 352 | - | |||||||||||||||||||||||||
| 353 | setRange(d->actualMin, d->actualMax); | - | ||||||||||||||||||||||||
| 354 | setValue(value()); | - | ||||||||||||||||||||||||
| 355 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 356 | QString QDoubleSpinBox::textFromValue(double value) const | - | ||||||||||||||||||||||||
| 357 | { | - | ||||||||||||||||||||||||
| 358 | const QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 359 | QString str = locale().toString(value, 'f', d->decimals); | - | ||||||||||||||||||||||||
| 360 |     if (!d->showGroupSeparator
 
  | 0 | ||||||||||||||||||||||||
| 361 |         str.remove(locale().groupSeparator()); never executed:  str.remove(locale().groupSeparator()); | 0 | ||||||||||||||||||||||||
| 362 | - | |||||||||||||||||||||||||
| 363 |     return never executed:   str;return str;never executed:  return str; | 0 | ||||||||||||||||||||||||
| 364 | } | - | ||||||||||||||||||||||||
| 365 | double QDoubleSpinBox::valueFromText(const QString &text) const | - | ||||||||||||||||||||||||
| 366 | { | - | ||||||||||||||||||||||||
| 367 | const QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 368 | - | |||||||||||||||||||||||||
| 369 | QString copy = text; | - | ||||||||||||||||||||||||
| 370 | int pos = d->edit->cursorPosition(); | - | ||||||||||||||||||||||||
| 371 | QValidator::State state = QValidator::Acceptable; | - | ||||||||||||||||||||||||
| 372 |     return never executed:   d->validateAndInterpret(copy, pos, state).toDouble();return d->validateAndInterpret(copy, pos, state).toDouble();never executed:  return d->validateAndInterpret(copy, pos, state).toDouble(); | 0 | ||||||||||||||||||||||||
| 373 | } | - | ||||||||||||||||||||||||
| 374 | - | |||||||||||||||||||||||||
| 375 | - | |||||||||||||||||||||||||
| 376 | - | |||||||||||||||||||||||||
| 377 | - | |||||||||||||||||||||||||
| 378 | QValidator::State QDoubleSpinBox::validate(QString &text, int &pos) const | - | ||||||||||||||||||||||||
| 379 | { | - | ||||||||||||||||||||||||
| 380 | const QDoubleSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 381 | - | |||||||||||||||||||||||||
| 382 | QValidator::State state; | - | ||||||||||||||||||||||||
| 383 | d->validateAndInterpret(text, pos, state); | - | ||||||||||||||||||||||||
| 384 |     return never executed:   state;return state;never executed:  return state; | 0 | ||||||||||||||||||||||||
| 385 | } | - | ||||||||||||||||||||||||
| 386 | - | |||||||||||||||||||||||||
| 387 | - | |||||||||||||||||||||||||
| 388 | - | |||||||||||||||||||||||||
| 389 | - | |||||||||||||||||||||||||
| 390 | - | |||||||||||||||||||||||||
| 391 | void QDoubleSpinBox::fixup(QString &input) const | - | ||||||||||||||||||||||||
| 392 | { | - | ||||||||||||||||||||||||
| 393 | input.remove(locale().groupSeparator()); | - | ||||||||||||||||||||||||
| 394 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 395 | QSpinBoxPrivate::QSpinBoxPrivate() | - | ||||||||||||||||||||||||
| 396 | { | - | ||||||||||||||||||||||||
| 397 | minimum = QVariant((int)0); | - | ||||||||||||||||||||||||
| 398 | maximum = QVariant((int)99); | - | ||||||||||||||||||||||||
| 399 | value = minimum; | - | ||||||||||||||||||||||||
| 400 | displayIntegerBase = 10; | - | ||||||||||||||||||||||||
| 401 | singleStep = QVariant((int)1); | - | ||||||||||||||||||||||||
| 402 | type = QVariant::Int; | - | ||||||||||||||||||||||||
| 403 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 404 | - | |||||||||||||||||||||||||
| 405 | - | |||||||||||||||||||||||||
| 406 | - | |||||||||||||||||||||||||
| 407 | - | |||||||||||||||||||||||||
| 408 | - | |||||||||||||||||||||||||
| 409 | - | |||||||||||||||||||||||||
| 410 | void QSpinBoxPrivate::emitSignals(EmitPolicy ep, const QVariant &old) | - | ||||||||||||||||||||||||
| 411 | { | - | ||||||||||||||||||||||||
| 412 | QSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||
| 413 |     if (ep != NeverEmit
  | 0 | ||||||||||||||||||||||||
| 414 | pendingEmit = false; | - | ||||||||||||||||||||||||
| 415 |         if (ep == AlwaysEmit
 
  | 0 | ||||||||||||||||||||||||
| 416 | q->valueChanged(edit->displayText()); | - | ||||||||||||||||||||||||
| 417 | q->valueChanged(value.toInt()); | - | ||||||||||||||||||||||||
| 418 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 419 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 420 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 421 | - | |||||||||||||||||||||||||
| 422 | - | |||||||||||||||||||||||||
| 423 | - | |||||||||||||||||||||||||
| 424 | - | |||||||||||||||||||||||||
| 425 | - | |||||||||||||||||||||||||
| 426 | - | |||||||||||||||||||||||||
| 427 | QString QSpinBoxPrivate::textFromValue(const QVariant &value) const | - | ||||||||||||||||||||||||
| 428 | { | - | ||||||||||||||||||||||||
| 429 | const QSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||
| 430 |     return never executed:   q->textFromValue(value.toInt());return q->textFromValue(value.toInt());never executed:  return q->textFromValue(value.toInt()); | 0 | ||||||||||||||||||||||||
| 431 | } | - | ||||||||||||||||||||||||
| 432 | - | |||||||||||||||||||||||||
| 433 | - | |||||||||||||||||||||||||
| 434 | - | |||||||||||||||||||||||||
| 435 | - | |||||||||||||||||||||||||
| 436 | - | |||||||||||||||||||||||||
| 437 | QVariant QSpinBoxPrivate::valueFromText(const QString &text) const | - | ||||||||||||||||||||||||
| 438 | { | - | ||||||||||||||||||||||||
| 439 | const QSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||
| 440 | - | |||||||||||||||||||||||||
| 441 |     return never executed:   QVariant(q->valueFromText(text));return QVariant(q->valueFromText(text));never executed:  return QVariant(q->valueFromText(text)); | 0 | ||||||||||||||||||||||||
| 442 | } | - | ||||||||||||||||||||||||
| 443 | QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, | - | ||||||||||||||||||||||||
| 444 | QValidator::State &state) const | - | ||||||||||||||||||||||||
| 445 | { | - | ||||||||||||||||||||||||
| 446 |     if (cachedText == input
 
  | 0 | ||||||||||||||||||||||||
| 447 | state = cachedState; | - | ||||||||||||||||||||||||
| 448 |         if (false) QMessageLogger(__FILE__, 1024, __PRETTY_FUNCTION__).debug() << "cachedText was '" << cachedText << "' state was " dead code:  QMessageLogger(__FILE__, 1024, __PRETTY_FUNCTION__).debug() << "cachedText was '" << cachedText << "' state was " << state << " and value was " << cachedValue; | - | ||||||||||||||||||||||||
| 449 |                    << state << " and value was " << cachedValue; dead code:  QMessageLogger(__FILE__, 1024, __PRETTY_FUNCTION__).debug() << "cachedText was '" << cachedText << "' state was " << state << " and value was " << cachedValue; | - | ||||||||||||||||||||||||
| 450 | - | |||||||||||||||||||||||||
| 451 |         return never executed:   cachedValue;return cachedValue;never executed:  return cachedValue; | 0 | ||||||||||||||||||||||||
| 452 | } | - | ||||||||||||||||||||||||
| 453 | const int max = maximum.toInt(); | - | ||||||||||||||||||||||||
| 454 | const int min = minimum.toInt(); | - | ||||||||||||||||||||||||
| 455 | - | |||||||||||||||||||||||||
| 456 | QString copy = stripped(input, &pos); | - | ||||||||||||||||||||||||
| 457 |     if (false) QMessageLogger(__FILE__, 1033, __PRETTY_FUNCTION__).debug() << "input" << input << "copy" << copy; dead code:  QMessageLogger(__FILE__, 1033, __PRETTY_FUNCTION__).debug() << "input" << input << "copy" << copy; | - | ||||||||||||||||||||||||
| 458 | state = QValidator::Acceptable; | - | ||||||||||||||||||||||||
| 459 | int num = min; | - | ||||||||||||||||||||||||
| 460 | - | |||||||||||||||||||||||||
| 461 |     if (max != min
 
  | 0 | ||||||||||||||||||||||||
| 462 |                        || (min < 0
 
  | 0 | ||||||||||||||||||||||||
| 463 |                        || (max >= 0
 
  | 0 | ||||||||||||||||||||||||
| 464 | state = QValidator::Intermediate; | - | ||||||||||||||||||||||||
| 465 |         if (false) QMessageLogger(__FILE__, 1041, __PRETTY_FUNCTION__).debug() << __FILE__ << 1041<< "num is set to" << num; dead code:  QMessageLogger(__FILE__, 1041, __PRETTY_FUNCTION__).debug() << __FILE__ << 1041<< "num is set to" << num; | - | ||||||||||||||||||||||||
| 466 |     } never executed:   else if (copy.startsWith(QLatin1Char('-'))end of block
 
  | 0 | ||||||||||||||||||||||||
| 467 | state = QValidator::Invalid; | - | ||||||||||||||||||||||||
| 468 |     } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 469 | bool ok = false; | - | ||||||||||||||||||||||||
| 470 |         if (displayIntegerBase != 10
  | 0 | ||||||||||||||||||||||||
| 471 | num = copy.toInt(&ok, displayIntegerBase); | - | ||||||||||||||||||||||||
| 472 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 473 | num = locale.toInt(copy, &ok); | - | ||||||||||||||||||||||||
| 474 |             if (!ok
 
 
 
  | 0 | ||||||||||||||||||||||||
| 475 | QString copy2 = copy; | - | ||||||||||||||||||||||||
| 476 | copy2.remove(locale.groupSeparator()); | - | ||||||||||||||||||||||||
| 477 | num = locale.toInt(copy2, &ok); | - | ||||||||||||||||||||||||
| 478 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 479 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 480 |         if (false) QMessageLogger(__FILE__, 1056, __PRETTY_FUNCTION__).debug() << __FILE__ << 1056<< "num is set to" << num; dead code:  QMessageLogger(__FILE__, 1056, __PRETTY_FUNCTION__).debug() << __FILE__ << 1056<< "num is set to" << num; | - | ||||||||||||||||||||||||
| 481 |         if (!ok
  | 0 | ||||||||||||||||||||||||
| 482 | state = QValidator::Invalid; | - | ||||||||||||||||||||||||
| 483 |         } never executed:   else if (num >= minend of block
 
  | 0 | ||||||||||||||||||||||||
| 484 | state = QValidator::Acceptable; | - | ||||||||||||||||||||||||
| 485 |         } never executed:   else if (max == minend of block
  | 0 | ||||||||||||||||||||||||
| 486 | state = QValidator::Invalid; | - | ||||||||||||||||||||||||
| 487 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 488 |             if ((num >= 0
 
 
 
  | 0 | ||||||||||||||||||||||||
| 489 | state = QValidator::Invalid; | - | ||||||||||||||||||||||||
| 490 |                 if (false) QMessageLogger(__FILE__, 1066, __PRETTY_FUNCTION__).debug() << __FILE__ << 1066<< "state is set to Invalid"; dead code:  QMessageLogger(__FILE__, 1066, __PRETTY_FUNCTION__).debug() << __FILE__ << 1066<< "state is set to Invalid"; | - | ||||||||||||||||||||||||
| 491 |             } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 492 | state = QValidator::Intermediate; | - | ||||||||||||||||||||||||
| 493 |                 if (false) QMessageLogger(__FILE__, 1069, __PRETTY_FUNCTION__).debug() << __FILE__ << 1069<< "state is set to Intermediate"; dead code:  QMessageLogger(__FILE__, 1069, __PRETTY_FUNCTION__).debug() << __FILE__ << 1069<< "state is set to Intermediate"; | - | ||||||||||||||||||||||||
| 494 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 495 | } | - | ||||||||||||||||||||||||
| 496 | } | - | ||||||||||||||||||||||||
| 497 |     if (state != QValidator::Acceptable
  | 0 | ||||||||||||||||||||||||
| 498 |         num = max > 0
 never executed:  num = max > 0 ? min : max; | 0 | ||||||||||||||||||||||||
| 499 | input = prefix + copy + suffix; | - | ||||||||||||||||||||||||
| 500 | cachedText = input; | - | ||||||||||||||||||||||||
| 501 | cachedState = state; | - | ||||||||||||||||||||||||
| 502 | cachedValue = QVariant((int)num); | - | ||||||||||||||||||||||||
| 503 | - | |||||||||||||||||||||||||
| 504 |     if (false) QMessageLogger(__FILE__, 1080, __PRETTY_FUNCTION__).debug() << "cachedText is set to '" << cachedText << "' state is set to " dead code:  QMessageLogger(__FILE__, 1080, __PRETTY_FUNCTION__).debug() << "cachedText is set to '" << cachedText << "' state is set to " << state << " and value is set to " << cachedValue; | - | ||||||||||||||||||||||||
| 505 |                << state << " and value is set to " << cachedValue; dead code:  QMessageLogger(__FILE__, 1080, __PRETTY_FUNCTION__).debug() << "cachedText is set to '" << cachedText << "' state is set to " << state << " and value is set to " << cachedValue; | - | ||||||||||||||||||||||||
| 506 |     return never executed:   cachedValue;return cachedValue;never executed:  return cachedValue; | 0 | ||||||||||||||||||||||||
| 507 | } | - | ||||||||||||||||||||||||
| 508 | QDoubleSpinBoxPrivate::QDoubleSpinBoxPrivate() | - | ||||||||||||||||||||||||
| 509 | { | - | ||||||||||||||||||||||||
| 510 | actualMin = 0.0; | - | ||||||||||||||||||||||||
| 511 | actualMax = 99.99; | - | ||||||||||||||||||||||||
| 512 | minimum = QVariant(actualMin); | - | ||||||||||||||||||||||||
| 513 | maximum = QVariant(actualMax); | - | ||||||||||||||||||||||||
| 514 | value = minimum; | - | ||||||||||||||||||||||||
| 515 | singleStep = QVariant(1.0); | - | ||||||||||||||||||||||||
| 516 | decimals = 2; | - | ||||||||||||||||||||||||
| 517 | type = QVariant::Double; | - | ||||||||||||||||||||||||
| 518 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 519 | - | |||||||||||||||||||||||||
| 520 | - | |||||||||||||||||||||||||
| 521 | - | |||||||||||||||||||||||||
| 522 | - | |||||||||||||||||||||||||
| 523 | - | |||||||||||||||||||||||||
| 524 | - | |||||||||||||||||||||||||
| 525 | void QDoubleSpinBoxPrivate::emitSignals(EmitPolicy ep, const QVariant &old) | - | ||||||||||||||||||||||||
| 526 | { | - | ||||||||||||||||||||||||
| 527 | QDoubleSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||
| 528 |     if (ep != NeverEmit
  | 0 | ||||||||||||||||||||||||
| 529 | pendingEmit = false; | - | ||||||||||||||||||||||||
| 530 |         if (ep == AlwaysEmit
 
  | 0 | ||||||||||||||||||||||||
| 531 | q->valueChanged(edit->displayText()); | - | ||||||||||||||||||||||||
| 532 | q->valueChanged(value.toDouble()); | - | ||||||||||||||||||||||||
| 533 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 534 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 535 | } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 536 | - | |||||||||||||||||||||||||
| 537 | - | |||||||||||||||||||||||||
| 538 | - | |||||||||||||||||||||||||
| 539 | - | |||||||||||||||||||||||||
| 540 | - | |||||||||||||||||||||||||
| 541 | - | |||||||||||||||||||||||||
| 542 | QVariant QDoubleSpinBoxPrivate::valueFromText(const QString &f) const | - | ||||||||||||||||||||||||
| 543 | { | - | ||||||||||||||||||||||||
| 544 | const QDoubleSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||
| 545 |     return never executed:   QVariant(q->valueFromText(f));return QVariant(q->valueFromText(f));never executed:  return QVariant(q->valueFromText(f)); | 0 | ||||||||||||||||||||||||
| 546 | } | - | ||||||||||||||||||||||||
| 547 | double QDoubleSpinBoxPrivate::round(double value) const | - | ||||||||||||||||||||||||
| 548 | { | - | ||||||||||||||||||||||||
| 549 |     return never executed:   QString::number(value, 'f', decimals).toDouble();return QString::number(value, 'f', decimals).toDouble();never executed:  return QString::number(value, 'f', decimals).toDouble(); | 0 | ||||||||||||||||||||||||
| 550 | } | - | ||||||||||||||||||||||||
| 551 | QVariant QDoubleSpinBoxPrivate::validateAndInterpret(QString &input, int &pos, | - | ||||||||||||||||||||||||
| 552 | QValidator::State &state) const | - | ||||||||||||||||||||||||
| 553 | { | - | ||||||||||||||||||||||||
| 554 |     if (cachedText == input
 
  | 0 | ||||||||||||||||||||||||
| 555 | state = cachedState; | - | ||||||||||||||||||||||||
| 556 |         if (false) QMessageLogger(__FILE__, 1157, __PRETTY_FUNCTION__).debug() << "cachedText was '" << cachedText << "' state was " dead code:  QMessageLogger(__FILE__, 1157, __PRETTY_FUNCTION__).debug() << "cachedText was '" << cachedText << "' state was " << state << " and value was " << cachedValue; | - | ||||||||||||||||||||||||
| 557 |                    << state << " and value was " << cachedValue; dead code:  QMessageLogger(__FILE__, 1157, __PRETTY_FUNCTION__).debug() << "cachedText was '" << cachedText << "' state was " << state << " and value was " << cachedValue; | - | ||||||||||||||||||||||||
| 558 |         return never executed:   cachedValue;return cachedValue;never executed:  return cachedValue; | 0 | ||||||||||||||||||||||||
| 559 | } | - | ||||||||||||||||||||||||
| 560 | const double max = maximum.toDouble(); | - | ||||||||||||||||||||||||
| 561 | const double min = minimum.toDouble(); | - | ||||||||||||||||||||||||
| 562 | - | |||||||||||||||||||||||||
| 563 | QString copy = stripped(input, &pos); | - | ||||||||||||||||||||||||
| 564 |     if (false) QMessageLogger(__FILE__, 1165, __PRETTY_FUNCTION__).debug() << "input" << input << "copy" << copy; dead code:  QMessageLogger(__FILE__, 1165, __PRETTY_FUNCTION__).debug() << "input" << input << "copy" << copy; | - | ||||||||||||||||||||||||
| 565 | int len = copy.size(); | - | ||||||||||||||||||||||||
| 566 | double num = min; | - | ||||||||||||||||||||||||
| 567 | const bool plus = max >= 0; | - | ||||||||||||||||||||||||
| 568 | const bool minus = min <= 0; | - | ||||||||||||||||||||||||
| 569 | - | |||||||||||||||||||||||||
| 570 | switch (len) { | - | ||||||||||||||||||||||||
| 571 |     case never executed:   0:case 0:never executed:  case 0: | 0 | ||||||||||||||||||||||||
| 572 |         state = max != min
  | 0 | ||||||||||||||||||||||||
| 573 |         goto never executed:   end;goto end;never executed:  goto end; | 0 | ||||||||||||||||||||||||
| 574 |     case never executed:   1:case 1:never executed:  case 1: | 0 | ||||||||||||||||||||||||
| 575 |         if (copy.at(0) == locale.decimalPoint()
  | 0 | ||||||||||||||||||||||||
| 576 |             || (plus
 
  | 0 | ||||||||||||||||||||||||
| 577 |             || (minus
 
  | 0 | ||||||||||||||||||||||||
| 578 | state = QValidator::Intermediate; | - | ||||||||||||||||||||||||
| 579 |             goto never executed:   end;goto end;never executed:  goto end; | 0 | ||||||||||||||||||||||||
| 580 | } | - | ||||||||||||||||||||||||
| 581 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 582 |     case never executed:   2:case 2:never executed:  case 2: | 0 | ||||||||||||||||||||||||
| 583 |         if (copy.at(1) == locale.decimalPoint()
  | 0 | ||||||||||||||||||||||||
| 584 |             && ((plus
 
 
 
  | 0 | ||||||||||||||||||||||||
| 585 | state = QValidator::Intermediate; | - | ||||||||||||||||||||||||
| 586 |             goto never executed:   end;goto end;never executed:  goto end; | 0 | ||||||||||||||||||||||||
| 587 | } | - | ||||||||||||||||||||||||
| 588 |         break; never executed:  break; | 0 | ||||||||||||||||||||||||
| 589 |     default never executed:  :default:never executed:   break;default:never executed:  break; | 0 | ||||||||||||||||||||||||
| 590 | } | - | ||||||||||||||||||||||||
| 591 | - | |||||||||||||||||||||||||
| 592 |     if (copy.at(0) == locale.groupSeparator()
  | 0 | ||||||||||||||||||||||||
| 593 |         if (false) QMessageLogger(__FILE__, 1194, __PRETTY_FUNCTION__).debug() << __FILE__ << 1194<< "state is set to Invalid"; dead code:  QMessageLogger(__FILE__, 1194, __PRETTY_FUNCTION__).debug() << __FILE__ << 1194<< "state is set to Invalid"; | - | ||||||||||||||||||||||||
| 594 | state = QValidator::Invalid; | - | ||||||||||||||||||||||||
| 595 |         goto never executed:   end;goto end;never executed:  goto end; | 0 | ||||||||||||||||||||||||
| 596 |     } else if (len > 1
  | 0 | ||||||||||||||||||||||||
| 597 | const int dec = copy.indexOf(locale.decimalPoint()); | - | ||||||||||||||||||||||||
| 598 |         if (dec != -1
  | 0 | ||||||||||||||||||||||||
| 599 |             if (dec + 1 < copy.size()
 
 
  | 0 | ||||||||||||||||||||||||
| 600 | copy.remove(dec + 1, 1); | - | ||||||||||||||||||||||||
| 601 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 602 | - | |||||||||||||||||||||||||
| 603 |             if (copy.size() - dec > decimals + 1
  | 0 | ||||||||||||||||||||||||
| 604 |                 if (false) QMessageLogger(__FILE__, 1205, __PRETTY_FUNCTION__).debug() << __FILE__ << 1205<< "state is set to Invalid"; dead code:  QMessageLogger(__FILE__, 1205, __PRETTY_FUNCTION__).debug() << __FILE__ << 1205<< "state is set to Invalid"; | - | ||||||||||||||||||||||||
| 605 | state = QValidator::Invalid; | - | ||||||||||||||||||||||||
| 606 |                 goto never executed:   end;goto end;never executed:  goto end; | 0 | ||||||||||||||||||||||||
| 607 | } | - | ||||||||||||||||||||||||
| 608 |             for (int i=dec + 1; i<copy.size()
  | 0 | ||||||||||||||||||||||||
| 609 |                 if (copy.at(i).isSpace()
 
  | 0 | ||||||||||||||||||||||||
| 610 |                     if (false) QMessageLogger(__FILE__, 1211, __PRETTY_FUNCTION__).debug() << __FILE__ << 1211<< "state is set to Invalid"; dead code:  QMessageLogger(__FILE__, 1211, __PRETTY_FUNCTION__).debug() << __FILE__ << 1211<< "state is set to Invalid"; | - | ||||||||||||||||||||||||
| 611 | state = QValidator::Invalid; | - | ||||||||||||||||||||||||
| 612 |                     goto never executed:   end;goto end;never executed:  goto end; | 0 | ||||||||||||||||||||||||
| 613 | } | - | ||||||||||||||||||||||||
| 614 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 615 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 616 | const QChar last = copy.at(len - 1); | - | ||||||||||||||||||||||||
| 617 | const QChar secondLast = copy.at(len - 2); | - | ||||||||||||||||||||||||
| 618 |             if ((last == locale.groupSeparator()
 
  | 0 | ||||||||||||||||||||||||
| 619 |                 && (secondLast == locale.groupSeparator()
 
  | 0 | ||||||||||||||||||||||||
| 620 | state = QValidator::Invalid; | - | ||||||||||||||||||||||||
| 621 |                 if (false) QMessageLogger(__FILE__, 1222, __PRETTY_FUNCTION__).debug() << __FILE__ << 1222<< "state is set to Invalid"; dead code:  QMessageLogger(__FILE__, 1222, __PRETTY_FUNCTION__).debug() << __FILE__ << 1222<< "state is set to Invalid"; | - | ||||||||||||||||||||||||
| 622 |                 goto never executed:   end;goto end;never executed:  goto end; | 0 | ||||||||||||||||||||||||
| 623 |             } else if (last.isSpace()
 
 
  | 0 | ||||||||||||||||||||||||
| 624 | state = QValidator::Invalid; | - | ||||||||||||||||||||||||
| 625 |                 if (false) QMessageLogger(__FILE__, 1226, __PRETTY_FUNCTION__).debug() << __FILE__ << 1226<< "state is set to Invalid"; dead code:  QMessageLogger(__FILE__, 1226, __PRETTY_FUNCTION__).debug() << __FILE__ << 1226<< "state is set to Invalid"; | - | ||||||||||||||||||||||||
| 626 |                 goto never executed:   end;goto end;never executed:  goto end; | 0 | ||||||||||||||||||||||||
| 627 | } | - | ||||||||||||||||||||||||
| 628 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 629 | } | - | ||||||||||||||||||||||||
| 630 | - | |||||||||||||||||||||||||
| 631 | { | - | ||||||||||||||||||||||||
| 632 | bool ok = false; | - | ||||||||||||||||||||||||
| 633 | num = locale.toDouble(copy, &ok); | - | ||||||||||||||||||||||||
| 634 |         if (false) QMessageLogger(__FILE__, 1235, __PRETTY_FUNCTION__).debug() << __FILE__ << 1235 << locale << copy << num << ok; dead code:  QMessageLogger(__FILE__, 1235, __PRETTY_FUNCTION__).debug() << __FILE__ << 1235 << locale << copy << num << ok; | - | ||||||||||||||||||||||||
| 635 | - | |||||||||||||||||||||||||
| 636 |         if (!ok
  | 0 | ||||||||||||||||||||||||
| 637 |             if (locale.groupSeparator().isPrint()
  | 0 | ||||||||||||||||||||||||
| 638 |                 if (max < 1000
 
 
  | 0 | ||||||||||||||||||||||||
| 639 | state = QValidator::Invalid; | - | ||||||||||||||||||||||||
| 640 |                     if (false) QMessageLogger(__FILE__, 1241, __PRETTY_FUNCTION__).debug() << __FILE__ << 1241<< "state is set to Invalid"; dead code:  QMessageLogger(__FILE__, 1241, __PRETTY_FUNCTION__).debug() << __FILE__ << 1241<< "state is set to Invalid"; | - | ||||||||||||||||||||||||
| 641 |                     goto never executed:   end;goto end;never executed:  goto end; | 0 | ||||||||||||||||||||||||
| 642 | } | - | ||||||||||||||||||||||||
| 643 | - | |||||||||||||||||||||||||
| 644 | const int len = copy.size(); | - | ||||||||||||||||||||||||
| 645 |                 for (int i=0; i<len- 1
  | 0 | ||||||||||||||||||||||||
| 646 |                     if (copy.at(i) == locale.groupSeparator()
 
  | 0 | ||||||||||||||||||||||||
| 647 |                         if (false) QMessageLogger(__FILE__, 1248, __PRETTY_FUNCTION__).debug() << __FILE__ << 1248<< "state is set to Invalid"; dead code:  QMessageLogger(__FILE__, 1248, __PRETTY_FUNCTION__).debug() << __FILE__ << 1248<< "state is set to Invalid"; | - | ||||||||||||||||||||||||
| 648 | state = QValidator::Invalid; | - | ||||||||||||||||||||||||
| 649 |                         goto never executed:   end;goto end;never executed:  goto end; | 0 | ||||||||||||||||||||||||
| 650 | } | - | ||||||||||||||||||||||||
| 651 |                 } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 652 | - | |||||||||||||||||||||||||
| 653 | QString copy2 = copy; | - | ||||||||||||||||||||||||
| 654 | copy2.remove(locale.groupSeparator()); | - | ||||||||||||||||||||||||
| 655 | num = locale.toDouble(copy2, &ok); | - | ||||||||||||||||||||||||
| 656 |                 if (false) QMessageLogger(__FILE__, 1257, __PRETTY_FUNCTION__).debug() << locale.groupSeparator() << num << copy2 << ok; dead code:  QMessageLogger(__FILE__, 1257, __PRETTY_FUNCTION__).debug() << locale.groupSeparator() << num << copy2 << ok; | - | ||||||||||||||||||||||||
| 657 | - | |||||||||||||||||||||||||
| 658 |                 if (!ok
  | 0 | ||||||||||||||||||||||||
| 659 | state = QValidator::Invalid; | - | ||||||||||||||||||||||||
| 660 |                     if (false) QMessageLogger(__FILE__, 1261, __PRETTY_FUNCTION__).debug() << __FILE__ << 1261<< "state is set to Invalid"; dead code:  QMessageLogger(__FILE__, 1261, __PRETTY_FUNCTION__).debug() << __FILE__ << 1261<< "state is set to Invalid"; | - | ||||||||||||||||||||||||
| 661 |                     goto never executed:   end;goto end;never executed:  goto end; | 0 | ||||||||||||||||||||||||
| 662 | } | - | ||||||||||||||||||||||||
| 663 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 664 |         } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 665 | - | |||||||||||||||||||||||||
| 666 |         if (!ok
  | 0 | ||||||||||||||||||||||||
| 667 | state = QValidator::Invalid; | - | ||||||||||||||||||||||||
| 668 |             if (false) QMessageLogger(__FILE__, 1269, __PRETTY_FUNCTION__).debug() << __FILE__ << 1269<< "state is set to Invalid"; dead code:  QMessageLogger(__FILE__, 1269, __PRETTY_FUNCTION__).debug() << __FILE__ << 1269<< "state is set to Invalid"; | - | ||||||||||||||||||||||||
| 669 |         } never executed:   else if (num >= minend of block
 
  | 0 | ||||||||||||||||||||||||
| 670 | state = QValidator::Acceptable; | - | ||||||||||||||||||||||||
| 671 |             if (false) QMessageLogger(__FILE__, 1272, __PRETTY_FUNCTION__).debug() << __FILE__ << 1272<< "state is set to Acceptable"; dead code:  QMessageLogger(__FILE__, 1272, __PRETTY_FUNCTION__).debug() << __FILE__ << 1272<< "state is set to Acceptable"; | - | ||||||||||||||||||||||||
| 672 |         } never executed:   else if (max == minend of block
  | 0 | ||||||||||||||||||||||||
| 673 | state = QValidator::Invalid; | - | ||||||||||||||||||||||||
| 674 |             if (false) QMessageLogger(__FILE__, 1275, __PRETTY_FUNCTION__).debug() << __FILE__ << 1275<< "state is set to Invalid"; dead code:  QMessageLogger(__FILE__, 1275, __PRETTY_FUNCTION__).debug() << __FILE__ << 1275<< "state is set to Invalid"; | - | ||||||||||||||||||||||||
| 675 |         } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 676 |             if ((num >= 0
 
 
 
  | 0 | ||||||||||||||||||||||||
| 677 | state = QValidator::Invalid; | - | ||||||||||||||||||||||||
| 678 |                 if (false) QMessageLogger(__FILE__, 1279, __PRETTY_FUNCTION__).debug() << __FILE__ << 1279<< "state is set to Invalid"; dead code:  QMessageLogger(__FILE__, 1279, __PRETTY_FUNCTION__).debug() << __FILE__ << 1279<< "state is set to Invalid"; | - | ||||||||||||||||||||||||
| 679 |             } never executed:   else {end of block | 0 | ||||||||||||||||||||||||
| 680 | state = QValidator::Intermediate; | - | ||||||||||||||||||||||||
| 681 |                 if (false) QMessageLogger(__FILE__, 1282, __PRETTY_FUNCTION__).debug() << __FILE__ << 1282<< "state is set to Intermediate"; dead code:  QMessageLogger(__FILE__, 1282, __PRETTY_FUNCTION__).debug() << __FILE__ << 1282<< "state is set to Intermediate"; | - | ||||||||||||||||||||||||
| 682 |             } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 683 | } | - | ||||||||||||||||||||||||
| 684 | } | - | ||||||||||||||||||||||||
| 685 | - | |||||||||||||||||||||||||
| 686 | end: code before this statement never executed:  end: | 0 | ||||||||||||||||||||||||
| 687 |     if (state != QValidator::Acceptable
  | 0 | ||||||||||||||||||||||||
| 688 |         num = max > 0
  | 0 | ||||||||||||||||||||||||
| 689 |     } never executed:  end of block | 0 | ||||||||||||||||||||||||
| 690 | - | |||||||||||||||||||||||||
| 691 | input = prefix + copy + suffix; | - | ||||||||||||||||||||||||
| 692 | cachedText = input; | - | ||||||||||||||||||||||||
| 693 | cachedState = state; | - | ||||||||||||||||||||||||
| 694 | cachedValue = QVariant(num); | - | ||||||||||||||||||||||||
| 695 |     return never executed:   QVariant(num);return QVariant(num);never executed:  return QVariant(num); | 0 | ||||||||||||||||||||||||
| 696 | } | - | ||||||||||||||||||||||||
| 697 | - | |||||||||||||||||||||||||
| 698 | - | |||||||||||||||||||||||||
| 699 | - | |||||||||||||||||||||||||
| 700 | - | |||||||||||||||||||||||||
| 701 | - | |||||||||||||||||||||||||
| 702 | - | |||||||||||||||||||||||||
| 703 | QString QDoubleSpinBoxPrivate::textFromValue(const QVariant &f) const | - | ||||||||||||||||||||||||
| 704 | { | - | ||||||||||||||||||||||||
| 705 | const QDoubleSpinBox * const q = q_func(); | - | ||||||||||||||||||||||||
| 706 |     return never executed:   q->textFromValue(f.toDouble());return q->textFromValue(f.toDouble());never executed:  return q->textFromValue(f.toDouble()); | 0 | ||||||||||||||||||||||||
| 707 | } | - | ||||||||||||||||||||||||
| 708 | - | |||||||||||||||||||||||||
| 709 | - | |||||||||||||||||||||||||
| 710 | bool QSpinBox::event(QEvent *event) | - | ||||||||||||||||||||||||
| 711 | { | - | ||||||||||||||||||||||||
| 712 | QSpinBoxPrivate * const d = d_func(); | - | ||||||||||||||||||||||||
| 713 |     if (event->type() == QEvent::StyleChange
  | 0 | ||||||||||||||||||||||||
| 714 | - | |||||||||||||||||||||||||
| 715 | - | |||||||||||||||||||||||||
| 716 | - | |||||||||||||||||||||||||
| 717 | ) | - | ||||||||||||||||||||||||
| 718 |         d->setLayoutItemMargins(QStyle::SE_SpinBoxLayoutItem); never executed:  d->setLayoutItemMargins(QStyle::SE_SpinBoxLayoutItem); | 0 | ||||||||||||||||||||||||
| 719 |     return never executed:   QAbstractSpinBox::event(event);return QAbstractSpinBox::event(event);never executed:  return QAbstractSpinBox::event(event); | 0 | ||||||||||||||||||||||||
| 720 | } | - | ||||||||||||||||||||||||
| 721 | - | |||||||||||||||||||||||||
| 722 | - | |||||||||||||||||||||||||
| 723 | - | |||||||||||||||||||||||||
| Switch to Source code | Preprocessed file |