| Line | Source Code | Coverage |
|---|
| 1 | /**************************************************************************** | - |
| 2 | ** | - |
| 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). | - |
| 4 | ** Contact: http://www.qt-project.org/legal | - |
| 5 | ** | - |
| 6 | ** This file is part of the QtGui module of the Qt Toolkit. | - |
| 7 | ** | - |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
| 9 | ** Commercial License Usage | - |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
| 11 | ** accordance with the commercial license agreement provided with the | - |
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - |
| 13 | ** a written agreement between you and Digia. For licensing terms and | - |
| 14 | ** conditions see http://qt.digia.com/licensing. For further information | - |
| 15 | ** use the contact form at http://qt.digia.com/contact-us. | - |
| 16 | ** | - |
| 17 | ** GNU Lesser General Public License Usage | - |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
| 19 | ** General Public License version 2.1 as published by the Free Software | - |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL included in the | - |
| 21 | ** packaging of this file. Please review the following information to | - |
| 22 | ** ensure the GNU Lesser General Public License version 2.1 requirements | - |
| 23 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. | - |
| 24 | ** | - |
| 25 | ** In addition, as a special exception, Digia gives you certain additional | - |
| 26 | ** rights. These rights are described in the Digia Qt LGPL Exception | - |
| 27 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. | - |
| 28 | ** | - |
| 29 | ** GNU General Public License Usage | - |
| 30 | ** Alternatively, this file may be used under the terms of the GNU | - |
| 31 | ** General Public License version 3.0 as published by the Free Software | - |
| 32 | ** Foundation and appearing in the file LICENSE.GPL included in the | - |
| 33 | ** packaging of this file. Please review the following information to | - |
| 34 | ** ensure the GNU General Public License version 3.0 requirements will be | - |
| 35 | ** met: http://www.gnu.org/copyleft/gpl.html. | - |
| 36 | ** | - |
| 37 | ** | - |
| 38 | ** $QT_END_LICENSE$ | - |
| 39 | ** | - |
| 40 | ****************************************************************************/ | - |
| 41 | | - |
| 42 | #include <qplatformdefs.h> | - |
| 43 | #include <private/qabstractspinbox_p.h> | - |
| 44 | #include <private/qdatetime_p.h> | - |
| 45 | #include <private/qlineedit_p.h> | - |
| 46 | #include <qabstractspinbox.h> | - |
| 47 | | - |
| 48 | #ifndef QT_NO_SPINBOX | - |
| 49 | | - |
| 50 | #include <qapplication.h> | - |
| 51 | #include <qstylehints.h> | - |
| 52 | #include <qclipboard.h> | - |
| 53 | #include <qdatetime.h> | - |
| 54 | #include <qdatetimeedit.h> | - |
| 55 | #include <qevent.h> | - |
| 56 | #include <qmenu.h> | - |
| 57 | #include <qpainter.h> | - |
| 58 | #include <qpalette.h> | - |
| 59 | #include <qstylepainter.h> | - |
| 60 | #include <qdebug.h> | - |
| 61 | #ifndef QT_NO_ACCESSIBILITY | - |
| 62 | # include <qaccessible.h> | - |
| 63 | #endif | - |
| 64 | | - |
| 65 | | - |
| 66 | //#define QABSTRACTSPINBOX_QSBDEBUG | - |
| 67 | #ifdef QABSTRACTSPINBOX_QSBDEBUG | - |
| 68 | # define QASBDEBUG qDebug | - |
| 69 | #else | - |
| 70 | # define QASBDEBUG if (false) qDebug | - |
| 71 | #endif | - |
| 72 | | - |
| 73 | QT_BEGIN_NAMESPACE | - |
| 74 | | - |
| 75 | /*! | - |
| 76 | \class QAbstractSpinBox | - |
| 77 | \brief The QAbstractSpinBox class provides a spinbox and a line edit to | - |
| 78 | display values. | - |
| 79 | | - |
| 80 | \ingroup abstractwidgets | - |
| 81 | \inmodule QtWidgets | - |
| 82 | | - |
| 83 | The class is designed as a common super class for widgets like | - |
| 84 | QSpinBox, QDoubleSpinBox and QDateTimeEdit | - |
| 85 | | - |
| 86 | Here are the main properties of the class: | - |
| 87 | | - |
| 88 | \list 1 | - |
| 89 | | - |
| 90 | \li \l text: The text that is displayed in the QAbstractSpinBox. | - |
| 91 | | - |
| 92 | \li \l alignment: The alignment of the text in the QAbstractSpinBox. | - |
| 93 | | - |
| 94 | \li \l wrapping: Whether the QAbstractSpinBox wraps from the | - |
| 95 | minimum value to the maximum value and vica versa. | - |
| 96 | | - |
| 97 | \endlist | - |
| 98 | | - |
| 99 | QAbstractSpinBox provides a virtual stepBy() function that is | - |
| 100 | called whenever the user triggers a step. This function takes an | - |
| 101 | integer value to signify how many steps were taken. E.g. Pressing | - |
| 102 | Qt::Key_Down will trigger a call to stepBy(-1). | - |
| 103 | | - |
| 104 | QAbstractSpinBox also provide a virtual function stepEnabled() to | - |
| 105 | determine whether stepping up/down is allowed at any point. This | - |
| 106 | function returns a bitset of StepEnabled. | - |
| 107 | | - |
| 108 | \sa QAbstractSlider, QSpinBox, QDoubleSpinBox, QDateTimeEdit, | - |
| 109 | {Spin Boxes Example} | - |
| 110 | */ | - |
| 111 | | - |
| 112 | /*! | - |
| 113 | \enum QAbstractSpinBox::StepEnabledFlag | - |
| 114 | | - |
| 115 | \value StepNone | - |
| 116 | \value StepUpEnabled | - |
| 117 | \value StepDownEnabled | - |
| 118 | */ | - |
| 119 | | - |
| 120 | /*! | - |
| 121 | \fn void QAbstractSpinBox::editingFinished() | - |
| 122 | | - |
| 123 | This signal is emitted editing is finished. This happens when the | - |
| 124 | spinbox loses focus and when enter is pressed. | - |
| 125 | */ | - |
| 126 | | - |
| 127 | /*! | - |
| 128 | Constructs an abstract spinbox with the given \a parent with default | - |
| 129 | \l wrapping, and \l alignment properties. | - |
| 130 | */ | - |
| 131 | | - |
| 132 | QAbstractSpinBox::QAbstractSpinBox(QWidget *parent) | - |
| 133 | : QWidget(*new QAbstractSpinBoxPrivate, parent, 0) | - |
| 134 | { | - |
| 135 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 136 | d->init(); executed (the execution status of this line is deduced): d->init(); | - |
| 137 | } executed: }Execution Count:1 | 1 |
| 138 | | - |
| 139 | /*! | - |
| 140 | \internal | - |
| 141 | */ | - |
| 142 | QAbstractSpinBox::QAbstractSpinBox(QAbstractSpinBoxPrivate &dd, QWidget *parent) | - |
| 143 | : QWidget(dd, parent, 0) | - |
| 144 | { | - |
| 145 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 146 | d->init(); executed (the execution status of this line is deduced): d->init(); | - |
| 147 | } executed: }Execution Count:392 | 392 |
| 148 | | - |
| 149 | /*! | - |
| 150 | Called when the QAbstractSpinBox is destroyed. | - |
| 151 | */ | - |
| 152 | | - |
| 153 | QAbstractSpinBox::~QAbstractSpinBox() | - |
| 154 | { | - |
| 155 | } | - |
| 156 | | - |
| 157 | /*! | - |
| 158 | \enum QAbstractSpinBox::ButtonSymbols | - |
| 159 | | - |
| 160 | This enum type describes the symbols that can be displayed on the buttons | - |
| 161 | in a spin box. | - |
| 162 | | - |
| 163 | \inlineimage qspinbox-updown.png | - |
| 164 | \inlineimage qspinbox-plusminus.png | - |
| 165 | | - |
| 166 | \value UpDownArrows Little arrows in the classic style. | - |
| 167 | \value PlusMinus \b{+} and \b{-} symbols. | - |
| 168 | \value NoButtons Don't display buttons. | - |
| 169 | | - |
| 170 | \sa QAbstractSpinBox::buttonSymbols | - |
| 171 | */ | - |
| 172 | | - |
| 173 | /*! | - |
| 174 | \property QAbstractSpinBox::buttonSymbols | - |
| 175 | | - |
| 176 | \brief the current button symbol mode | - |
| 177 | | - |
| 178 | The possible values can be either \c UpDownArrows or \c PlusMinus. | - |
| 179 | The default is \c UpDownArrows. | - |
| 180 | | - |
| 181 | Note that some styles might render PlusMinus and UpDownArrows | - |
| 182 | identically. | - |
| 183 | | - |
| 184 | \sa ButtonSymbols | - |
| 185 | */ | - |
| 186 | | - |
| 187 | QAbstractSpinBox::ButtonSymbols QAbstractSpinBox::buttonSymbols() const | - |
| 188 | { | - |
| 189 | Q_D(const QAbstractSpinBox); executed (the execution status of this line is deduced): const QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 190 | return d->buttonSymbols; executed: return d->buttonSymbols;Execution Count:2 | 2 |
| 191 | } | - |
| 192 | | - |
| 193 | void QAbstractSpinBox::setButtonSymbols(ButtonSymbols buttonSymbols) | - |
| 194 | { | - |
| 195 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 196 | if (d->buttonSymbols != buttonSymbols) { evaluated: d->buttonSymbols != buttonSymbols| yes Evaluation Count:2 | yes Evaluation Count:1 |
| 1-2 |
| 197 | d->buttonSymbols = buttonSymbols; executed (the execution status of this line is deduced): d->buttonSymbols = buttonSymbols; | - |
| 198 | d->updateEditFieldGeometry(); executed (the execution status of this line is deduced): d->updateEditFieldGeometry(); | - |
| 199 | update(); executed (the execution status of this line is deduced): update(); | - |
| 200 | } executed: }Execution Count:2 | 2 |
| 201 | } executed: }Execution Count:3 | 3 |
| 202 | | - |
| 203 | /*! | - |
| 204 | \property QAbstractSpinBox::text | - |
| 205 | | - |
| 206 | \brief the spin box's text, including any prefix and suffix | - |
| 207 | | - |
| 208 | There is no default text. | - |
| 209 | */ | - |
| 210 | | - |
| 211 | QString QAbstractSpinBox::text() const | - |
| 212 | { | - |
| 213 | return lineEdit()->displayText(); executed: return lineEdit()->displayText();Execution Count:150 | 150 |
| 214 | } | - |
| 215 | | - |
| 216 | | - |
| 217 | /*! | - |
| 218 | \property QAbstractSpinBox::specialValueText | - |
| 219 | \brief the special-value text | - |
| 220 | | - |
| 221 | If set, the spin box will display this text instead of a numeric | - |
| 222 | value whenever the current value is equal to minimum(). Typical use | - |
| 223 | is to indicate that this choice has a special (default) meaning. | - |
| 224 | | - |
| 225 | For example, if your spin box allows the user to choose a scale factor | - |
| 226 | (or zoom level) for displaying an image, and your application is able | - |
| 227 | to automatically choose one that will enable the image to fit completely | - |
| 228 | within the display window, you can set up the spin box like this: | - |
| 229 | | - |
| 230 | \snippet widgets/spinboxes/window.cpp 3 | - |
| 231 | | - |
| 232 | The user will then be able to choose a scale from 1% to 1000% | - |
| 233 | or select "Auto" to leave it up to the application to choose. Your code | - |
| 234 | must then interpret the spin box value of 0 as a request from the user | - |
| 235 | to scale the image to fit inside the window. | - |
| 236 | | - |
| 237 | All values are displayed with the prefix and suffix (if set), \e | - |
| 238 | except for the special value, which only shows the special value | - |
| 239 | text. This special text is passed in the QSpinBox::valueChanged() | - |
| 240 | signal that passes a QString. | - |
| 241 | | - |
| 242 | To turn off the special-value text display, call this function | - |
| 243 | with an empty string. The default is no special-value text, i.e. | - |
| 244 | the numeric value is shown as usual. | - |
| 245 | | - |
| 246 | If no special-value text is set, specialValueText() returns an | - |
| 247 | empty string. | - |
| 248 | */ | - |
| 249 | | - |
| 250 | QString QAbstractSpinBox::specialValueText() const | - |
| 251 | { | - |
| 252 | Q_D(const QAbstractSpinBox); executed (the execution status of this line is deduced): const QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 253 | return d->specialValueText; executed: return d->specialValueText;Execution Count:4 | 4 |
| 254 | } | - |
| 255 | | - |
| 256 | void QAbstractSpinBox::setSpecialValueText(const QString &specialValueText) | - |
| 257 | { | - |
| 258 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 259 | | - |
| 260 | d->specialValueText = specialValueText; executed (the execution status of this line is deduced): d->specialValueText = specialValueText; | - |
| 261 | d->cachedSizeHint = QSize(); // minimumSizeHint doesn't care about specialValueText executed (the execution status of this line is deduced): d->cachedSizeHint = QSize(); | - |
| 262 | d->clearCache(); executed (the execution status of this line is deduced): d->clearCache(); | - |
| 263 | d->updateEdit(); executed (the execution status of this line is deduced): d->updateEdit(); | - |
| 264 | } executed: }Execution Count:289 | 289 |
| 265 | | - |
| 266 | /*! | - |
| 267 | \property QAbstractSpinBox::wrapping | - |
| 268 | | - |
| 269 | \brief whether the spin box is circular. | - |
| 270 | | - |
| 271 | If wrapping is true stepping up from maximum() value will take you | - |
| 272 | to the minimum() value and vica versa. Wrapping only make sense if | - |
| 273 | you have minimum() and maximum() values set. | - |
| 274 | | - |
| 275 | \snippet code/src_gui_widgets_qabstractspinbox.cpp 0 | - |
| 276 | | - |
| 277 | \sa QSpinBox::minimum(), QSpinBox::maximum() | - |
| 278 | */ | - |
| 279 | | - |
| 280 | bool QAbstractSpinBox::wrapping() const | - |
| 281 | { | - |
| 282 | Q_D(const QAbstractSpinBox); executed (the execution status of this line is deduced): const QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 283 | return d->wrapping; executed: return d->wrapping;Execution Count:9 | 9 |
| 284 | } | - |
| 285 | | - |
| 286 | void QAbstractSpinBox::setWrapping(bool wrapping) | - |
| 287 | { | - |
| 288 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 289 | d->wrapping = wrapping; executed (the execution status of this line is deduced): d->wrapping = wrapping; | - |
| 290 | } executed: }Execution Count:395 | 395 |
| 291 | | - |
| 292 | | - |
| 293 | /*! | - |
| 294 | \property QAbstractSpinBox::readOnly | - |
| 295 | \brief whether the spin box is read only. | - |
| 296 | | - |
| 297 | In read-only mode, the user can still copy the text to the | - |
| 298 | clipboard, or drag and drop the text; | - |
| 299 | but cannot edit it. | - |
| 300 | | - |
| 301 | The QLineEdit in the QAbstractSpinBox does not show a cursor in | - |
| 302 | read-only mode. | - |
| 303 | | - |
| 304 | \sa QLineEdit::readOnly | - |
| 305 | */ | - |
| 306 | | - |
| 307 | bool QAbstractSpinBox::isReadOnly() const | - |
| 308 | { | - |
| 309 | Q_D(const QAbstractSpinBox); never executed (the execution status of this line is deduced): const QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 310 | return d->readOnly; never executed: return d->readOnly; | 0 |
| 311 | } | - |
| 312 | | - |
| 313 | void QAbstractSpinBox::setReadOnly(bool enable) | - |
| 314 | { | - |
| 315 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 316 | d->readOnly = enable; executed (the execution status of this line is deduced): d->readOnly = enable; | - |
| 317 | d->edit->setReadOnly(enable); executed (the execution status of this line is deduced): d->edit->setReadOnly(enable); | - |
| 318 | update(); executed (the execution status of this line is deduced): update(); | - |
| 319 | } executed: }Execution Count:7 | 7 |
| 320 | | - |
| 321 | /*! | - |
| 322 | \property QAbstractSpinBox::keyboardTracking | - |
| 323 | \brief whether keyboard tracking is enabled for the spinbox. | - |
| 324 | \since 4.3 | - |
| 325 | | - |
| 326 | If keyboard tracking is enabled (the default), the spinbox | - |
| 327 | emits the valueChanged() signal while the new value is being | - |
| 328 | entered from the keyboard. | - |
| 329 | | - |
| 330 | E.g. when the user enters the value 600 by typing 6, 0, and 0, | - |
| 331 | the spinbox emits 3 signals with the values 6, 60, and 600 | - |
| 332 | respectively. | - |
| 333 | | - |
| 334 | If keyboard tracking is disabled, the spinbox doesn't emit the | - |
| 335 | valueChanged() signal while typing. It emits the signal later, | - |
| 336 | when the return key is pressed, when keyboard focus is lost, or | - |
| 337 | when other spinbox functionality is used, e.g. pressing an arrow | - |
| 338 | key. | - |
| 339 | */ | - |
| 340 | | - |
| 341 | bool QAbstractSpinBox::keyboardTracking() const | - |
| 342 | { | - |
| 343 | Q_D(const QAbstractSpinBox); never executed (the execution status of this line is deduced): const QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 344 | return d->keyboardTracking; never executed: return d->keyboardTracking; | 0 |
| 345 | } | - |
| 346 | | - |
| 347 | void QAbstractSpinBox::setKeyboardTracking(bool enable) | - |
| 348 | { | - |
| 349 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 350 | d->keyboardTracking = enable; executed (the execution status of this line is deduced): d->keyboardTracking = enable; | - |
| 351 | } executed: }Execution Count:5 | 5 |
| 352 | | - |
| 353 | /*! | - |
| 354 | \property QAbstractSpinBox::frame | - |
| 355 | \brief whether the spin box draws itself with a frame | - |
| 356 | | - |
| 357 | If enabled (the default) the spin box draws itself inside a frame, | - |
| 358 | otherwise the spin box draws itself without any frame. | - |
| 359 | */ | - |
| 360 | | - |
| 361 | bool QAbstractSpinBox::hasFrame() const | - |
| 362 | { | - |
| 363 | Q_D(const QAbstractSpinBox); never executed (the execution status of this line is deduced): const QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 364 | return d->frame; never executed: return d->frame; | 0 |
| 365 | } | - |
| 366 | | - |
| 367 | | - |
| 368 | void QAbstractSpinBox::setFrame(bool enable) | - |
| 369 | { | - |
| 370 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 371 | d->frame = enable; executed (the execution status of this line is deduced): d->frame = enable; | - |
| 372 | update(); executed (the execution status of this line is deduced): update(); | - |
| 373 | d->updateEditFieldGeometry(); executed (the execution status of this line is deduced): d->updateEditFieldGeometry(); | - |
| 374 | } executed: }Execution Count:40 | 40 |
| 375 | | - |
| 376 | /*! | - |
| 377 | \property QAbstractSpinBox::accelerated | - |
| 378 | \brief whether the spin box will accelerate the frequency of the steps when | - |
| 379 | pressing the step Up/Down buttons. | - |
| 380 | \since 4.2 | - |
| 381 | | - |
| 382 | If enabled the spin box will increase/decrease the value faster | - |
| 383 | the longer you hold the button down. | - |
| 384 | */ | - |
| 385 | | - |
| 386 | void QAbstractSpinBox::setAccelerated(bool accelerate) | - |
| 387 | { | - |
| 388 | Q_D(QAbstractSpinBox); never executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 389 | d->accelerate = accelerate; never executed (the execution status of this line is deduced): d->accelerate = accelerate; | - |
| 390 | | - |
| 391 | } | 0 |
| 392 | bool QAbstractSpinBox::isAccelerated() const | - |
| 393 | { | - |
| 394 | Q_D(const QAbstractSpinBox); never executed (the execution status of this line is deduced): const QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 395 | return d->accelerate; never executed: return d->accelerate; | 0 |
| 396 | } | - |
| 397 | | - |
| 398 | /*! | - |
| 399 | \enum QAbstractSpinBox::CorrectionMode | - |
| 400 | | - |
| 401 | This enum type describes the mode the spinbox will use to correct | - |
| 402 | an \l{QValidator::}{Intermediate} value if editing finishes. | - |
| 403 | | - |
| 404 | \value CorrectToPreviousValue The spinbox will revert to the last | - |
| 405 | valid value. | - |
| 406 | | - |
| 407 | \value CorrectToNearestValue The spinbox will revert to the nearest | - |
| 408 | valid value. | - |
| 409 | | - |
| 410 | \sa correctionMode | - |
| 411 | */ | - |
| 412 | | - |
| 413 | /*! | - |
| 414 | \property QAbstractSpinBox::correctionMode | - |
| 415 | \brief the mode to correct an \l{QValidator::}{Intermediate} | - |
| 416 | value if editing finishes | - |
| 417 | \since 4.2 | - |
| 418 | | - |
| 419 | The default mode is QAbstractSpinBox::CorrectToPreviousValue. | - |
| 420 | | - |
| 421 | \sa acceptableInput, validate(), fixup() | - |
| 422 | */ | - |
| 423 | void QAbstractSpinBox::setCorrectionMode(CorrectionMode correctionMode) | - |
| 424 | { | - |
| 425 | Q_D(QAbstractSpinBox); never executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 426 | d->correctionMode = correctionMode; never executed (the execution status of this line is deduced): d->correctionMode = correctionMode; | - |
| 427 | | - |
| 428 | } | 0 |
| 429 | QAbstractSpinBox::CorrectionMode QAbstractSpinBox::correctionMode() const | - |
| 430 | { | - |
| 431 | Q_D(const QAbstractSpinBox); never executed (the execution status of this line is deduced): const QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 432 | return d->correctionMode; never executed: return d->correctionMode; | 0 |
| 433 | } | - |
| 434 | | - |
| 435 | | - |
| 436 | /*! | - |
| 437 | \property QAbstractSpinBox::acceptableInput | - |
| 438 | \brief whether the input satisfies the current validation | - |
| 439 | \since 4.2 | - |
| 440 | | - |
| 441 | \sa validate(), fixup(), correctionMode | - |
| 442 | */ | - |
| 443 | | - |
| 444 | bool QAbstractSpinBox::hasAcceptableInput() const | - |
| 445 | { | - |
| 446 | Q_D(const QAbstractSpinBox); executed (the execution status of this line is deduced): const QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 447 | return d->edit->hasAcceptableInput(); executed: return d->edit->hasAcceptableInput();Execution Count:1497 | 1497 |
| 448 | } | - |
| 449 | | - |
| 450 | /*! | - |
| 451 | \property QAbstractSpinBox::alignment | - |
| 452 | \brief the alignment of the spin box | - |
| 453 | | - |
| 454 | Possible Values are Qt::AlignLeft, Qt::AlignRight, and Qt::AlignHCenter. | - |
| 455 | | - |
| 456 | By default, the alignment is Qt::AlignLeft | - |
| 457 | | - |
| 458 | Attempting to set the alignment to an illegal flag combination | - |
| 459 | does nothing. | - |
| 460 | | - |
| 461 | \sa Qt::Alignment | - |
| 462 | */ | - |
| 463 | | - |
| 464 | Qt::Alignment QAbstractSpinBox::alignment() const | - |
| 465 | { | - |
| 466 | Q_D(const QAbstractSpinBox); executed (the execution status of this line is deduced): const QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 467 | | - |
| 468 | return (Qt::Alignment)d->edit->alignment(); executed: return (Qt::Alignment)d->edit->alignment();Execution Count:1 | 1 |
| 469 | } | - |
| 470 | | - |
| 471 | void QAbstractSpinBox::setAlignment(Qt::Alignment flag) | - |
| 472 | { | - |
| 473 | Q_D(QAbstractSpinBox); never executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 474 | | - |
| 475 | d->edit->setAlignment(flag); never executed (the execution status of this line is deduced): d->edit->setAlignment(flag); | - |
| 476 | } | 0 |
| 477 | | - |
| 478 | /*! | - |
| 479 | Selects all the text in the spinbox except the prefix and suffix. | - |
| 480 | */ | - |
| 481 | | - |
| 482 | void QAbstractSpinBox::selectAll() | - |
| 483 | { | - |
| 484 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 485 | | - |
| 486 | | - |
| 487 | if (!d->specialValue()) { evaluated: !d->specialValue()| yes Evaluation Count:388 | yes Evaluation Count:1 |
| 1-388 |
| 488 | const int tmp = d->edit->displayText().size() - d->suffix.size(); executed (the execution status of this line is deduced): const int tmp = d->edit->displayText().size() - d->suffix.size(); | - |
| 489 | d->edit->setSelection(tmp, -(tmp - d->prefix.size())); executed (the execution status of this line is deduced): d->edit->setSelection(tmp, -(tmp - d->prefix.size())); | - |
| 490 | } else { executed: }Execution Count:388 | 388 |
| 491 | d->edit->selectAll(); executed (the execution status of this line is deduced): d->edit->selectAll(); | - |
| 492 | } executed: }Execution Count:1 | 1 |
| 493 | } | - |
| 494 | | - |
| 495 | /*! | - |
| 496 | Clears the lineedit of all text but prefix and suffix. | - |
| 497 | */ | - |
| 498 | | - |
| 499 | void QAbstractSpinBox::clear() | - |
| 500 | { | - |
| 501 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 502 | | - |
| 503 | d->edit->setText(d->prefix + d->suffix); executed (the execution status of this line is deduced): d->edit->setText(d->prefix + d->suffix); | - |
| 504 | d->edit->setCursorPosition(d->prefix.size()); executed (the execution status of this line is deduced): d->edit->setCursorPosition(d->prefix.size()); | - |
| 505 | d->cleared = true; executed (the execution status of this line is deduced): d->cleared = true; | - |
| 506 | } executed: }Execution Count:4 | 4 |
| 507 | | - |
| 508 | /*! | - |
| 509 | Virtual function that determines whether stepping up and down is | - |
| 510 | legal at any given time. | - |
| 511 | | - |
| 512 | The up arrow will be painted as disabled unless (stepEnabled() & | - |
| 513 | StepUpEnabled) != 0. | - |
| 514 | | - |
| 515 | The default implementation will return (StepUpEnabled| | - |
| 516 | StepDownEnabled) if wrapping is turned on. Else it will return | - |
| 517 | StepDownEnabled if value is > minimum() or'ed with StepUpEnabled if | - |
| 518 | value < maximum(). | - |
| 519 | | - |
| 520 | If you subclass QAbstractSpinBox you will need to reimplement this function. | - |
| 521 | | - |
| 522 | \sa QSpinBox::minimum(), QSpinBox::maximum(), wrapping() | - |
| 523 | */ | - |
| 524 | | - |
| 525 | | - |
| 526 | QAbstractSpinBox::StepEnabled QAbstractSpinBox::stepEnabled() const | - |
| 527 | { | - |
| 528 | Q_D(const QAbstractSpinBox); executed (the execution status of this line is deduced): const QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 529 | if (d->readOnly || d->type == QVariant::Invalid) evaluated: d->readOnly| yes Evaluation Count:2 | yes Evaluation Count:1721 |
evaluated: d->type == QVariant::Invalid| yes Evaluation Count:4 | yes Evaluation Count:1717 |
| 2-1721 |
| 530 | return StepNone; executed: return StepNone;Execution Count:6 | 6 |
| 531 | if (d->wrapping) evaluated: d->wrapping| yes Evaluation Count:40 | yes Evaluation Count:1677 |
| 40-1677 |
| 532 | return StepEnabled(StepUpEnabled | StepDownEnabled); executed: return StepEnabled(StepUpEnabled | StepDownEnabled);Execution Count:40 | 40 |
| 533 | StepEnabled ret = StepNone; executed (the execution status of this line is deduced): StepEnabled ret = StepNone; | - |
| 534 | if (d->variantCompare(d->value, d->maximum) < 0) { evaluated: d->variantCompare(d->value, d->maximum) < 0| yes Evaluation Count:1597 | yes Evaluation Count:80 |
| 80-1597 |
| 535 | ret |= StepUpEnabled; executed (the execution status of this line is deduced): ret |= StepUpEnabled; | - |
| 536 | } executed: }Execution Count:1597 | 1597 |
| 537 | if (d->variantCompare(d->value, d->minimum) > 0) { evaluated: d->variantCompare(d->value, d->minimum) > 0| yes Evaluation Count:308 | yes Evaluation Count:1369 |
| 308-1369 |
| 538 | ret |= StepDownEnabled; executed (the execution status of this line is deduced): ret |= StepDownEnabled; | - |
| 539 | } executed: }Execution Count:308 | 308 |
| 540 | return ret; executed: return ret;Execution Count:1677 | 1677 |
| 541 | } | - |
| 542 | | - |
| 543 | /*! | - |
| 544 | This virtual function is called by the QAbstractSpinBox to | - |
| 545 | determine whether \a input is valid. The \a pos parameter indicates | - |
| 546 | the position in the string. Reimplemented in the various | - |
| 547 | subclasses. | - |
| 548 | */ | - |
| 549 | | - |
| 550 | QValidator::State QAbstractSpinBox::validate(QString & /* input */, int & /* pos */) const | - |
| 551 | { | - |
| 552 | return QValidator::Acceptable; never executed: return QValidator::Acceptable; | 0 |
| 553 | } | - |
| 554 | | - |
| 555 | /*! | - |
| 556 | This virtual function is called by the QAbstractSpinBox if the | - |
| 557 | \a input is not validated to QValidator::Acceptable when Return is | - |
| 558 | pressed or interpretText() is called. It will try to change the | - |
| 559 | text so it is valid. Reimplemented in the various subclasses. | - |
| 560 | */ | - |
| 561 | | - |
| 562 | void QAbstractSpinBox::fixup(QString & /* input */) const | - |
| 563 | { | - |
| 564 | } | - |
| 565 | | - |
| 566 | /*! | - |
| 567 | Steps up by one linestep | - |
| 568 | Calling this slot is analogous to calling stepBy(1); | - |
| 569 | \sa stepBy(), stepDown() | - |
| 570 | */ | - |
| 571 | | - |
| 572 | void QAbstractSpinBox::stepUp() | - |
| 573 | { | - |
| 574 | stepBy(1); executed (the execution status of this line is deduced): stepBy(1); | - |
| 575 | } executed: }Execution Count:4 | 4 |
| 576 | | - |
| 577 | /*! | - |
| 578 | Steps down by one linestep | - |
| 579 | Calling this slot is analogous to calling stepBy(-1); | - |
| 580 | \sa stepBy(), stepUp() | - |
| 581 | */ | - |
| 582 | | - |
| 583 | void QAbstractSpinBox::stepDown() | - |
| 584 | { | - |
| 585 | stepBy(-1); executed (the execution status of this line is deduced): stepBy(-1); | - |
| 586 | } executed: }Execution Count:8 | 8 |
| 587 | /*! | - |
| 588 | Virtual function that is called whenever the user triggers a step. | - |
| 589 | The \a steps parameter indicates how many steps were taken, e.g. | - |
| 590 | Pressing Qt::Key_Down will trigger a call to stepBy(-1), | - |
| 591 | whereas pressing Qt::Key_Prior will trigger a call to | - |
| 592 | stepBy(10). | - |
| 593 | | - |
| 594 | If you subclass QAbstractSpinBox you must reimplement this | - |
| 595 | function. Note that this function is called even if the resulting | - |
| 596 | value will be outside the bounds of minimum and maximum. It's this | - |
| 597 | function's job to handle these situations. | - |
| 598 | */ | - |
| 599 | | - |
| 600 | void QAbstractSpinBox::stepBy(int steps) | - |
| 601 | { | - |
| 602 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 603 | | - |
| 604 | const QVariant old = d->value; executed (the execution status of this line is deduced): const QVariant old = d->value; | - |
| 605 | QString tmp = d->edit->displayText(); executed (the execution status of this line is deduced): QString tmp = d->edit->displayText(); | - |
| 606 | int cursorPos = d->edit->cursorPosition(); executed (the execution status of this line is deduced): int cursorPos = d->edit->cursorPosition(); | - |
| 607 | bool dontstep = false; executed (the execution status of this line is deduced): bool dontstep = false; | - |
| 608 | EmitPolicy e = EmitIfChanged; executed (the execution status of this line is deduced): EmitPolicy e = EmitIfChanged; | - |
| 609 | if (d->pendingEmit) { partially evaluated: d->pendingEmit| no Evaluation Count:0 | yes Evaluation Count:123 |
| 0-123 |
| 610 | dontstep = validate(tmp, cursorPos) != QValidator::Acceptable; never executed (the execution status of this line is deduced): dontstep = validate(tmp, cursorPos) != QValidator::Acceptable; | - |
| 611 | d->cleared = false; never executed (the execution status of this line is deduced): d->cleared = false; | - |
| 612 | d->interpret(NeverEmit); never executed (the execution status of this line is deduced): d->interpret(NeverEmit); | - |
| 613 | if (d->value != old) never evaluated: d->value != old | 0 |
| 614 | e = AlwaysEmit; never executed: e = AlwaysEmit; | 0 |
| 615 | } | 0 |
| 616 | if (!dontstep) { partially evaluated: !dontstep| yes Evaluation Count:123 | no Evaluation Count:0 |
| 0-123 |
| 617 | d->setValue(d->bound(d->value + (d->singleStep * steps), old, steps), e); executed (the execution status of this line is deduced): d->setValue(d->bound(d->value + (d->singleStep * steps), old, steps), e); | - |
| 618 | } else if (e == AlwaysEmit) { executed: }Execution Count:123 never evaluated: e == AlwaysEmit | 0-123 |
| 619 | d->emitSignals(e, old); never executed (the execution status of this line is deduced): d->emitSignals(e, old); | - |
| 620 | } | 0 |
| 621 | selectAll(); executed (the execution status of this line is deduced): selectAll(); | - |
| 622 | } executed: }Execution Count:123 | 123 |
| 623 | | - |
| 624 | /*! | - |
| 625 | This function returns a pointer to the line edit of the spin box. | - |
| 626 | */ | - |
| 627 | | - |
| 628 | QLineEdit *QAbstractSpinBox::lineEdit() const | - |
| 629 | { | - |
| 630 | Q_D(const QAbstractSpinBox); executed (the execution status of this line is deduced): const QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 631 | | - |
| 632 | return d->edit; executed: return d->edit;Execution Count:447 | 447 |
| 633 | } | - |
| 634 | | - |
| 635 | | - |
| 636 | /*! | - |
| 637 | \fn void QAbstractSpinBox::setLineEdit(QLineEdit *lineEdit) | - |
| 638 | | - |
| 639 | Sets the line edit of the spinbox to be \a lineEdit instead of the | - |
| 640 | current line edit widget. \a lineEdit can not be 0. | - |
| 641 | | - |
| 642 | QAbstractSpinBox takes ownership of the new lineEdit | - |
| 643 | | - |
| 644 | If QLineEdit::validator() for the \a lineEdit returns 0, the internal | - |
| 645 | validator of the spinbox will be set on the line edit. | - |
| 646 | */ | - |
| 647 | | - |
| 648 | void QAbstractSpinBox::setLineEdit(QLineEdit *lineEdit) | - |
| 649 | { | - |
| 650 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 651 | | - |
| 652 | if (!lineEdit) { evaluated: !lineEdit| yes Evaluation Count:1 | yes Evaluation Count:394 |
| 1-394 |
| 653 | Q_ASSERT(lineEdit); executed (the execution status of this line is deduced): qt_noop(); | - |
| 654 | return; executed: return;Execution Count:1 | 1 |
| 655 | } | - |
| 656 | delete d->edit; executed (the execution status of this line is deduced): delete d->edit; | - |
| 657 | d->edit = lineEdit; executed (the execution status of this line is deduced): d->edit = lineEdit; | - |
| 658 | if (!d->edit->validator()) partially evaluated: !d->edit->validator()| yes Evaluation Count:394 | no Evaluation Count:0 |
| 0-394 |
| 659 | d->edit->setValidator(d->validator); executed: d->edit->setValidator(d->validator);Execution Count:394 | 394 |
| 660 | | - |
| 661 | if (d->edit->parent() != this) evaluated: d->edit->parent() != this| yes Evaluation Count:1 | yes Evaluation Count:393 |
| 1-393 |
| 662 | d->edit->setParent(this); executed: d->edit->setParent(this);Execution Count:1 | 1 |
| 663 | | - |
| 664 | d->edit->setFrame(false); executed (the execution status of this line is deduced): d->edit->setFrame(false); | - |
| 665 | d->edit->setFocusProxy(this); executed (the execution status of this line is deduced): d->edit->setFocusProxy(this); | - |
| 666 | d->edit->setAcceptDrops(false); executed (the execution status of this line is deduced): d->edit->setAcceptDrops(false); | - |
| 667 | | - |
| 668 | if (d->type != QVariant::Invalid) { evaluated: d->type != QVariant::Invalid| yes Evaluation Count:392 | yes Evaluation Count:2 |
| 2-392 |
| 669 | connect(d->edit, SIGNAL(textChanged(QString)), executed (the execution status of this line is deduced): connect(d->edit, "2""textChanged(QString)", | - |
| 670 | this, SLOT(_q_editorTextChanged(QString))); executed (the execution status of this line is deduced): this, "1""_q_editorTextChanged(QString)"); | - |
| 671 | connect(d->edit, SIGNAL(cursorPositionChanged(int,int)), executed (the execution status of this line is deduced): connect(d->edit, "2""cursorPositionChanged(int,int)", | - |
| 672 | this, SLOT(_q_editorCursorPositionChanged(int,int))); executed (the execution status of this line is deduced): this, "1""_q_editorCursorPositionChanged(int,int)"); | - |
| 673 | } executed: }Execution Count:392 | 392 |
| 674 | d->updateEditFieldGeometry(); executed (the execution status of this line is deduced): d->updateEditFieldGeometry(); | - |
| 675 | d->edit->setContextMenuPolicy(Qt::NoContextMenu); executed (the execution status of this line is deduced): d->edit->setContextMenuPolicy(Qt::NoContextMenu); | - |
| 676 | | - |
| 677 | if (isVisible()) partially evaluated: isVisible()| no Evaluation Count:0 | yes Evaluation Count:394 |
| 0-394 |
| 678 | d->edit->show(); never executed: d->edit->show(); | 0 |
| 679 | if (isVisible()) partially evaluated: isVisible()| no Evaluation Count:0 | yes Evaluation Count:394 |
| 0-394 |
| 680 | d->updateEdit(); never executed: d->updateEdit(); | 0 |
| 681 | } executed: }Execution Count:394 | 394 |
| 682 | | - |
| 683 | | - |
| 684 | /*! | - |
| 685 | This function interprets the text of the spin box. If the value | - |
| 686 | has changed since last interpretation it will emit signals. | - |
| 687 | */ | - |
| 688 | | - |
| 689 | void QAbstractSpinBox::interpretText() | - |
| 690 | { | - |
| 691 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 692 | d->interpret(EmitIfChanged); executed (the execution status of this line is deduced): d->interpret(EmitIfChanged); | - |
| 693 | } executed: }Execution Count:3 | 3 |
| 694 | | - |
| 695 | /* | - |
| 696 | Reimplemented in 4.6, so be careful. | - |
| 697 | */ | - |
| 698 | /*! | - |
| 699 | \reimp | - |
| 700 | */ | - |
| 701 | QVariant QAbstractSpinBox::inputMethodQuery(Qt::InputMethodQuery query) const | - |
| 702 | { | - |
| 703 | Q_D(const QAbstractSpinBox); executed (the execution status of this line is deduced): const QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 704 | return d->edit->inputMethodQuery(query); executed: return d->edit->inputMethodQuery(query);Execution Count:461 | 461 |
| 705 | } | - |
| 706 | | - |
| 707 | /*! | - |
| 708 | \reimp | - |
| 709 | */ | - |
| 710 | | - |
| 711 | bool QAbstractSpinBox::event(QEvent *event) | - |
| 712 | { | - |
| 713 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 714 | switch (event->type()) { | - |
| 715 | case QEvent::FontChange: | - |
| 716 | case QEvent::StyleChange: | - |
| 717 | d->cachedSizeHint = d->cachedMinimumSizeHint = QSize(); executed (the execution status of this line is deduced): d->cachedSizeHint = d->cachedMinimumSizeHint = QSize(); | - |
| 718 | break; executed: break;Execution Count:2 | 2 |
| 719 | case QEvent::ApplicationLayoutDirectionChange: | - |
| 720 | case QEvent::LayoutDirectionChange: | - |
| 721 | d->updateEditFieldGeometry(); executed (the execution status of this line is deduced): d->updateEditFieldGeometry(); | - |
| 722 | break; executed: break;Execution Count:6 | 6 |
| 723 | case QEvent::HoverEnter: | - |
| 724 | case QEvent::HoverLeave: | - |
| 725 | case QEvent::HoverMove: | - |
| 726 | if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event)) never evaluated: const QHoverEvent *he = static_cast<const QHoverEvent *>(event) | 0 |
| 727 | d->updateHoverControl(he->pos()); never executed: d->updateHoverControl(he->pos()); | 0 |
| 728 | break; | 0 |
| 729 | case QEvent::ShortcutOverride: | - |
| 730 | if (d->edit->event(event)) partially evaluated: d->edit->event(event)| yes Evaluation Count:2393 | no Evaluation Count:0 |
| 0-2393 |
| 731 | return true; executed: return true;Execution Count:2393 | 2393 |
| 732 | break; | 0 |
| 733 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 734 | case QEvent::EnterEditFocus: | - |
| 735 | case QEvent::LeaveEditFocus: | - |
| 736 | if (QApplication::keypadNavigationEnabled()) { | - |
| 737 | const bool b = d->edit->event(event); | - |
| 738 | d->edit->setSelection(d->edit->displayText().size() - d->suffix.size(),0); | - |
| 739 | if (event->type() == QEvent::LeaveEditFocus) | - |
| 740 | emit editingFinished(); | - |
| 741 | if (b) | - |
| 742 | return true; | - |
| 743 | } | - |
| 744 | break; | - |
| 745 | #endif | - |
| 746 | case QEvent::InputMethod: | - |
| 747 | return d->edit->event(event); never executed: return d->edit->event(event); | 0 |
| 748 | default: | - |
| 749 | break; executed: break;Execution Count:9267 | 9267 |
| 750 | } | - |
| 751 | return QWidget::event(event); executed: return QWidget::event(event);Execution Count:9275 | 9275 |
| 752 | } | - |
| 753 | | - |
| 754 | /*! | - |
| 755 | \reimp | - |
| 756 | */ | - |
| 757 | | - |
| 758 | void QAbstractSpinBox::showEvent(QShowEvent *) | - |
| 759 | { | - |
| 760 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 761 | d->reset(); executed (the execution status of this line is deduced): d->reset(); | - |
| 762 | | - |
| 763 | if (d->ignoreUpdateEdit) { evaluated: d->ignoreUpdateEdit| yes Evaluation Count:1 | yes Evaluation Count:265 |
| 1-265 |
| 764 | d->ignoreUpdateEdit = false; executed (the execution status of this line is deduced): d->ignoreUpdateEdit = false; | - |
| 765 | } else { executed: }Execution Count:1 | 1 |
| 766 | d->updateEdit(); executed (the execution status of this line is deduced): d->updateEdit(); | - |
| 767 | } executed: }Execution Count:265 | 265 |
| 768 | } | - |
| 769 | | - |
| 770 | /*! | - |
| 771 | \reimp | - |
| 772 | */ | - |
| 773 | | - |
| 774 | void QAbstractSpinBox::changeEvent(QEvent *event) | - |
| 775 | { | - |
| 776 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 777 | | - |
| 778 | switch (event->type()) { | - |
| 779 | case QEvent::StyleChange: | - |
| 780 | d->spinClickTimerInterval = style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatRate, 0, this); executed (the execution status of this line is deduced): d->spinClickTimerInterval = style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatRate, 0, this); | - |
| 781 | d->spinClickThresholdTimerInterval = executed (the execution status of this line is deduced): d->spinClickThresholdTimerInterval = | - |
| 782 | style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatThreshold, 0, this); executed (the execution status of this line is deduced): style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatThreshold, 0, this); | - |
| 783 | d->reset(); executed (the execution status of this line is deduced): d->reset(); | - |
| 784 | d->updateEditFieldGeometry(); executed (the execution status of this line is deduced): d->updateEditFieldGeometry(); | - |
| 785 | break; executed: break;Execution Count:2 | 2 |
| 786 | case QEvent::EnabledChange: | - |
| 787 | if (!isEnabled()) { partially evaluated: !isEnabled()| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-6 |
| 788 | d->reset(); executed (the execution status of this line is deduced): d->reset(); | - |
| 789 | } executed: }Execution Count:6 | 6 |
| 790 | break; executed: break;Execution Count:6 | 6 |
| 791 | case QEvent::ActivationChange: | - |
| 792 | if (!isActiveWindow()){ evaluated: !isActiveWindow()| yes Evaluation Count:36 | yes Evaluation Count:74 |
| 36-74 |
| 793 | d->reset(); executed (the execution status of this line is deduced): d->reset(); | - |
| 794 | if (d->pendingEmit) // pendingEmit can be true even if it hasn't changed. evaluated: d->pendingEmit| yes Evaluation Count:1 | yes Evaluation Count:35 |
| 1-35 |
| 795 | d->interpret(EmitIfChanged); // E.g. 10 to 10.0 executed: d->interpret(EmitIfChanged);Execution Count:1 | 1 |
| 796 | } executed: }Execution Count:36 | 36 |
| 797 | break; executed: break;Execution Count:110 | 110 |
| 798 | default: | - |
| 799 | break; executed: break;Execution Count:15 | 15 |
| 800 | } | - |
| 801 | QWidget::changeEvent(event); executed (the execution status of this line is deduced): QWidget::changeEvent(event); | - |
| 802 | } executed: }Execution Count:133 | 133 |
| 803 | | - |
| 804 | /*! | - |
| 805 | \reimp | - |
| 806 | */ | - |
| 807 | | - |
| 808 | void QAbstractSpinBox::resizeEvent(QResizeEvent *event) | - |
| 809 | { | - |
| 810 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 811 | QWidget::resizeEvent(event); executed (the execution status of this line is deduced): QWidget::resizeEvent(event); | - |
| 812 | | - |
| 813 | d->updateEditFieldGeometry(); executed (the execution status of this line is deduced): d->updateEditFieldGeometry(); | - |
| 814 | update(); executed (the execution status of this line is deduced): update(); | - |
| 815 | } executed: }Execution Count:297 | 297 |
| 816 | | - |
| 817 | /*! | - |
| 818 | \reimp | - |
| 819 | */ | - |
| 820 | | - |
| 821 | QSize QAbstractSpinBox::sizeHint() const | - |
| 822 | { | - |
| 823 | Q_D(const QAbstractSpinBox); executed (the execution status of this line is deduced): const QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 824 | if (d->cachedSizeHint.isEmpty()) { partially evaluated: d->cachedSizeHint.isEmpty()| yes Evaluation Count:236 | no Evaluation Count:0 |
| 0-236 |
| 825 | ensurePolished(); executed (the execution status of this line is deduced): ensurePolished(); | - |
| 826 | | - |
| 827 | const QFontMetrics fm(fontMetrics()); executed (the execution status of this line is deduced): const QFontMetrics fm(fontMetrics()); | - |
| 828 | int h = d->edit->sizeHint().height() + 4; executed (the execution status of this line is deduced): int h = d->edit->sizeHint().height() + 4; | - |
| 829 | int w = 0; executed (the execution status of this line is deduced): int w = 0; | - |
| 830 | QString s; executed (the execution status of this line is deduced): QString s; | - |
| 831 | s = d->prefix + d->textFromValue(d->minimum) + d->suffix + QLatin1Char(' '); executed (the execution status of this line is deduced): s = d->prefix + d->textFromValue(d->minimum) + d->suffix + QLatin1Char(' '); | - |
| 832 | s.truncate(18); executed (the execution status of this line is deduced): s.truncate(18); | - |
| 833 | w = qMax(w, fm.width(s)); executed (the execution status of this line is deduced): w = qMax(w, fm.width(s)); | - |
| 834 | s = d->prefix + d->textFromValue(d->maximum) + d->suffix + QLatin1Char(' '); executed (the execution status of this line is deduced): s = d->prefix + d->textFromValue(d->maximum) + d->suffix + QLatin1Char(' '); | - |
| 835 | s.truncate(18); executed (the execution status of this line is deduced): s.truncate(18); | - |
| 836 | w = qMax(w, fm.width(s)); executed (the execution status of this line is deduced): w = qMax(w, fm.width(s)); | - |
| 837 | if (d->specialValueText.size()) { evaluated: d->specialValueText.size()| yes Evaluation Count:3 | yes Evaluation Count:233 |
| 3-233 |
| 838 | s = d->specialValueText; executed (the execution status of this line is deduced): s = d->specialValueText; | - |
| 839 | w = qMax(w, fm.width(s)); executed (the execution status of this line is deduced): w = qMax(w, fm.width(s)); | - |
| 840 | } executed: }Execution Count:3 | 3 |
| 841 | w += 2; // cursor blinking space executed (the execution status of this line is deduced): w += 2; | - |
| 842 | | - |
| 843 | QStyleOptionSpinBox opt; executed (the execution status of this line is deduced): QStyleOptionSpinBox opt; | - |
| 844 | initStyleOption(&opt); executed (the execution status of this line is deduced): initStyleOption(&opt); | - |
| 845 | QSize hint(w, h); executed (the execution status of this line is deduced): QSize hint(w, h); | - |
| 846 | d->cachedSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this) executed (the execution status of this line is deduced): d->cachedSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this) | - |
| 847 | .expandedTo(QApplication::globalStrut()); executed (the execution status of this line is deduced): .expandedTo(QApplication::globalStrut()); | - |
| 848 | } executed: }Execution Count:236 | 236 |
| 849 | return d->cachedSizeHint; executed: return d->cachedSizeHint;Execution Count:236 | 236 |
| 850 | } | - |
| 851 | | - |
| 852 | /*! | - |
| 853 | \reimp | - |
| 854 | */ | - |
| 855 | | - |
| 856 | QSize QAbstractSpinBox::minimumSizeHint() const | - |
| 857 | { | - |
| 858 | Q_D(const QAbstractSpinBox); executed (the execution status of this line is deduced): const QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 859 | if (d->cachedMinimumSizeHint.isEmpty()) { evaluated: d->cachedMinimumSizeHint.isEmpty()| yes Evaluation Count:54 | yes Evaluation Count:4 |
| 4-54 |
| 860 | ensurePolished(); executed (the execution status of this line is deduced): ensurePolished(); | - |
| 861 | | - |
| 862 | const QFontMetrics fm(fontMetrics()); executed (the execution status of this line is deduced): const QFontMetrics fm(fontMetrics()); | - |
| 863 | int h = d->edit->minimumSizeHint().height(); executed (the execution status of this line is deduced): int h = d->edit->minimumSizeHint().height(); | - |
| 864 | int w = fm.width(QLatin1String("1000")); executed (the execution status of this line is deduced): int w = fm.width(QLatin1String("1000")); | - |
| 865 | w += 2; // cursor blinking space executed (the execution status of this line is deduced): w += 2; | - |
| 866 | | - |
| 867 | QStyleOptionSpinBox opt; executed (the execution status of this line is deduced): QStyleOptionSpinBox opt; | - |
| 868 | initStyleOption(&opt); executed (the execution status of this line is deduced): initStyleOption(&opt); | - |
| 869 | QSize hint(w, h); executed (the execution status of this line is deduced): QSize hint(w, h); | - |
| 870 | QSize extra(35, 6); executed (the execution status of this line is deduced): QSize extra(35, 6); | - |
| 871 | opt.rect.setSize(hint + extra); executed (the execution status of this line is deduced): opt.rect.setSize(hint + extra); | - |
| 872 | extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt, executed (the execution status of this line is deduced): extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt, | - |
| 873 | QStyle::SC_SpinBoxEditField, this).size(); executed (the execution status of this line is deduced): QStyle::SC_SpinBoxEditField, this).size(); | - |
| 874 | // get closer to final result by repeating the calculation | - |
| 875 | opt.rect.setSize(hint + extra); executed (the execution status of this line is deduced): opt.rect.setSize(hint + extra); | - |
| 876 | extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt, executed (the execution status of this line is deduced): extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt, | - |
| 877 | QStyle::SC_SpinBoxEditField, this).size(); executed (the execution status of this line is deduced): QStyle::SC_SpinBoxEditField, this).size(); | - |
| 878 | hint += extra; executed (the execution status of this line is deduced): hint += extra; | - |
| 879 | | - |
| 880 | opt.rect = rect(); executed (the execution status of this line is deduced): opt.rect = rect(); | - |
| 881 | | - |
| 882 | d->cachedMinimumSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this) executed (the execution status of this line is deduced): d->cachedMinimumSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this) | - |
| 883 | .expandedTo(QApplication::globalStrut()); executed (the execution status of this line is deduced): .expandedTo(QApplication::globalStrut()); | - |
| 884 | } executed: }Execution Count:54 | 54 |
| 885 | return d->cachedMinimumSizeHint; executed: return d->cachedMinimumSizeHint;Execution Count:58 | 58 |
| 886 | } | - |
| 887 | | - |
| 888 | /*! | - |
| 889 | \reimp | - |
| 890 | */ | - |
| 891 | | - |
| 892 | void QAbstractSpinBox::paintEvent(QPaintEvent *) | - |
| 893 | { | - |
| 894 | QStyleOptionSpinBox opt; executed (the execution status of this line is deduced): QStyleOptionSpinBox opt; | - |
| 895 | initStyleOption(&opt); executed (the execution status of this line is deduced): initStyleOption(&opt); | - |
| 896 | QStylePainter p(this); executed (the execution status of this line is deduced): QStylePainter p(this); | - |
| 897 | p.drawComplexControl(QStyle::CC_SpinBox, opt); executed (the execution status of this line is deduced): p.drawComplexControl(QStyle::CC_SpinBox, opt); | - |
| 898 | } executed: }Execution Count:196 | 196 |
| 899 | | - |
| 900 | /*! | - |
| 901 | \reimp | - |
| 902 | | - |
| 903 | This function handles keyboard input. | - |
| 904 | | - |
| 905 | The following keys are handled specifically: | - |
| 906 | \table | - |
| 907 | \row \li Enter/Return | - |
| 908 | \li This will reinterpret the text and emit a signal even if the value has not changed | - |
| 909 | since last time a signal was emitted. | - |
| 910 | \row \li Up | - |
| 911 | \li This will invoke stepBy(1) | - |
| 912 | \row \li Down | - |
| 913 | \li This will invoke stepBy(-1) | - |
| 914 | \row \li Page up | - |
| 915 | \li This will invoke stepBy(10) | - |
| 916 | \row \li Page down | - |
| 917 | \li This will invoke stepBy(-10) | - |
| 918 | \endtable | - |
| 919 | */ | - |
| 920 | | - |
| 921 | | - |
| 922 | void QAbstractSpinBox::keyPressEvent(QKeyEvent *event) | - |
| 923 | { | - |
| 924 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 925 | | - |
| 926 | if (!event->text().isEmpty() && d->edit->cursorPosition() < d->prefix.size()) evaluated: !event->text().isEmpty()| yes Evaluation Count:805 | yes Evaluation Count:1284 |
partially evaluated: d->edit->cursorPosition() < d->prefix.size()| no Evaluation Count:0 | yes Evaluation Count:805 |
| 0-1284 |
| 927 | d->edit->setCursorPosition(d->prefix.size()); never executed: d->edit->setCursorPosition(d->prefix.size()); | 0 |
| 928 | | - |
| 929 | int steps = 1; executed (the execution status of this line is deduced): int steps = 1; | - |
| 930 | bool isPgUpOrDown = false; executed (the execution status of this line is deduced): bool isPgUpOrDown = false; | - |
| 931 | switch (event->key()) { | - |
| 932 | case Qt::Key_PageUp: | - |
| 933 | case Qt::Key_PageDown: | - |
| 934 | steps *= 10; executed (the execution status of this line is deduced): steps *= 10; | - |
| 935 | isPgUpOrDown = true; executed (the execution status of this line is deduced): isPgUpOrDown = true; | - |
| 936 | case Qt::Key_Up: | - |
| 937 | case Qt::Key_Down: { | - |
| 938 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 939 | if (QApplication::keypadNavigationEnabled()) { | - |
| 940 | // Reserve up/down for nav - use left/right for edit. | - |
| 941 | if (!hasEditFocus() && (event->key() == Qt::Key_Up | - |
| 942 | || event->key() == Qt::Key_Down)) { | - |
| 943 | event->ignore(); | - |
| 944 | return; | - |
| 945 | } | - |
| 946 | } | - |
| 947 | #endif | - |
| 948 | event->accept(); executed (the execution status of this line is deduced): event->accept(); | - |
| 949 | const bool up = (event->key() == Qt::Key_PageUp || event->key() == Qt::Key_Up); evaluated: event->key() == Qt::Key_PageUp| yes Evaluation Count:2 | yes Evaluation Count:1018 |
evaluated: event->key() == Qt::Key_Up| yes Evaluation Count:806 | yes Evaluation Count:212 |
| 2-1018 |
| 950 | if (!(stepEnabled() & (up ? StepUpEnabled : StepDownEnabled))) evaluated: !(stepEnabled() & (up ? StepUpEnabled : StepDownEnabled))| yes Evaluation Count:49 | yes Evaluation Count:971 |
| 49-971 |
| 951 | return; executed: return;Execution Count:49 | 49 |
| 952 | if (!up) evaluated: !up| yes Evaluation Count:206 | yes Evaluation Count:765 |
| 206-765 |
| 953 | steps *= -1; executed: steps *= -1;Execution Count:206 | 206 |
| 954 | if (style()->styleHint(QStyle::SH_SpinBox_AnimateButton, 0, this)) { partially evaluated: style()->styleHint(QStyle::SH_SpinBox_AnimateButton, 0, this)| no Evaluation Count:0 | yes Evaluation Count:971 |
| 0-971 |
| 955 | d->buttonState = (Keyboard | (up ? Up : Down)); never executed (the execution status of this line is deduced): d->buttonState = (Keyboard | (up ? Up : Down)); | - |
| 956 | } | 0 |
| 957 | if (d->spinClickTimerId == -1) partially evaluated: d->spinClickTimerId == -1| yes Evaluation Count:971 | no Evaluation Count:0 |
| 0-971 |
| 958 | stepBy(steps); executed: stepBy(steps);Execution Count:971 | 971 |
| 959 | if(event->isAutoRepeat() && !isPgUpOrDown) { partially evaluated: event->isAutoRepeat()| no Evaluation Count:0 | yes Evaluation Count:971 |
never evaluated: !isPgUpOrDown | 0-971 |
| 960 | if(d->spinClickThresholdTimerId == -1 && d->spinClickTimerId == -1) { never evaluated: d->spinClickThresholdTimerId == -1 never evaluated: d->spinClickTimerId == -1 | 0 |
| 961 | d->updateState(up, true); never executed (the execution status of this line is deduced): d->updateState(up, true); | - |
| 962 | } | 0 |
| 963 | } | 0 |
| 964 | #ifndef QT_NO_ACCESSIBILITY | - |
| 965 | QAccessibleValueChangeEvent event(this, d->value); executed (the execution status of this line is deduced): QAccessibleValueChangeEvent event(this, d->value); | - |
| 966 | QAccessible::updateAccessibility(&event); executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event); | - |
| 967 | #endif | - |
| 968 | return; executed: return;Execution Count:971 | 971 |
| 969 | } | - |
| 970 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 971 | case Qt::Key_Left: | - |
| 972 | case Qt::Key_Right: | - |
| 973 | if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) { | - |
| 974 | event->ignore(); | - |
| 975 | return; | - |
| 976 | } | - |
| 977 | break; | - |
| 978 | case Qt::Key_Back: | - |
| 979 | if (QApplication::keypadNavigationEnabled() && !hasEditFocus()) { | - |
| 980 | event->ignore(); | - |
| 981 | return; | - |
| 982 | } | - |
| 983 | break; | - |
| 984 | #endif | - |
| 985 | case Qt::Key_Enter: | - |
| 986 | case Qt::Key_Return: | - |
| 987 | d->edit->d_func()->control->clearUndo(); executed (the execution status of this line is deduced): d->edit->d_func()->control->clearUndo(); | - |
| 988 | d->interpret(d->keyboardTracking ? AlwaysEmit : EmitIfChanged); executed (the execution status of this line is deduced): d->interpret(d->keyboardTracking ? AlwaysEmit : EmitIfChanged); | - |
| 989 | selectAll(); executed (the execution status of this line is deduced): selectAll(); | - |
| 990 | event->ignore(); executed (the execution status of this line is deduced): event->ignore(); | - |
| 991 | emit editingFinished(); executed (the execution status of this line is deduced): editingFinished(); | - |
| 992 | return; executed: return;Execution Count:28 | 28 |
| 993 | | - |
| 994 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 995 | case Qt::Key_Select: | - |
| 996 | if (QApplication::keypadNavigationEnabled()) { | - |
| 997 | // Toggles between left/right moving cursor and inc/dec. | - |
| 998 | setEditFocus(!hasEditFocus()); | - |
| 999 | } | - |
| 1000 | return; | - |
| 1001 | #endif | - |
| 1002 | | - |
| 1003 | case Qt::Key_U: | - |
| 1004 | if (event->modifiers() & Qt::ControlModifier partially evaluated: event->modifiers() & Qt::ControlModifier| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-2 |
| 1005 | && QGuiApplication::platformName() == QLatin1String("xcb")) { // only X11 never evaluated: QGuiApplication::platformName() == QLatin1String("xcb") | 0 |
| 1006 | event->accept(); never executed (the execution status of this line is deduced): event->accept(); | - |
| 1007 | if (!isReadOnly()) never evaluated: !isReadOnly() | 0 |
| 1008 | clear(); | 0 |
| 1009 | return; | 0 |
| 1010 | } | - |
| 1011 | break; executed: break;Execution Count:2 | 2 |
| 1012 | | - |
| 1013 | case Qt::Key_End: | - |
| 1014 | case Qt::Key_Home: | - |
| 1015 | if (event->modifiers() & Qt::ShiftModifier) { evaluated: event->modifiers() & Qt::ShiftModifier| yes Evaluation Count:2 | yes Evaluation Count:52 |
| 2-52 |
| 1016 | int currentPos = d->edit->cursorPosition(); executed (the execution status of this line is deduced): int currentPos = d->edit->cursorPosition(); | - |
| 1017 | const QString text = d->edit->displayText(); executed (the execution status of this line is deduced): const QString text = d->edit->displayText(); | - |
| 1018 | if (event->key() == Qt::Key_End) { partially evaluated: event->key() == Qt::Key_End| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 1019 | if ((currentPos == 0 && !d->prefix.isEmpty()) || text.size() - d->suffix.size() <= currentPos) { partially evaluated: currentPos == 0| yes Evaluation Count:2 | no Evaluation Count:0 |
partially evaluated: !d->prefix.isEmpty()| yes Evaluation Count:2 | no Evaluation Count:0 |
never evaluated: text.size() - d->suffix.size() <= currentPos | 0-2 |
| 1020 | break; // let lineedit handle this executed: break;Execution Count:2 | 2 |
| 1021 | } else { | - |
| 1022 | d->edit->setSelection(currentPos, text.size() - d->suffix.size() - currentPos); never executed (the execution status of this line is deduced): d->edit->setSelection(currentPos, text.size() - d->suffix.size() - currentPos); | - |
| 1023 | } | 0 |
| 1024 | } else { | - |
| 1025 | if ((currentPos == text.size() && !d->suffix.isEmpty()) || currentPos <= d->prefix.size()) { never evaluated: currentPos == text.size() never evaluated: !d->suffix.isEmpty() never evaluated: currentPos <= d->prefix.size() | 0 |
| 1026 | break; // let lineedit handle this | 0 |
| 1027 | } else { | - |
| 1028 | d->edit->setSelection(currentPos, d->prefix.size() - currentPos); never executed (the execution status of this line is deduced): d->edit->setSelection(currentPos, d->prefix.size() - currentPos); | - |
| 1029 | } | 0 |
| 1030 | } | - |
| 1031 | event->accept(); never executed (the execution status of this line is deduced): event->accept(); | - |
| 1032 | return; | 0 |
| 1033 | } | - |
| 1034 | break; executed: break;Execution Count:52 | 52 |
| 1035 | | - |
| 1036 | default: | - |
| 1037 | #ifndef QT_NO_SHORTCUT | - |
| 1038 | if (event == QKeySequence::SelectAll) { partially evaluated: event == QKeySequence::SelectAll| no Evaluation Count:0 | yes Evaluation Count:985 |
| 0-985 |
| 1039 | selectAll(); never executed (the execution status of this line is deduced): selectAll(); | - |
| 1040 | event->accept(); never executed (the execution status of this line is deduced): event->accept(); | - |
| 1041 | return; | 0 |
| 1042 | } | - |
| 1043 | #endif | - |
| 1044 | break; executed: break;Execution Count:985 | 985 |
| 1045 | } | - |
| 1046 | | - |
| 1047 | d->edit->event(event); executed (the execution status of this line is deduced): d->edit->event(event); | - |
| 1048 | if (!isVisible()) evaluated: !isVisible()| yes Evaluation Count:73 | yes Evaluation Count:968 |
| 73-968 |
| 1049 | d->ignoreUpdateEdit = true; executed: d->ignoreUpdateEdit = true;Execution Count:73 | 73 |
| 1050 | } executed: }Execution Count:1041 | 1041 |
| 1051 | | - |
| 1052 | /*! | - |
| 1053 | \reimp | - |
| 1054 | */ | - |
| 1055 | | - |
| 1056 | void QAbstractSpinBox::keyReleaseEvent(QKeyEvent *event) | - |
| 1057 | { | - |
| 1058 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 1059 | | - |
| 1060 | if (d->buttonState & Keyboard && !event->isAutoRepeat()) { partially evaluated: d->buttonState & Keyboard| no Evaluation Count:0 | yes Evaluation Count:2290 |
never evaluated: !event->isAutoRepeat() | 0-2290 |
| 1061 | d->reset(); never executed (the execution status of this line is deduced): d->reset(); | - |
| 1062 | } else { | 0 |
| 1063 | d->edit->event(event); executed (the execution status of this line is deduced): d->edit->event(event); | - |
| 1064 | } executed: }Execution Count:2290 | 2290 |
| 1065 | } | - |
| 1066 | | - |
| 1067 | /*! | - |
| 1068 | \reimp | - |
| 1069 | */ | - |
| 1070 | | - |
| 1071 | #ifndef QT_NO_WHEELEVENT | - |
| 1072 | void QAbstractSpinBox::wheelEvent(QWheelEvent *event) | - |
| 1073 | { | - |
| 1074 | const int steps = (event->delta() > 0 ? 1 : -1); partially evaluated: event->delta() > 0| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 1075 | if (stepEnabled() & (steps > 0 ? StepUpEnabled : StepDownEnabled)) partially evaluated: stepEnabled() & (steps > 0 ? StepUpEnabled : StepDownEnabled)| yes Evaluation Count:2 | no Evaluation Count:0 |
| 0-2 |
| 1076 | stepBy(event->modifiers() & Qt::ControlModifier ? steps * 10 : steps); executed: stepBy(event->modifiers() & Qt::ControlModifier ? steps * 10 : steps);Execution Count:2 | 2 |
| 1077 | event->accept(); executed (the execution status of this line is deduced): event->accept(); | - |
| 1078 | } executed: }Execution Count:2 | 2 |
| 1079 | #endif | - |
| 1080 | | - |
| 1081 | | - |
| 1082 | /*! | - |
| 1083 | \reimp | - |
| 1084 | */ | - |
| 1085 | void QAbstractSpinBox::focusInEvent(QFocusEvent *event) | - |
| 1086 | { | - |
| 1087 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 1088 | | - |
| 1089 | d->edit->event(event); executed (the execution status of this line is deduced): d->edit->event(event); | - |
| 1090 | if (event->reason() == Qt::TabFocusReason || event->reason() == Qt::BacktabFocusReason) { evaluated: event->reason() == Qt::TabFocusReason| yes Evaluation Count:22 | yes Evaluation Count:94 |
partially evaluated: event->reason() == Qt::BacktabFocusReason| no Evaluation Count:0 | yes Evaluation Count:94 |
| 0-94 |
| 1091 | selectAll(); executed (the execution status of this line is deduced): selectAll(); | - |
| 1092 | } executed: }Execution Count:22 | 22 |
| 1093 | QWidget::focusInEvent(event); executed (the execution status of this line is deduced): QWidget::focusInEvent(event); | - |
| 1094 | } executed: }Execution Count:116 | 116 |
| 1095 | | - |
| 1096 | /*! | - |
| 1097 | \reimp | - |
| 1098 | */ | - |
| 1099 | | - |
| 1100 | void QAbstractSpinBox::focusOutEvent(QFocusEvent *event) | - |
| 1101 | { | - |
| 1102 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 1103 | | - |
| 1104 | if (d->pendingEmit) evaluated: d->pendingEmit| yes Evaluation Count:1 | yes Evaluation Count:56 |
| 1-56 |
| 1105 | d->interpret(EmitIfChanged); executed: d->interpret(EmitIfChanged);Execution Count:1 | 1 |
| 1106 | | - |
| 1107 | d->reset(); executed (the execution status of this line is deduced): d->reset(); | - |
| 1108 | d->edit->event(event); executed (the execution status of this line is deduced): d->edit->event(event); | - |
| 1109 | d->updateEdit(); executed (the execution status of this line is deduced): d->updateEdit(); | - |
| 1110 | QWidget::focusOutEvent(event); executed (the execution status of this line is deduced): QWidget::focusOutEvent(event); | - |
| 1111 | | - |
| 1112 | #ifdef QT_KEYPAD_NAVIGATION | - |
| 1113 | // editingFinished() is already emitted on LeaveEditFocus | - |
| 1114 | if (!QApplication::keypadNavigationEnabled()) | - |
| 1115 | #endif | - |
| 1116 | emit editingFinished(); executed (the execution status of this line is deduced): editingFinished(); | - |
| 1117 | } executed: }Execution Count:57 | 57 |
| 1118 | | - |
| 1119 | /*! | - |
| 1120 | \reimp | - |
| 1121 | */ | - |
| 1122 | | - |
| 1123 | void QAbstractSpinBox::closeEvent(QCloseEvent *event) | - |
| 1124 | { | - |
| 1125 | Q_D(QAbstractSpinBox); never executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 1126 | | - |
| 1127 | d->reset(); never executed (the execution status of this line is deduced): d->reset(); | - |
| 1128 | if (d->pendingEmit) never evaluated: d->pendingEmit | 0 |
| 1129 | d->interpret(EmitIfChanged); never executed: d->interpret(EmitIfChanged); | 0 |
| 1130 | QWidget::closeEvent(event); never executed (the execution status of this line is deduced): QWidget::closeEvent(event); | - |
| 1131 | } | 0 |
| 1132 | | - |
| 1133 | /*! | - |
| 1134 | \reimp | - |
| 1135 | */ | - |
| 1136 | | - |
| 1137 | void QAbstractSpinBox::hideEvent(QHideEvent *event) | - |
| 1138 | { | - |
| 1139 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 1140 | d->reset(); executed (the execution status of this line is deduced): d->reset(); | - |
| 1141 | if (d->pendingEmit) evaluated: d->pendingEmit| yes Evaluation Count:1 | yes Evaluation Count:65 |
| 1-65 |
| 1142 | d->interpret(EmitIfChanged); executed: d->interpret(EmitIfChanged);Execution Count:1 | 1 |
| 1143 | QWidget::hideEvent(event); executed (the execution status of this line is deduced): QWidget::hideEvent(event); | - |
| 1144 | } executed: }Execution Count:66 | 66 |
| 1145 | | - |
| 1146 | | - |
| 1147 | /*! | - |
| 1148 | \reimp | - |
| 1149 | */ | - |
| 1150 | | - |
| 1151 | void QAbstractSpinBox::timerEvent(QTimerEvent *event) | - |
| 1152 | { | - |
| 1153 | Q_D(QAbstractSpinBox); never executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 1154 | | - |
| 1155 | bool doStep = false; never executed (the execution status of this line is deduced): bool doStep = false; | - |
| 1156 | if (event->timerId() == d->spinClickThresholdTimerId) { never evaluated: event->timerId() == d->spinClickThresholdTimerId | 0 |
| 1157 | killTimer(d->spinClickThresholdTimerId); never executed (the execution status of this line is deduced): killTimer(d->spinClickThresholdTimerId); | - |
| 1158 | d->spinClickThresholdTimerId = -1; never executed (the execution status of this line is deduced): d->spinClickThresholdTimerId = -1; | - |
| 1159 | d->effectiveSpinRepeatRate = d->buttonState & Keyboard never evaluated: d->buttonState & Keyboard | 0 |
| 1160 | ? qApp->styleHints()->keyboardAutoRepeatRate() never executed (the execution status of this line is deduced): ? (static_cast<QApplication *>(QCoreApplication::instance()))->styleHints()->keyboardAutoRepeatRate() | - |
| 1161 | : d->spinClickTimerInterval; never executed (the execution status of this line is deduced): : d->spinClickTimerInterval; | - |
| 1162 | d->spinClickTimerId = startTimer(d->effectiveSpinRepeatRate); never executed (the execution status of this line is deduced): d->spinClickTimerId = startTimer(d->effectiveSpinRepeatRate); | - |
| 1163 | doStep = true; never executed (the execution status of this line is deduced): doStep = true; | - |
| 1164 | } else if (event->timerId() == d->spinClickTimerId) { never executed: } never evaluated: event->timerId() == d->spinClickTimerId | 0 |
| 1165 | if (d->accelerate) { never evaluated: d->accelerate | 0 |
| 1166 | d->acceleration = d->acceleration + (int)(d->effectiveSpinRepeatRate * 0.05); never executed (the execution status of this line is deduced): d->acceleration = d->acceleration + (int)(d->effectiveSpinRepeatRate * 0.05); | - |
| 1167 | if (d->effectiveSpinRepeatRate - d->acceleration >= 10) { never evaluated: d->effectiveSpinRepeatRate - d->acceleration >= 10 | 0 |
| 1168 | killTimer(d->spinClickTimerId); never executed (the execution status of this line is deduced): killTimer(d->spinClickTimerId); | - |
| 1169 | d->spinClickTimerId = startTimer(d->effectiveSpinRepeatRate - d->acceleration); never executed (the execution status of this line is deduced): d->spinClickTimerId = startTimer(d->effectiveSpinRepeatRate - d->acceleration); | - |
| 1170 | } | 0 |
| 1171 | } | 0 |
| 1172 | doStep = true; never executed (the execution status of this line is deduced): doStep = true; | - |
| 1173 | } | 0 |
| 1174 | | - |
| 1175 | if (doStep) { | 0 |
| 1176 | const StepEnabled st = stepEnabled(); never executed (the execution status of this line is deduced): const StepEnabled st = stepEnabled(); | - |
| 1177 | if (d->buttonState & Up) { never evaluated: d->buttonState & Up | 0 |
| 1178 | if (!(st & StepUpEnabled)) { never evaluated: !(st & StepUpEnabled) | 0 |
| 1179 | d->reset(); never executed (the execution status of this line is deduced): d->reset(); | - |
| 1180 | } else { | 0 |
| 1181 | stepBy(1); never executed (the execution status of this line is deduced): stepBy(1); | - |
| 1182 | } | 0 |
| 1183 | } else if (d->buttonState & Down) { never evaluated: d->buttonState & Down | 0 |
| 1184 | if (!(st & StepDownEnabled)) { never evaluated: !(st & StepDownEnabled) | 0 |
| 1185 | d->reset(); never executed (the execution status of this line is deduced): d->reset(); | - |
| 1186 | } else { | 0 |
| 1187 | stepBy(-1); never executed (the execution status of this line is deduced): stepBy(-1); | - |
| 1188 | } | 0 |
| 1189 | } | - |
| 1190 | return; | 0 |
| 1191 | } | - |
| 1192 | QWidget::timerEvent(event); never executed (the execution status of this line is deduced): QWidget::timerEvent(event); | - |
| 1193 | return; | 0 |
| 1194 | } | - |
| 1195 | | - |
| 1196 | /*! | - |
| 1197 | \reimp | - |
| 1198 | */ | - |
| 1199 | | - |
| 1200 | void QAbstractSpinBox::contextMenuEvent(QContextMenuEvent *event) | - |
| 1201 | { | - |
| 1202 | #ifdef QT_NO_CONTEXTMENU | - |
| 1203 | Q_UNUSED(event); | - |
| 1204 | #else | - |
| 1205 | Q_D(QAbstractSpinBox); never executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 1206 | | - |
| 1207 | QPointer<QMenu> menu = d->edit->createStandardContextMenu(); never executed (the execution status of this line is deduced): QPointer<QMenu> menu = d->edit->createStandardContextMenu(); | - |
| 1208 | if (!menu) | 0 |
| 1209 | return; | 0 |
| 1210 | | - |
| 1211 | d->reset(); never executed (the execution status of this line is deduced): d->reset(); | - |
| 1212 | | - |
| 1213 | QAction *selAll = new QAction(tr("&Select All"), menu); never executed (the execution status of this line is deduced): QAction *selAll = new QAction(tr("&Select All"), menu); | - |
| 1214 | menu->insertAction(d->edit->d_func()->selectAllAction, never executed (the execution status of this line is deduced): menu->insertAction(d->edit->d_func()->selectAllAction, | - |
| 1215 | selAll); never executed (the execution status of this line is deduced): selAll); | - |
| 1216 | menu->removeAction(d->edit->d_func()->selectAllAction); never executed (the execution status of this line is deduced): menu->removeAction(d->edit->d_func()->selectAllAction); | - |
| 1217 | menu->addSeparator(); never executed (the execution status of this line is deduced): menu->addSeparator(); | - |
| 1218 | const uint se = stepEnabled(); never executed (the execution status of this line is deduced): const uint se = stepEnabled(); | - |
| 1219 | QAction *up = menu->addAction(tr("&Step up")); never executed (the execution status of this line is deduced): QAction *up = menu->addAction(tr("&Step up")); | - |
| 1220 | up->setEnabled(se & StepUpEnabled); never executed (the execution status of this line is deduced): up->setEnabled(se & StepUpEnabled); | - |
| 1221 | QAction *down = menu->addAction(tr("Step &down")); never executed (the execution status of this line is deduced): QAction *down = menu->addAction(tr("Step &down")); | - |
| 1222 | down->setEnabled(se & StepDownEnabled); never executed (the execution status of this line is deduced): down->setEnabled(se & StepDownEnabled); | - |
| 1223 | menu->addSeparator(); never executed (the execution status of this line is deduced): menu->addSeparator(); | - |
| 1224 | | - |
| 1225 | const QPointer<QAbstractSpinBox> that = this; never executed (the execution status of this line is deduced): const QPointer<QAbstractSpinBox> that = this; | - |
| 1226 | const QPoint pos = (event->reason() == QContextMenuEvent::Mouse) never evaluated: (event->reason() == QContextMenuEvent::Mouse) | 0 |
| 1227 | ? event->globalPos() : mapToGlobal(QPoint(event->pos().x(), 0)) + QPoint(width() / 2, height() / 2); never executed (the execution status of this line is deduced): ? event->globalPos() : mapToGlobal(QPoint(event->pos().x(), 0)) + QPoint(width() / 2, height() / 2); | - |
| 1228 | const QAction *action = menu->exec(pos); never executed (the execution status of this line is deduced): const QAction *action = menu->exec(pos); | - |
| 1229 | delete static_cast<QMenu *>(menu); never executed (the execution status of this line is deduced): delete static_cast<QMenu *>(menu); | - |
| 1230 | if (that && action) { never evaluated: that never evaluated: action | 0 |
| 1231 | if (action == up) { never evaluated: action == up | 0 |
| 1232 | stepBy(1); never executed (the execution status of this line is deduced): stepBy(1); | - |
| 1233 | } else if (action == down) { never executed: } never evaluated: action == down | 0 |
| 1234 | stepBy(-1); never executed (the execution status of this line is deduced): stepBy(-1); | - |
| 1235 | } else if (action == selAll) { never executed: } never evaluated: action == selAll | 0 |
| 1236 | selectAll(); never executed (the execution status of this line is deduced): selectAll(); | - |
| 1237 | } | 0 |
| 1238 | } | - |
| 1239 | event->accept(); never executed (the execution status of this line is deduced): event->accept(); | - |
| 1240 | #endif // QT_NO_CONTEXTMENU | - |
| 1241 | } | 0 |
| 1242 | | - |
| 1243 | /*! | - |
| 1244 | \reimp | - |
| 1245 | */ | - |
| 1246 | | - |
| 1247 | void QAbstractSpinBox::mouseMoveEvent(QMouseEvent *event) | - |
| 1248 | { | - |
| 1249 | Q_D(QAbstractSpinBox); never executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 1250 | | - |
| 1251 | d->updateHoverControl(event->pos()); never executed (the execution status of this line is deduced): d->updateHoverControl(event->pos()); | - |
| 1252 | | - |
| 1253 | // If we have a timer ID, update the state | - |
| 1254 | if (d->spinClickTimerId != -1 && d->buttonSymbols != NoButtons) { never evaluated: d->spinClickTimerId != -1 never evaluated: d->buttonSymbols != NoButtons | 0 |
| 1255 | const StepEnabled se = stepEnabled(); never executed (the execution status of this line is deduced): const StepEnabled se = stepEnabled(); | - |
| 1256 | if ((se & StepUpEnabled) && d->hoverControl == QStyle::SC_SpinBoxUp) never evaluated: (se & StepUpEnabled) never evaluated: d->hoverControl == QStyle::SC_SpinBoxUp | 0 |
| 1257 | d->updateState(true); never executed: d->updateState(true); | 0 |
| 1258 | else if ((se & StepDownEnabled) && d->hoverControl == QStyle::SC_SpinBoxDown) never evaluated: (se & StepDownEnabled) never evaluated: d->hoverControl == QStyle::SC_SpinBoxDown | 0 |
| 1259 | d->updateState(false); never executed: d->updateState(false); | 0 |
| 1260 | else | - |
| 1261 | d->reset(); never executed: d->reset(); | 0 |
| 1262 | event->accept(); never executed (the execution status of this line is deduced): event->accept(); | - |
| 1263 | } | 0 |
| 1264 | } | 0 |
| 1265 | | - |
| 1266 | /*! | - |
| 1267 | \reimp | - |
| 1268 | */ | - |
| 1269 | | - |
| 1270 | void QAbstractSpinBox::mousePressEvent(QMouseEvent *event) | - |
| 1271 | { | - |
| 1272 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 1273 | | - |
| 1274 | if (event->button() != Qt::LeftButton || d->buttonState != None) { partially evaluated: event->button() != Qt::LeftButton| no Evaluation Count:0 | yes Evaluation Count:3 |
partially evaluated: d->buttonState != None| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 1275 | return; | 0 |
| 1276 | } | - |
| 1277 | | - |
| 1278 | d->updateHoverControl(event->pos()); executed (the execution status of this line is deduced): d->updateHoverControl(event->pos()); | - |
| 1279 | event->accept(); executed (the execution status of this line is deduced): event->accept(); | - |
| 1280 | | - |
| 1281 | const StepEnabled se = (d->buttonSymbols == NoButtons) ? StepEnabled(StepNone) : stepEnabled(); partially evaluated: (d->buttonSymbols == NoButtons)| no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
| 1282 | if ((se & StepUpEnabled) && d->hoverControl == QStyle::SC_SpinBoxUp) { partially evaluated: (se & StepUpEnabled)| yes Evaluation Count:3 | no Evaluation Count:0 |
evaluated: d->hoverControl == QStyle::SC_SpinBoxUp| yes Evaluation Count:1 | yes Evaluation Count:2 |
| 0-3 |
| 1283 | d->updateState(true); executed (the execution status of this line is deduced): d->updateState(true); | - |
| 1284 | } else if ((se & StepDownEnabled) && d->hoverControl == QStyle::SC_SpinBoxDown) { executed: }Execution Count:1 evaluated: (se & StepDownEnabled)| yes Evaluation Count:1 | yes Evaluation Count:1 |
partially evaluated: d->hoverControl == QStyle::SC_SpinBoxDown| no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
| 1285 | d->updateState(false); never executed (the execution status of this line is deduced): d->updateState(false); | - |
| 1286 | } else { | 0 |
| 1287 | event->ignore(); executed (the execution status of this line is deduced): event->ignore(); | - |
| 1288 | } executed: }Execution Count:2 | 2 |
| 1289 | } | - |
| 1290 | | - |
| 1291 | /*! | - |
| 1292 | \reimp | - |
| 1293 | */ | - |
| 1294 | void QAbstractSpinBox::mouseReleaseEvent(QMouseEvent *event) | - |
| 1295 | { | - |
| 1296 | Q_D(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 1297 | | - |
| 1298 | if ((d->buttonState & Mouse) != 0) evaluated: (d->buttonState & Mouse) != 0| yes Evaluation Count:2 | yes Evaluation Count:2 |
| 2 |
| 1299 | d->reset(); executed: d->reset();Execution Count:2 | 2 |
| 1300 | event->accept(); executed (the execution status of this line is deduced): event->accept(); | - |
| 1301 | } executed: }Execution Count:4 | 4 |
| 1302 | | - |
| 1303 | // --- QAbstractSpinBoxPrivate --- | - |
| 1304 | | - |
| 1305 | /*! | - |
| 1306 | \internal | - |
| 1307 | Constructs a QAbstractSpinBoxPrivate object | - |
| 1308 | */ | - |
| 1309 | | - |
| 1310 | QAbstractSpinBoxPrivate::QAbstractSpinBoxPrivate() | - |
| 1311 | : edit(0), type(QVariant::Invalid), spinClickTimerId(-1), | - |
| 1312 | spinClickTimerInterval(100), spinClickThresholdTimerId(-1), spinClickThresholdTimerInterval(-1), | - |
| 1313 | effectiveSpinRepeatRate(1), buttonState(None), cachedText(QLatin1String("\x01")), | - |
| 1314 | cachedState(QValidator::Invalid), pendingEmit(false), readOnly(false), wrapping(false), | - |
| 1315 | ignoreCursorPositionChanged(false), frame(true), accelerate(false), keyboardTracking(true), | - |
| 1316 | cleared(false), ignoreUpdateEdit(false), correctionMode(QAbstractSpinBox::CorrectToPreviousValue), | - |
| 1317 | acceleration(0), hoverControl(QStyle::SC_None), buttonSymbols(QAbstractSpinBox::UpDownArrows), validator(0) | - |
| 1318 | { | - |
| 1319 | } executed: }Execution Count:393 | 393 |
| 1320 | | - |
| 1321 | /* | - |
| 1322 | \internal | - |
| 1323 | Called when the QAbstractSpinBoxPrivate is destroyed | - |
| 1324 | */ | - |
| 1325 | QAbstractSpinBoxPrivate::~QAbstractSpinBoxPrivate() | - |
| 1326 | { | - |
| 1327 | } | - |
| 1328 | | - |
| 1329 | /*! | - |
| 1330 | \internal | - |
| 1331 | Updates the old and new hover control. Does nothing if the hover | - |
| 1332 | control has not changed. | - |
| 1333 | */ | - |
| 1334 | bool QAbstractSpinBoxPrivate::updateHoverControl(const QPoint &pos) | - |
| 1335 | { | - |
| 1336 | Q_Q(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBox * const q = q_func(); | - |
| 1337 | QRect lastHoverRect = hoverRect; executed (the execution status of this line is deduced): QRect lastHoverRect = hoverRect; | - |
| 1338 | QStyle::SubControl lastHoverControl = hoverControl; executed (the execution status of this line is deduced): QStyle::SubControl lastHoverControl = hoverControl; | - |
| 1339 | bool doesHover = q->testAttribute(Qt::WA_Hover); executed (the execution status of this line is deduced): bool doesHover = q->testAttribute(Qt::WA_Hover); | - |
| 1340 | if (lastHoverControl != newHoverControl(pos) && doesHover) { partially evaluated: lastHoverControl != newHoverControl(pos)| yes Evaluation Count:5 | no Evaluation Count:0 |
partially evaluated: doesHover| no Evaluation Count:0 | yes Evaluation Count:5 |
| 0-5 |
| 1341 | q->update(lastHoverRect); never executed (the execution status of this line is deduced): q->update(lastHoverRect); | - |
| 1342 | q->update(hoverRect); never executed (the execution status of this line is deduced): q->update(hoverRect); | - |
| 1343 | return true; never executed: return true; | 0 |
| 1344 | } | - |
| 1345 | return !doesHover; executed: return !doesHover;Execution Count:5 | 5 |
| 1346 | } | - |
| 1347 | | - |
| 1348 | /*! | - |
| 1349 | \internal | - |
| 1350 | Returns the hover control at \a pos. | - |
| 1351 | This will update the hoverRect and hoverControl. | - |
| 1352 | */ | - |
| 1353 | QStyle::SubControl QAbstractSpinBoxPrivate::newHoverControl(const QPoint &pos) | - |
| 1354 | { | - |
| 1355 | Q_Q(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBox * const q = q_func(); | - |
| 1356 | | - |
| 1357 | QStyleOptionSpinBox opt; executed (the execution status of this line is deduced): QStyleOptionSpinBox opt; | - |
| 1358 | q->initStyleOption(&opt); executed (the execution status of this line is deduced): q->initStyleOption(&opt); | - |
| 1359 | opt.subControls = QStyle::SC_All; executed (the execution status of this line is deduced): opt.subControls = QStyle::SC_All; | - |
| 1360 | hoverControl = q->style()->hitTestComplexControl(QStyle::CC_SpinBox, &opt, pos, q); executed (the execution status of this line is deduced): hoverControl = q->style()->hitTestComplexControl(QStyle::CC_SpinBox, &opt, pos, q); | - |
| 1361 | hoverRect = q->style()->subControlRect(QStyle::CC_SpinBox, &opt, hoverControl, q); executed (the execution status of this line is deduced): hoverRect = q->style()->subControlRect(QStyle::CC_SpinBox, &opt, hoverControl, q); | - |
| 1362 | return hoverControl; executed: return hoverControl;Execution Count:3 | 3 |
| 1363 | } | - |
| 1364 | | - |
| 1365 | /*! | - |
| 1366 | \internal | - |
| 1367 | Strips any prefix/suffix from \a text. | - |
| 1368 | */ | - |
| 1369 | | - |
| 1370 | QString QAbstractSpinBoxPrivate::stripped(const QString &t, int *pos) const | - |
| 1371 | { | - |
| 1372 | QString text = t; executed (the execution status of this line is deduced): QString text = t; | - |
| 1373 | if (specialValueText.size() == 0 || text != specialValueText) { evaluated: specialValueText.size() == 0| yes Evaluation Count:2314 | yes Evaluation Count:6 |
partially evaluated: text != specialValueText| yes Evaluation Count:6 | no Evaluation Count:0 |
| 0-2314 |
| 1374 | int from = 0; executed (the execution status of this line is deduced): int from = 0; | - |
| 1375 | int size = text.size(); executed (the execution status of this line is deduced): int size = text.size(); | - |
| 1376 | bool changed = false; executed (the execution status of this line is deduced): bool changed = false; | - |
| 1377 | if (prefix.size() && text.startsWith(prefix)) { evaluated: prefix.size()| yes Evaluation Count:43 | yes Evaluation Count:2277 |
partially evaluated: text.startsWith(prefix)| yes Evaluation Count:43 | no Evaluation Count:0 |
| 0-2277 |
| 1378 | from += prefix.size(); executed (the execution status of this line is deduced): from += prefix.size(); | - |
| 1379 | size -= from; executed (the execution status of this line is deduced): size -= from; | - |
| 1380 | changed = true; executed (the execution status of this line is deduced): changed = true; | - |
| 1381 | } executed: }Execution Count:43 | 43 |
| 1382 | if (suffix.size() && text.endsWith(suffix)) { evaluated: suffix.size()| yes Evaluation Count:33 | yes Evaluation Count:2287 |
partially evaluated: text.endsWith(suffix)| yes Evaluation Count:33 | no Evaluation Count:0 |
| 0-2287 |
| 1383 | size -= suffix.size(); executed (the execution status of this line is deduced): size -= suffix.size(); | - |
| 1384 | changed = true; executed (the execution status of this line is deduced): changed = true; | - |
| 1385 | } executed: }Execution Count:33 | 33 |
| 1386 | if (changed) evaluated: changed| yes Evaluation Count:55 | yes Evaluation Count:2265 |
| 55-2265 |
| 1387 | text = text.mid(from, size); executed: text = text.mid(from, size);Execution Count:55 | 55 |
| 1388 | } executed: }Execution Count:2320 | 2320 |
| 1389 | | - |
| 1390 | const int s = text.size(); executed (the execution status of this line is deduced): const int s = text.size(); | - |
| 1391 | text = text.trimmed(); executed (the execution status of this line is deduced): text = text.trimmed(); | - |
| 1392 | if (pos) evaluated: pos| yes Evaluation Count:2299 | yes Evaluation Count:21 |
| 21-2299 |
| 1393 | (*pos) -= (s - text.size()); executed: (*pos) -= (s - text.size());Execution Count:2299 | 2299 |
| 1394 | return text; executed: return text;Execution Count:2320 | 2320 |
| 1395 | | - |
| 1396 | } | - |
| 1397 | | - |
| 1398 | void QAbstractSpinBoxPrivate::updateEditFieldGeometry() | - |
| 1399 | { | - |
| 1400 | Q_Q(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBox * const q = q_func(); | - |
| 1401 | QStyleOptionSpinBox opt; executed (the execution status of this line is deduced): QStyleOptionSpinBox opt; | - |
| 1402 | q->initStyleOption(&opt); executed (the execution status of this line is deduced): q->initStyleOption(&opt); | - |
| 1403 | opt.subControls = QStyle::SC_SpinBoxEditField; executed (the execution status of this line is deduced): opt.subControls = QStyle::SC_SpinBoxEditField; | - |
| 1404 | edit->setGeometry(q->style()->subControlRect(QStyle::CC_SpinBox, &opt, executed (the execution status of this line is deduced): edit->setGeometry(q->style()->subControlRect(QStyle::CC_SpinBox, &opt, | - |
| 1405 | QStyle::SC_SpinBoxEditField, q)); executed (the execution status of this line is deduced): QStyle::SC_SpinBoxEditField, q)); | - |
| 1406 | } executed: }Execution Count:738 | 738 |
| 1407 | /*! | - |
| 1408 | \internal | - |
| 1409 | Returns true if a specialValueText has been set and the current value is minimum. | - |
| 1410 | */ | - |
| 1411 | | - |
| 1412 | bool QAbstractSpinBoxPrivate::specialValue() const | - |
| 1413 | { | - |
| 1414 | return (value == minimum && !specialValueText.isEmpty()); executed: return (value == minimum && !specialValueText.isEmpty());Execution Count:16941 | 16941 |
| 1415 | } | - |
| 1416 | | - |
| 1417 | /*! | - |
| 1418 | \internal Virtual function that emits signals when the value | - |
| 1419 | changes. Reimplemented in the different subclasses. | - |
| 1420 | */ | - |
| 1421 | | - |
| 1422 | void QAbstractSpinBoxPrivate::emitSignals(EmitPolicy, const QVariant &) | - |
| 1423 | { | - |
| 1424 | } | - |
| 1425 | | - |
| 1426 | /*! | - |
| 1427 | \internal | - |
| 1428 | | - |
| 1429 | Slot connected to the line edit's textChanged(const QString &) | - |
| 1430 | signal. | - |
| 1431 | */ | - |
| 1432 | | - |
| 1433 | void QAbstractSpinBoxPrivate::_q_editorTextChanged(const QString &t) | - |
| 1434 | { | - |
| 1435 | Q_Q(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBox * const q = q_func(); | - |
| 1436 | | - |
| 1437 | if (keyboardTracking) { evaluated: keyboardTracking| yes Evaluation Count:598 | yes Evaluation Count:13 |
| 13-598 |
| 1438 | QString tmp = t; executed (the execution status of this line is deduced): QString tmp = t; | - |
| 1439 | int pos = edit->cursorPosition(); executed (the execution status of this line is deduced): int pos = edit->cursorPosition(); | - |
| 1440 | QValidator::State state = q->validate(tmp, pos); executed (the execution status of this line is deduced): QValidator::State state = q->validate(tmp, pos); | - |
| 1441 | if (state == QValidator::Acceptable) { evaluated: state == QValidator::Acceptable| yes Evaluation Count:326 | yes Evaluation Count:272 |
| 272-326 |
| 1442 | const QVariant v = valueFromText(tmp); executed (the execution status of this line is deduced): const QVariant v = valueFromText(tmp); | - |
| 1443 | setValue(v, EmitIfChanged, tmp != t); executed (the execution status of this line is deduced): setValue(v, EmitIfChanged, tmp != t); | - |
| 1444 | pendingEmit = false; executed (the execution status of this line is deduced): pendingEmit = false; | - |
| 1445 | } else { executed: }Execution Count:326 | 326 |
| 1446 | pendingEmit = true; executed (the execution status of this line is deduced): pendingEmit = true; | - |
| 1447 | } executed: }Execution Count:272 | 272 |
| 1448 | } else { | - |
| 1449 | pendingEmit = true; executed (the execution status of this line is deduced): pendingEmit = true; | - |
| 1450 | } executed: }Execution Count:13 | 13 |
| 1451 | } | - |
| 1452 | | - |
| 1453 | /*! | - |
| 1454 | \internal | - |
| 1455 | | - |
| 1456 | Virtual slot connected to the line edit's | - |
| 1457 | cursorPositionChanged(int, int) signal. Will move the cursor to a | - |
| 1458 | valid position if the new one is invalid. E.g. inside the prefix. | - |
| 1459 | Reimplemented in Q[Date|Time|DateTime]EditPrivate to account for | - |
| 1460 | the different sections etc. | - |
| 1461 | */ | - |
| 1462 | | - |
| 1463 | void QAbstractSpinBoxPrivate::_q_editorCursorPositionChanged(int oldpos, int newpos) | - |
| 1464 | { | - |
| 1465 | if (!edit->hasSelectedText() && !ignoreCursorPositionChanged && !specialValue()) { evaluated: !edit->hasSelectedText()| yes Evaluation Count:511 | yes Evaluation Count:216 |
partially evaluated: !ignoreCursorPositionChanged| yes Evaluation Count:511 | no Evaluation Count:0 |
evaluated: !specialValue()| yes Evaluation Count:508 | yes Evaluation Count:3 |
| 0-511 |
| 1466 | ignoreCursorPositionChanged = true; executed (the execution status of this line is deduced): ignoreCursorPositionChanged = true; | - |
| 1467 | | - |
| 1468 | bool allowSelection = true; executed (the execution status of this line is deduced): bool allowSelection = true; | - |
| 1469 | int pos = -1; executed (the execution status of this line is deduced): int pos = -1; | - |
| 1470 | if (newpos < prefix.size() && newpos != 0) { evaluated: newpos < prefix.size()| yes Evaluation Count:2 | yes Evaluation Count:506 |
partially evaluated: newpos != 0| no Evaluation Count:0 | yes Evaluation Count:2 |
| 0-506 |
| 1471 | if (oldpos == 0) { never evaluated: oldpos == 0 | 0 |
| 1472 | allowSelection = false; never executed (the execution status of this line is deduced): allowSelection = false; | - |
| 1473 | pos = prefix.size(); never executed (the execution status of this line is deduced): pos = prefix.size(); | - |
| 1474 | } else { | 0 |
| 1475 | pos = oldpos; never executed (the execution status of this line is deduced): pos = oldpos; | - |
| 1476 | } | 0 |
| 1477 | } else if (newpos > edit->text().size() - suffix.size() partially evaluated: newpos > edit->text().size() - suffix.size()| no Evaluation Count:0 | yes Evaluation Count:508 |
| 0-508 |
| 1478 | && newpos != edit->text().size()) { never evaluated: newpos != edit->text().size() | 0 |
| 1479 | if (oldpos == edit->text().size()) { never evaluated: oldpos == edit->text().size() | 0 |
| 1480 | pos = edit->text().size() - suffix.size(); never executed (the execution status of this line is deduced): pos = edit->text().size() - suffix.size(); | - |
| 1481 | allowSelection = false; never executed (the execution status of this line is deduced): allowSelection = false; | - |
| 1482 | } else { | 0 |
| 1483 | pos = edit->text().size(); never executed (the execution status of this line is deduced): pos = edit->text().size(); | - |
| 1484 | } | 0 |
| 1485 | } | - |
| 1486 | if (pos != -1) { partially evaluated: pos != -1| no Evaluation Count:0 | yes Evaluation Count:508 |
| 0-508 |
| 1487 | const int selSize = edit->selectionStart() >= 0 && allowSelection never evaluated: edit->selectionStart() >= 0 never evaluated: allowSelection | 0 |
| 1488 | ? (edit->selectedText().size() never executed (the execution status of this line is deduced): ? (edit->selectedText().size() | - |
| 1489 | * (newpos < pos ? -1 : 1)) - newpos + pos never executed (the execution status of this line is deduced): * (newpos < pos ? -1 : 1)) - newpos + pos | - |
| 1490 | : 0; never executed (the execution status of this line is deduced): : 0; | - |
| 1491 | | - |
| 1492 | const bool wasBlocked = edit->blockSignals(true); never executed (the execution status of this line is deduced): const bool wasBlocked = edit->blockSignals(true); | - |
| 1493 | if (selSize != 0) { never evaluated: selSize != 0 | 0 |
| 1494 | edit->setSelection(pos - selSize, selSize); never executed (the execution status of this line is deduced): edit->setSelection(pos - selSize, selSize); | - |
| 1495 | } else { | 0 |
| 1496 | edit->setCursorPosition(pos); never executed (the execution status of this line is deduced): edit->setCursorPosition(pos); | - |
| 1497 | } | 0 |
| 1498 | edit->blockSignals(wasBlocked); never executed (the execution status of this line is deduced): edit->blockSignals(wasBlocked); | - |
| 1499 | } | 0 |
| 1500 | ignoreCursorPositionChanged = false; executed (the execution status of this line is deduced): ignoreCursorPositionChanged = false; | - |
| 1501 | } executed: }Execution Count:508 | 508 |
| 1502 | } executed: }Execution Count:727 | 727 |
| 1503 | | - |
| 1504 | /*! | - |
| 1505 | \internal | - |
| 1506 | | - |
| 1507 | Initialises the QAbstractSpinBoxPrivate object. | - |
| 1508 | */ | - |
| 1509 | | - |
| 1510 | void QAbstractSpinBoxPrivate::init() | - |
| 1511 | { | - |
| 1512 | Q_Q(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBox * const q = q_func(); | - |
| 1513 | | - |
| 1514 | q->setLineEdit(new QLineEdit(q)); executed (the execution status of this line is deduced): q->setLineEdit(new QLineEdit(q)); | - |
| 1515 | edit->setObjectName(QLatin1String("qt_spinbox_lineedit")); executed (the execution status of this line is deduced): edit->setObjectName(QLatin1String("qt_spinbox_lineedit")); | - |
| 1516 | validator = new QSpinBoxValidator(q, this); executed (the execution status of this line is deduced): validator = new QSpinBoxValidator(q, this); | - |
| 1517 | edit->setValidator(validator); executed (the execution status of this line is deduced): edit->setValidator(validator); | - |
| 1518 | | - |
| 1519 | QStyleOptionSpinBox opt; executed (the execution status of this line is deduced): QStyleOptionSpinBox opt; | - |
| 1520 | q->initStyleOption(&opt); executed (the execution status of this line is deduced): q->initStyleOption(&opt); | - |
| 1521 | spinClickTimerInterval = q->style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatRate, &opt, q); executed (the execution status of this line is deduced): spinClickTimerInterval = q->style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatRate, &opt, q); | - |
| 1522 | spinClickThresholdTimerInterval = q->style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatThreshold, &opt, q); executed (the execution status of this line is deduced): spinClickThresholdTimerInterval = q->style()->styleHint(QStyle::SH_SpinBox_ClickAutoRepeatThreshold, &opt, q); | - |
| 1523 | q->setFocusPolicy(Qt::WheelFocus); executed (the execution status of this line is deduced): q->setFocusPolicy(Qt::WheelFocus); | - |
| 1524 | q->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, QSizePolicy::SpinBox)); executed (the execution status of this line is deduced): q->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed, QSizePolicy::SpinBox)); | - |
| 1525 | q->setAttribute(Qt::WA_InputMethodEnabled); executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_InputMethodEnabled); | - |
| 1526 | | - |
| 1527 | q->setAttribute(Qt::WA_MacShowFocusRect); executed (the execution status of this line is deduced): q->setAttribute(Qt::WA_MacShowFocusRect); | - |
| 1528 | } executed: }Execution Count:393 | 393 |
| 1529 | | - |
| 1530 | /*! | - |
| 1531 | \internal | - |
| 1532 | | - |
| 1533 | Resets the state of the spinbox. E.g. the state is set to | - |
| 1534 | (Keyboard|Up) if Key up is currently pressed. | - |
| 1535 | */ | - |
| 1536 | | - |
| 1537 | void QAbstractSpinBoxPrivate::reset() | - |
| 1538 | { | - |
| 1539 | Q_Q(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBox * const q = q_func(); | - |
| 1540 | | - |
| 1541 | buttonState = None; executed (the execution status of this line is deduced): buttonState = None; | - |
| 1542 | if (q) { partially evaluated: q| yes Evaluation Count:2164 | no Evaluation Count:0 |
| 0-2164 |
| 1543 | if (spinClickTimerId != -1) partially evaluated: spinClickTimerId != -1| no Evaluation Count:0 | yes Evaluation Count:2164 |
| 0-2164 |
| 1544 | q->killTimer(spinClickTimerId); never executed: q->killTimer(spinClickTimerId); | 0 |
| 1545 | if (spinClickThresholdTimerId != -1) evaluated: spinClickThresholdTimerId != -1| yes Evaluation Count:1 | yes Evaluation Count:2163 |
| 1-2163 |
| 1546 | q->killTimer(spinClickThresholdTimerId); executed: q->killTimer(spinClickThresholdTimerId);Execution Count:1 | 1 |
| 1547 | spinClickTimerId = spinClickThresholdTimerId = -1; executed (the execution status of this line is deduced): spinClickTimerId = spinClickThresholdTimerId = -1; | - |
| 1548 | acceleration = 0; executed (the execution status of this line is deduced): acceleration = 0; | - |
| 1549 | q->update(); executed (the execution status of this line is deduced): q->update(); | - |
| 1550 | } executed: }Execution Count:2164 | 2164 |
| 1551 | } executed: }Execution Count:2164 | 2164 |
| 1552 | | - |
| 1553 | /*! | - |
| 1554 | \internal | - |
| 1555 | | - |
| 1556 | Updates the state of the spinbox. | - |
| 1557 | */ | - |
| 1558 | | - |
| 1559 | void QAbstractSpinBoxPrivate::updateState(bool up, bool fromKeyboard /* = false */) | - |
| 1560 | { | - |
| 1561 | Q_Q(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBox * const q = q_func(); | - |
| 1562 | if ((up && (buttonState & Up)) || (!up && (buttonState & Down))) partially evaluated: up| yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: (buttonState & Up)| no Evaluation Count:0 | yes Evaluation Count:1 |
partially evaluated: !up| no Evaluation Count:0 | yes Evaluation Count:1 |
never evaluated: (buttonState & Down) | 0-1 |
| 1563 | return; | 0 |
| 1564 | reset(); executed (the execution status of this line is deduced): reset(); | - |
| 1565 | if (q && (q->stepEnabled() & (up ? QAbstractSpinBox::StepUpEnabled partially evaluated: q| yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: (q->stepEnabled() & (up ? QAbstractSpinBox::StepUpEnabled : QAbstractSpinBox::StepDownEnabled))| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 1566 | : QAbstractSpinBox::StepDownEnabled))) { partially evaluated: (q->stepEnabled() & (up ? QAbstractSpinBox::StepUpEnabled : QAbstractSpinBox::StepDownEnabled))| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 1567 | spinClickThresholdTimerId = q->startTimer(spinClickThresholdTimerInterval); executed (the execution status of this line is deduced): spinClickThresholdTimerId = q->startTimer(spinClickThresholdTimerInterval); | - |
| 1568 | buttonState = (up ? Up : Down) | (fromKeyboard ? Keyboard : Mouse); partially evaluated: up| yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
| 1569 | q->stepBy(up ? 1 : -1); executed (the execution status of this line is deduced): q->stepBy(up ? 1 : -1); | - |
| 1570 | #ifndef QT_NO_ACCESSIBILITY | - |
| 1571 | QAccessibleValueChangeEvent event(q, value); executed (the execution status of this line is deduced): QAccessibleValueChangeEvent event(q, value); | - |
| 1572 | QAccessible::updateAccessibility(&event); executed (the execution status of this line is deduced): QAccessible::updateAccessibility(&event); | - |
| 1573 | #endif | - |
| 1574 | } executed: }Execution Count:1 | 1 |
| 1575 | } executed: }Execution Count:1 | 1 |
| 1576 | | - |
| 1577 | | - |
| 1578 | /*! | - |
| 1579 | Initialize \a option with the values from this QSpinBox. This method | - |
| 1580 | is useful for subclasses when they need a QStyleOptionSpinBox, but don't want | - |
| 1581 | to fill in all the information themselves. | - |
| 1582 | | - |
| 1583 | \sa QStyleOption::initFrom() | - |
| 1584 | */ | - |
| 1585 | void QAbstractSpinBox::initStyleOption(QStyleOptionSpinBox *option) const | - |
| 1586 | { | - |
| 1587 | if (!option) partially evaluated: !option| no Evaluation Count:0 | yes Evaluation Count:1651 |
| 0-1651 |
| 1588 | return; | 0 |
| 1589 | | - |
| 1590 | Q_D(const QAbstractSpinBox); executed (the execution status of this line is deduced): const QAbstractSpinBoxPrivate * const d = d_func(); | - |
| 1591 | option->initFrom(this); executed (the execution status of this line is deduced): option->initFrom(this); | - |
| 1592 | option->activeSubControls = QStyle::SC_None; executed (the execution status of this line is deduced): option->activeSubControls = QStyle::SC_None; | - |
| 1593 | option->buttonSymbols = d->buttonSymbols; executed (the execution status of this line is deduced): option->buttonSymbols = d->buttonSymbols; | - |
| 1594 | option->subControls = QStyle::SC_SpinBoxFrame | QStyle::SC_SpinBoxEditField; executed (the execution status of this line is deduced): option->subControls = QStyle::SC_SpinBoxFrame | QStyle::SC_SpinBoxEditField; | - |
| 1595 | if (d->buttonSymbols != QAbstractSpinBox::NoButtons) { evaluated: d->buttonSymbols != QAbstractSpinBox::NoButtons| yes Evaluation Count:1650 | yes Evaluation Count:1 |
| 1-1650 |
| 1596 | option->subControls |= QStyle::SC_SpinBoxUp | QStyle::SC_SpinBoxDown; executed (the execution status of this line is deduced): option->subControls |= QStyle::SC_SpinBoxUp | QStyle::SC_SpinBoxDown; | - |
| 1597 | if (d->buttonState & Up) { partially evaluated: d->buttonState & Up| no Evaluation Count:0 | yes Evaluation Count:1650 |
| 0-1650 |
| 1598 | option->activeSubControls = QStyle::SC_SpinBoxUp; never executed (the execution status of this line is deduced): option->activeSubControls = QStyle::SC_SpinBoxUp; | - |
| 1599 | } else if (d->buttonState & Down) { never executed: } partially evaluated: d->buttonState & Down| no Evaluation Count:0 | yes Evaluation Count:1650 |
| 0-1650 |
| 1600 | option->activeSubControls = QStyle::SC_SpinBoxDown; never executed (the execution status of this line is deduced): option->activeSubControls = QStyle::SC_SpinBoxDown; | - |
| 1601 | } | 0 |
| 1602 | } | - |
| 1603 | | - |
| 1604 | if (d->buttonState) { partially evaluated: d->buttonState| no Evaluation Count:0 | yes Evaluation Count:1651 |
| 0-1651 |
| 1605 | option->state |= QStyle::State_Sunken; never executed (the execution status of this line is deduced): option->state |= QStyle::State_Sunken; | - |
| 1606 | } else { | 0 |
| 1607 | option->activeSubControls = d->hoverControl; executed (the execution status of this line is deduced): option->activeSubControls = d->hoverControl; | - |
| 1608 | } executed: }Execution Count:1651 | 1651 |
| 1609 | | - |
| 1610 | option->stepEnabled = style()->styleHint(QStyle::SH_SpinControls_DisableOnBounds) partially evaluated: style()->styleHint(QStyle::SH_SpinControls_DisableOnBounds)| yes Evaluation Count:1651 | no Evaluation Count:0 |
| 0-1651 |
| 1611 | ? stepEnabled() executed (the execution status of this line is deduced): ? stepEnabled() | - |
| 1612 | : (QAbstractSpinBox::StepDownEnabled|QAbstractSpinBox::StepUpEnabled); executed (the execution status of this line is deduced): : (QAbstractSpinBox::StepDownEnabled|QAbstractSpinBox::StepUpEnabled); | - |
| 1613 | | - |
| 1614 | option->frame = d->frame; executed (the execution status of this line is deduced): option->frame = d->frame; | - |
| 1615 | } executed: }Execution Count:1651 | 1651 |
| 1616 | | - |
| 1617 | /*! | - |
| 1618 | \internal | - |
| 1619 | | - |
| 1620 | Bounds \a val to be within minimum and maximum. Also tries to be | - |
| 1621 | clever about setting it at min and max depending on what it was | - |
| 1622 | and what direction it was changed etc. | - |
| 1623 | */ | - |
| 1624 | | - |
| 1625 | QVariant QAbstractSpinBoxPrivate::bound(const QVariant &val, const QVariant &old, int steps) const | - |
| 1626 | { | - |
| 1627 | QVariant v = val; executed (the execution status of this line is deduced): QVariant v = val; | - |
| 1628 | if (!wrapping || steps == 0 || old.isNull()) { evaluated: !wrapping| yes Evaluation Count:6081 | yes Evaluation Count:1878 |
evaluated: steps == 0| yes Evaluation Count:1194 | yes Evaluation Count:684 |
partially evaluated: old.isNull()| no Evaluation Count:0 | yes Evaluation Count:684 |
| 0-6081 |
| 1629 | if (variantCompare(v, minimum) < 0) { evaluated: variantCompare(v, minimum) < 0| yes Evaluation Count:271 | yes Evaluation Count:7004 |
| 271-7004 |
| 1630 | v = wrapping ? maximum : minimum; partially evaluated: wrapping| no Evaluation Count:0 | yes Evaluation Count:271 |
| 0-271 |
| 1631 | } executed: }Execution Count:271 | 271 |
| 1632 | if (variantCompare(v, maximum) > 0) { evaluated: variantCompare(v, maximum) > 0| yes Evaluation Count:113 | yes Evaluation Count:7162 |
| 113-7162 |
| 1633 | v = wrapping ? minimum : maximum; partially evaluated: wrapping| no Evaluation Count:0 | yes Evaluation Count:113 |
| 0-113 |
| 1634 | } executed: }Execution Count:113 | 113 |
| 1635 | } else { executed: }Execution Count:7275 | 7275 |
| 1636 | const bool wasMin = old == minimum; executed (the execution status of this line is deduced): const bool wasMin = old == minimum; | - |
| 1637 | const bool wasMax = old == maximum; executed (the execution status of this line is deduced): const bool wasMax = old == maximum; | - |
| 1638 | const int oldcmp = variantCompare(v, old); executed (the execution status of this line is deduced): const int oldcmp = variantCompare(v, old); | - |
| 1639 | const int maxcmp = variantCompare(v, maximum); executed (the execution status of this line is deduced): const int maxcmp = variantCompare(v, maximum); | - |
| 1640 | const int mincmp = variantCompare(v, minimum); executed (the execution status of this line is deduced): const int mincmp = variantCompare(v, minimum); | - |
| 1641 | const bool wrapped = (oldcmp > 0 && steps < 0) || (oldcmp < 0 && steps > 0); evaluated: oldcmp > 0| yes Evaluation Count:584 | yes Evaluation Count:100 |
evaluated: steps < 0| yes Evaluation Count:24 | yes Evaluation Count:560 |
evaluated: oldcmp < 0| yes Evaluation Count:93 | yes Evaluation Count:567 |
evaluated: steps > 0| yes Evaluation Count:17 | yes Evaluation Count:76 |
| 17-584 |
| 1642 | if (maxcmp > 0) { evaluated: maxcmp > 0| yes Evaluation Count:6 | yes Evaluation Count:678 |
| 6-678 |
| 1643 | v = ((wasMax && !wrapped && steps > 0) || (steps < 0 && !wasMin && wrapped)) evaluated: wasMax| yes Evaluation Count:4 | yes Evaluation Count:2 |
partially evaluated: !wrapped| yes Evaluation Count:4 | no Evaluation Count:0 |
partially evaluated: steps > 0| yes Evaluation Count:4 | no Evaluation Count:0 |
partially evaluated: steps < 0| no Evaluation Count:0 | yes Evaluation Count:2 |
never evaluated: !wasMin never evaluated: wrapped | 0-4 |
| 1644 | ? minimum : maximum; executed (the execution status of this line is deduced): ? minimum : maximum; | - |
| 1645 | } else if (wrapped && (maxcmp > 0 || mincmp < 0)) { executed: }Execution Count:6 evaluated: wrapped| yes Evaluation Count:41 | yes Evaluation Count:637 |
partially evaluated: maxcmp > 0| no Evaluation Count:0 | yes Evaluation Count:41 |
partially evaluated: mincmp < 0| no Evaluation Count:0 | yes Evaluation Count:41 |
| 0-637 |
| 1646 | v = ((wasMax && steps > 0) || (!wasMin && steps < 0)) ? minimum : maximum; never evaluated: wasMax never evaluated: steps > 0 never evaluated: !wasMin never evaluated: steps < 0 | 0 |
| 1647 | } else if (mincmp < 0) { never executed: } evaluated: mincmp < 0| yes Evaluation Count:10 | yes Evaluation Count:668 |
| 0-668 |
| 1648 | v = (!wasMax && !wasMin ? minimum : maximum); partially evaluated: !wasMax| yes Evaluation Count:10 | no Evaluation Count:0 |
evaluated: !wasMin| yes Evaluation Count:2 | yes Evaluation Count:8 |
| 0-10 |
| 1649 | } executed: }Execution Count:10 | 10 |
| 1650 | } | - |
| 1651 | | - |
| 1652 | return v; executed: return v;Execution Count:7959 | 7959 |
| 1653 | } | - |
| 1654 | | - |
| 1655 | /*! | - |
| 1656 | \internal | - |
| 1657 | | - |
| 1658 | Sets the value of the spin box to \a val. Depending on the value | - |
| 1659 | of \a ep it will also emit signals. | - |
| 1660 | */ | - |
| 1661 | | - |
| 1662 | void QAbstractSpinBoxPrivate::setValue(const QVariant &val, EmitPolicy ep, | - |
| 1663 | bool doUpdate) | - |
| 1664 | { | - |
| 1665 | Q_Q(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBox * const q = q_func(); | - |
| 1666 | const QVariant old = value; executed (the execution status of this line is deduced): const QVariant old = value; | - |
| 1667 | value = bound(val); executed (the execution status of this line is deduced): value = bound(val); | - |
| 1668 | pendingEmit = false; executed (the execution status of this line is deduced): pendingEmit = false; | - |
| 1669 | cleared = false; executed (the execution status of this line is deduced): cleared = false; | - |
| 1670 | if (doUpdate) { evaluated: doUpdate| yes Evaluation Count:3651 | yes Evaluation Count:326 |
| 326-3651 |
| 1671 | updateEdit(); executed (the execution status of this line is deduced): updateEdit(); | - |
| 1672 | } executed: }Execution Count:3651 | 3651 |
| 1673 | q->update(); executed (the execution status of this line is deduced): q->update(); | - |
| 1674 | | - |
| 1675 | if (ep == AlwaysEmit || (ep == EmitIfChanged && old != value)) { evaluated: ep == AlwaysEmit| yes Evaluation Count:199 | yes Evaluation Count:3778 |
partially evaluated: ep == EmitIfChanged| yes Evaluation Count:3778 | no Evaluation Count:0 |
evaluated: old != value| yes Evaluation Count:2905 | yes Evaluation Count:873 |
| 0-3778 |
| 1676 | emitSignals(ep, old); executed (the execution status of this line is deduced): emitSignals(ep, old); | - |
| 1677 | } executed: }Execution Count:3104 | 3104 |
| 1678 | } executed: }Execution Count:3977 | 3977 |
| 1679 | | - |
| 1680 | /*! | - |
| 1681 | \internal | - |
| 1682 | | - |
| 1683 | Updates the line edit to reflect the current value of the spin box. | - |
| 1684 | */ | - |
| 1685 | | - |
| 1686 | void QAbstractSpinBoxPrivate::updateEdit() | - |
| 1687 | { | - |
| 1688 | Q_Q(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBox * const q = q_func(); | - |
| 1689 | if (type == QVariant::Invalid) partially evaluated: type == QVariant::Invalid| no Evaluation Count:0 | yes Evaluation Count:1602 |
| 0-1602 |
| 1690 | return; | 0 |
| 1691 | const QString newText = specialValue() ? specialValueText : prefix + textFromValue(value) + suffix; evaluated: specialValue()| yes Evaluation Count:28 | yes Evaluation Count:1574 |
| 28-1574 |
| 1692 | if (newText == edit->displayText() || cleared) evaluated: newText == edit->displayText()| yes Evaluation Count:371 | yes Evaluation Count:1231 |
evaluated: cleared| yes Evaluation Count:2 | yes Evaluation Count:1229 |
| 2-1231 |
| 1693 | return; executed: return;Execution Count:373 | 373 |
| 1694 | | - |
| 1695 | const bool empty = edit->text().isEmpty(); executed (the execution status of this line is deduced): const bool empty = edit->text().isEmpty(); | - |
| 1696 | int cursor = edit->cursorPosition(); executed (the execution status of this line is deduced): int cursor = edit->cursorPosition(); | - |
| 1697 | int selsize = edit->selectedText().size(); executed (the execution status of this line is deduced): int selsize = edit->selectedText().size(); | - |
| 1698 | const bool sb = edit->blockSignals(true); executed (the execution status of this line is deduced): const bool sb = edit->blockSignals(true); | - |
| 1699 | edit->setText(newText); executed (the execution status of this line is deduced): edit->setText(newText); | - |
| 1700 | | - |
| 1701 | if (!specialValue()) { evaluated: !specialValue()| yes Evaluation Count:1221 | yes Evaluation Count:8 |
| 8-1221 |
| 1702 | cursor = qBound(prefix.size(), cursor, edit->displayText().size() - suffix.size()); executed (the execution status of this line is deduced): cursor = qBound(prefix.size(), cursor, edit->displayText().size() - suffix.size()); | - |
| 1703 | | - |
| 1704 | if (selsize > 0) { evaluated: selsize > 0| yes Evaluation Count:76 | yes Evaluation Count:1145 |
| 76-1145 |
| 1705 | edit->setSelection(cursor, selsize); executed (the execution status of this line is deduced): edit->setSelection(cursor, selsize); | - |
| 1706 | } else { executed: }Execution Count:76 | 76 |
| 1707 | edit->setCursorPosition(empty ? prefix.size() : cursor); executed (the execution status of this line is deduced): edit->setCursorPosition(empty ? prefix.size() : cursor); | - |
| 1708 | } executed: }Execution Count:1145 | 1145 |
| 1709 | } | - |
| 1710 | edit->blockSignals(sb); executed (the execution status of this line is deduced): edit->blockSignals(sb); | - |
| 1711 | q->update(); executed (the execution status of this line is deduced): q->update(); | - |
| 1712 | } executed: }Execution Count:1229 | 1229 |
| 1713 | | - |
| 1714 | /*! | - |
| 1715 | \internal | - |
| 1716 | | - |
| 1717 | Convenience function to set min/max values. | - |
| 1718 | */ | - |
| 1719 | | - |
| 1720 | void QAbstractSpinBoxPrivate::setRange(const QVariant &min, const QVariant &max) | - |
| 1721 | { | - |
| 1722 | Q_Q(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBox * const q = q_func(); | - |
| 1723 | | - |
| 1724 | clearCache(); executed (the execution status of this line is deduced): clearCache(); | - |
| 1725 | minimum = min; executed (the execution status of this line is deduced): minimum = min; | - |
| 1726 | maximum = (variantCompare(min, max) < 0 ? max : min); evaluated: variantCompare(min, max) < 0| yes Evaluation Count:1703 | yes Evaluation Count:25 |
| 25-1703 |
| 1727 | cachedSizeHint = QSize(); // minimumSizeHint doesn't care about min/max executed (the execution status of this line is deduced): cachedSizeHint = QSize(); | - |
| 1728 | | - |
| 1729 | reset(); executed (the execution status of this line is deduced): reset(); | - |
| 1730 | if (!(bound(value) == value)) { evaluated: !(bound(value) == value)| yes Evaluation Count:174 | yes Evaluation Count:1554 |
| 174-1554 |
| 1731 | setValue(bound(value), EmitIfChanged); executed (the execution status of this line is deduced): setValue(bound(value), EmitIfChanged); | - |
| 1732 | } else if (value == minimum && !specialValueText.isEmpty()) { executed: }Execution Count:174 evaluated: value == minimum| yes Evaluation Count:434 | yes Evaluation Count:1120 |
evaluated: !specialValueText.isEmpty()| yes Evaluation Count:14 | yes Evaluation Count:420 |
| 14-1120 |
| 1733 | updateEdit(); executed (the execution status of this line is deduced): updateEdit(); | - |
| 1734 | } executed: }Execution Count:14 | 14 |
| 1735 | | - |
| 1736 | q->updateGeometry(); executed (the execution status of this line is deduced): q->updateGeometry(); | - |
| 1737 | } executed: }Execution Count:1728 | 1728 |
| 1738 | | - |
| 1739 | /*! | - |
| 1740 | \internal | - |
| 1741 | | - |
| 1742 | Convenience function to get a variant of the right type. | - |
| 1743 | */ | - |
| 1744 | | - |
| 1745 | QVariant QAbstractSpinBoxPrivate::getZeroVariant() const | - |
| 1746 | { | - |
| 1747 | QVariant ret; executed (the execution status of this line is deduced): QVariant ret; | - |
| 1748 | switch (type) { | - |
| 1749 | case QVariant::Int: ret = QVariant((int)0); break; executed: break;Execution Count:18 | 18 |
| 1750 | case QVariant::Double: ret = QVariant((double)0.0); break; executed: break;Execution Count:14 | 14 |
| 1751 | default: break; | 0 |
| 1752 | } | - |
| 1753 | return ret; executed: return ret;Execution Count:32 | 32 |
| 1754 | } | - |
| 1755 | | - |
| 1756 | /*! | - |
| 1757 | \internal | - |
| 1758 | | - |
| 1759 | Virtual method called that calls the public textFromValue() | - |
| 1760 | functions in the subclasses. Needed to change signature from | - |
| 1761 | QVariant to int/double/QDateTime etc. Used when needing to display | - |
| 1762 | a value textually. | - |
| 1763 | | - |
| 1764 | This method is reimeplemented in the various subclasses. | - |
| 1765 | */ | - |
| 1766 | | - |
| 1767 | QString QAbstractSpinBoxPrivate::textFromValue(const QVariant &) const | - |
| 1768 | { | - |
| 1769 | return QString(); never executed: return QString(); | 0 |
| 1770 | } | - |
| 1771 | | - |
| 1772 | /*! | - |
| 1773 | \internal | - |
| 1774 | | - |
| 1775 | Virtual method called that calls the public valueFromText() | - |
| 1776 | functions in the subclasses. Needed to change signature from | - |
| 1777 | QVariant to int/double/QDateTime etc. Used when needing to | - |
| 1778 | interpret a string as another type. | - |
| 1779 | | - |
| 1780 | This method is reimeplemented in the various subclasses. | - |
| 1781 | */ | - |
| 1782 | | - |
| 1783 | QVariant QAbstractSpinBoxPrivate::valueFromText(const QString &) const | - |
| 1784 | { | - |
| 1785 | return QVariant(); never executed: return QVariant(); | 0 |
| 1786 | } | - |
| 1787 | /*! | - |
| 1788 | \internal | - |
| 1789 | | - |
| 1790 | Interprets text and emits signals. Called when the spinbox needs | - |
| 1791 | to interpret the text on the lineedit. | - |
| 1792 | */ | - |
| 1793 | | - |
| 1794 | void QAbstractSpinBoxPrivate::interpret(EmitPolicy ep) | - |
| 1795 | { | - |
| 1796 | Q_Q(QAbstractSpinBox); executed (the execution status of this line is deduced): QAbstractSpinBox * const q = q_func(); | - |
| 1797 | if (type == QVariant::Invalid || cleared) partially evaluated: type == QVariant::Invalid| no Evaluation Count:0 | yes Evaluation Count:500 |
evaluated: cleared| yes Evaluation Count:1 | yes Evaluation Count:499 |
| 0-500 |
| 1798 | return; executed: return;Execution Count:1 | 1 |
| 1799 | | - |
| 1800 | QVariant v = getZeroVariant(); executed (the execution status of this line is deduced): QVariant v = getZeroVariant(); | - |
| 1801 | bool doInterpret = true; executed (the execution status of this line is deduced): bool doInterpret = true; | - |
| 1802 | QString tmp = edit->displayText(); executed (the execution status of this line is deduced): QString tmp = edit->displayText(); | - |
| 1803 | int pos = edit->cursorPosition(); executed (the execution status of this line is deduced): int pos = edit->cursorPosition(); | - |
| 1804 | const int oldpos = pos; executed (the execution status of this line is deduced): const int oldpos = pos; | - |
| 1805 | | - |
| 1806 | if (q->validate(tmp, pos) != QValidator::Acceptable) { evaluated: q->validate(tmp, pos) != QValidator::Acceptable| yes Evaluation Count:21 | yes Evaluation Count:478 |
| 21-478 |
| 1807 | const QString copy = tmp; executed (the execution status of this line is deduced): const QString copy = tmp; | - |
| 1808 | q->fixup(tmp); executed (the execution status of this line is deduced): q->fixup(tmp); | - |
| 1809 | QASBDEBUG() << "QAbstractSpinBoxPrivate::interpret() text '" never executed: QMessageLogger("widgets/qabstractspinbox.cpp", 1809, __PRETTY_FUNCTION__).debug() << "QAbstractSpinBoxPrivate::interpret() text '" << edit->displayText() << "' >> '" << copy << '\'' << "' >> '" << tmp << '\''; partially evaluated: false| no Evaluation Count:0 | yes Evaluation Count:21 |
| 0-21 |
| 1810 | << edit->displayText() never executed: QMessageLogger("widgets/qabstractspinbox.cpp", 1809, __PRETTY_FUNCTION__).debug() << "QAbstractSpinBoxPrivate::interpret() text '" << edit->displayText() << "' >> '" << copy << '\'' << "' >> '" << tmp << '\''; | 0 |
| 1811 | << "' >> '" << copy << '\'' never executed: QMessageLogger("widgets/qabstractspinbox.cpp", 1809, __PRETTY_FUNCTION__).debug() << "QAbstractSpinBoxPrivate::interpret() text '" << edit->displayText() << "' >> '" << copy << '\'' << "' >> '" << tmp << '\''; | 0 |
| 1812 | << "' >> '" << tmp << '\''; never executed: QMessageLogger("widgets/qabstractspinbox.cpp", 1809, __PRETTY_FUNCTION__).debug() << "QAbstractSpinBoxPrivate::interpret() text '" << edit->displayText() << "' >> '" << copy << '\'' << "' >> '" << tmp << '\''; | 0 |
| 1813 | | - |
| 1814 | doInterpret = tmp != copy && (q->validate(tmp, pos) == QValidator::Acceptable); evaluated: tmp != copy| yes Evaluation Count:16 | yes Evaluation Count:5 |
evaluated: (q->validate(tmp, pos) == QValidator::Acceptable)| yes Evaluation Count:14 | yes Evaluation Count:2 |
| 2-16 |
| 1815 | if (!doInterpret) { evaluated: !doInterpret| yes Evaluation Count:7 | yes Evaluation Count:14 |
| 7-14 |
| 1816 | v = (correctionMode == QAbstractSpinBox::CorrectToNearestValue partially evaluated: correctionMode == QAbstractSpinBox::CorrectToNearestValue| no Evaluation Count:0 | yes Evaluation Count:7 |
| 0-7 |
| 1817 | ? variantBound(minimum, v, maximum) : value); executed (the execution status of this line is deduced): ? variantBound(minimum, v, maximum) : value); | - |
| 1818 | } executed: }Execution Count:7 | 7 |
| 1819 | } executed: }Execution Count:21 | 21 |
| 1820 | if (doInterpret) { evaluated: doInterpret| yes Evaluation Count:492 | yes Evaluation Count:7 |
| 7-492 |
| 1821 | v = valueFromText(tmp); executed (the execution status of this line is deduced): v = valueFromText(tmp); | - |
| 1822 | } executed: }Execution Count:492 | 492 |
| 1823 | clearCache(); executed (the execution status of this line is deduced): clearCache(); | - |
| 1824 | setValue(v, ep, true); executed (the execution status of this line is deduced): setValue(v, ep, true); | - |
| 1825 | if (oldpos != pos) partially evaluated: oldpos != pos| no Evaluation Count:0 | yes Evaluation Count:499 |
| 0-499 |
| 1826 | edit->setCursorPosition(pos); never executed: edit->setCursorPosition(pos); | 0 |
| 1827 | } executed: }Execution Count:499 | 499 |
| 1828 | | - |
| 1829 | void QAbstractSpinBoxPrivate::clearCache() const | - |
| 1830 | { | - |
| 1831 | cachedText.clear(); executed (the execution status of this line is deduced): cachedText.clear(); | - |
| 1832 | cachedValue.clear(); executed (the execution status of this line is deduced): cachedValue.clear(); | - |
| 1833 | cachedState = QValidator::Acceptable; executed (the execution status of this line is deduced): cachedState = QValidator::Acceptable; | - |
| 1834 | } executed: }Execution Count:4117 | 4117 |
| 1835 | | - |
| 1836 | | - |
| 1837 | // --- QSpinBoxValidator --- | - |
| 1838 | | - |
| 1839 | /*! | - |
| 1840 | \internal | - |
| 1841 | Constructs a QSpinBoxValidator object | - |
| 1842 | */ | - |
| 1843 | | - |
| 1844 | QSpinBoxValidator::QSpinBoxValidator(QAbstractSpinBox *qp, QAbstractSpinBoxPrivate *dp) | - |
| 1845 | : QValidator(qp), qptr(qp), dptr(dp) | - |
| 1846 | { | - |
| 1847 | setObjectName(QLatin1String("qt_spinboxvalidator")); executed (the execution status of this line is deduced): setObjectName(QLatin1String("qt_spinboxvalidator")); | - |
| 1848 | } executed: }Execution Count:393 | 393 |
| 1849 | | - |
| 1850 | /*! | - |
| 1851 | \internal | - |
| 1852 | | - |
| 1853 | Checks for specialValueText, prefix, suffix and calls | - |
| 1854 | the virtual QAbstractSpinBox::validate function. | - |
| 1855 | */ | - |
| 1856 | | - |
| 1857 | QValidator::State QSpinBoxValidator::validate(QString &input, int &pos) const | - |
| 1858 | { | - |
| 1859 | if (dptr->specialValueText.size() > 0 && input == dptr->specialValueText) evaluated: dptr->specialValueText.size() > 0| yes Evaluation Count:30 | yes Evaluation Count:5821 |
evaluated: input == dptr->specialValueText| yes Evaluation Count:14 | yes Evaluation Count:16 |
| 14-5821 |
| 1860 | return QValidator::Acceptable; executed: return QValidator::Acceptable;Execution Count:14 | 14 |
| 1861 | | - |
| 1862 | if (!dptr->prefix.isEmpty() && !input.startsWith(dptr->prefix)) { evaluated: !dptr->prefix.isEmpty()| yes Evaluation Count:39 | yes Evaluation Count:5798 |
evaluated: !input.startsWith(dptr->prefix)| yes Evaluation Count:3 | yes Evaluation Count:36 |
| 3-5798 |
| 1863 | input.prepend(dptr->prefix); executed (the execution status of this line is deduced): input.prepend(dptr->prefix); | - |
| 1864 | pos += dptr->prefix.length(); executed (the execution status of this line is deduced): pos += dptr->prefix.length(); | - |
| 1865 | } executed: }Execution Count:3 | 3 |
| 1866 | | - |
| 1867 | if (!dptr->suffix.isEmpty() && !input.endsWith(dptr->suffix)) evaluated: !dptr->suffix.isEmpty()| yes Evaluation Count:28 | yes Evaluation Count:5809 |
evaluated: !input.endsWith(dptr->suffix)| yes Evaluation Count:2 | yes Evaluation Count:26 |
| 2-5809 |
| 1868 | input.append(dptr->suffix); executed: input.append(dptr->suffix);Execution Count:2 | 2 |
| 1869 | | - |
| 1870 | return qptr->validate(input, pos); executed: return qptr->validate(input, pos);Execution Count:5837 | 5837 |
| 1871 | } | - |
| 1872 | /*! | - |
| 1873 | \internal | - |
| 1874 | Calls the virtual QAbstractSpinBox::fixup function. | - |
| 1875 | */ | - |
| 1876 | | - |
| 1877 | void QSpinBoxValidator::fixup(QString &input) const | - |
| 1878 | { | - |
| 1879 | qptr->fixup(input); executed (the execution status of this line is deduced): qptr->fixup(input); | - |
| 1880 | } executed: }Execution Count:21 | 21 |
| 1881 | | - |
| 1882 | // --- global --- | - |
| 1883 | | - |
| 1884 | /*! | - |
| 1885 | \internal | - |
| 1886 | Adds two variants together and returns the result. | - |
| 1887 | */ | - |
| 1888 | | - |
| 1889 | QVariant operator+(const QVariant &arg1, const QVariant &arg2) | - |
| 1890 | { | - |
| 1891 | QVariant ret; executed (the execution status of this line is deduced): QVariant ret; | - |
| 1892 | if (arg1.type() != arg2.type()) partially evaluated: arg1.type() != arg2.type()| no Evaluation Count:0 | yes Evaluation Count:123 |
| 0-123 |
| 1893 | qWarning("QAbstractSpinBox: Internal error: Different types (%s vs %s) (%s:%d)", never executed: QMessageLogger("widgets/qabstractspinbox.cpp", 1893, __PRETTY_FUNCTION__).warning("QAbstractSpinBox: Internal error: Different types (%s vs %s) (%s:%d)", arg1.typeName(), arg2.typeName(), "widgets/qabstractspinbox.cpp", 1894); | 0 |
| 1894 | arg1.typeName(), arg2.typeName(), __FILE__, __LINE__); never executed: QMessageLogger("widgets/qabstractspinbox.cpp", 1893, __PRETTY_FUNCTION__).warning("QAbstractSpinBox: Internal error: Different types (%s vs %s) (%s:%d)", arg1.typeName(), arg2.typeName(), "widgets/qabstractspinbox.cpp", 1894); | 0 |
| 1895 | switch (arg1.type()) { | - |
| 1896 | case QVariant::Int: { | - |
| 1897 | const int int1 = arg1.toInt(); executed (the execution status of this line is deduced): const int int1 = arg1.toInt(); | - |
| 1898 | const int int2 = arg2.toInt(); executed (the execution status of this line is deduced): const int int2 = arg2.toInt(); | - |
| 1899 | if (int1 > 0 && (int2 >= INT_MAX - int1)) { evaluated: int1 > 0| yes Evaluation Count:36 | yes Evaluation Count:14 |
evaluated: (int2 >= 2147483647 - int1)| yes Evaluation Count:2 | yes Evaluation Count:34 |
| 2-36 |
| 1900 | // The increment overflows | - |
| 1901 | ret = QVariant(INT_MAX); executed (the execution status of this line is deduced): ret = QVariant(2147483647); | - |
| 1902 | } else if (int1 < 0 && (int2 <= INT_MIN - int1)) { executed: }Execution Count:2 evaluated: int1 < 0| yes Evaluation Count:3 | yes Evaluation Count:45 |
partially evaluated: (int2 <= (-2147483647 - 1) - int1)| yes Evaluation Count:3 | no Evaluation Count:0 |
| 0-45 |
| 1903 | // The increment underflows | - |
| 1904 | ret = QVariant(INT_MIN); executed (the execution status of this line is deduced): ret = QVariant((-2147483647 - 1)); | - |
| 1905 | } else { executed: }Execution Count:3 | 3 |
| 1906 | ret = QVariant(int1 + int2); executed (the execution status of this line is deduced): ret = QVariant(int1 + int2); | - |
| 1907 | } executed: }Execution Count:45 | 45 |
| 1908 | break; executed: break;Execution Count:50 | 50 |
| 1909 | } | - |
| 1910 | case QVariant::Double: ret = QVariant(arg1.toDouble() + arg2.toDouble()); break; executed: break;Execution Count:73 | 73 |
| 1911 | case QVariant::DateTime: { | - |
| 1912 | QDateTime a2 = arg2.toDateTime(); never executed (the execution status of this line is deduced): QDateTime a2 = arg2.toDateTime(); | - |
| 1913 | QDateTime a1 = arg1.toDateTime().addDays(QDATETIMEEDIT_DATETIME_MIN.daysTo(a2)); never executed (the execution status of this line is deduced): QDateTime a1 = arg1.toDateTime().addDays(QDateTime(QDate(100, 1, 1), QTime(0, 0, 0, 0)).daysTo(a2)); | - |
| 1914 | a1.setTime(a1.time().addMSecs(QTime().msecsTo(a2.time()))); never executed (the execution status of this line is deduced): a1.setTime(a1.time().addMSecs(QTime().msecsTo(a2.time()))); | - |
| 1915 | ret = QVariant(a1); never executed (the execution status of this line is deduced): ret = QVariant(a1); | - |
| 1916 | } | - |
| 1917 | default: break; | 0 |
| 1918 | } | - |
| 1919 | return ret; executed: return ret;Execution Count:123 | 123 |
| 1920 | } | - |
| 1921 | | - |
| 1922 | | - |
| 1923 | /*! | - |
| 1924 | \internal | - |
| 1925 | Subtracts two variants and returns the result. | - |
| 1926 | */ | - |
| 1927 | | - |
| 1928 | QVariant operator-(const QVariant &arg1, const QVariant &arg2) | - |
| 1929 | { | - |
| 1930 | QVariant ret; never executed (the execution status of this line is deduced): QVariant ret; | - |
| 1931 | if (arg1.type() != arg2.type()) never evaluated: arg1.type() != arg2.type() | 0 |
| 1932 | qWarning("QAbstractSpinBox: Internal error: Different types (%s vs %s) (%s:%d)", never executed: QMessageLogger("widgets/qabstractspinbox.cpp", 1932, __PRETTY_FUNCTION__).warning("QAbstractSpinBox: Internal error: Different types (%s vs %s) (%s:%d)", arg1.typeName(), arg2.typeName(), "widgets/qabstractspinbox.cpp", 1933); | 0 |
| 1933 | arg1.typeName(), arg2.typeName(), __FILE__, __LINE__); never executed: QMessageLogger("widgets/qabstractspinbox.cpp", 1932, __PRETTY_FUNCTION__).warning("QAbstractSpinBox: Internal error: Different types (%s vs %s) (%s:%d)", arg1.typeName(), arg2.typeName(), "widgets/qabstractspinbox.cpp", 1933); | 0 |
| 1934 | switch (arg1.type()) { | - |
| 1935 | case QVariant::Int: ret = QVariant(arg1.toInt() - arg2.toInt()); break; | 0 |
| 1936 | case QVariant::Double: ret = QVariant(arg1.toDouble() - arg2.toDouble()); break; | 0 |
| 1937 | case QVariant::DateTime: { | - |
| 1938 | QDateTime a1 = arg1.toDateTime(); never executed (the execution status of this line is deduced): QDateTime a1 = arg1.toDateTime(); | - |
| 1939 | QDateTime a2 = arg2.toDateTime(); never executed (the execution status of this line is deduced): QDateTime a2 = arg2.toDateTime(); | - |
| 1940 | int days = a2.daysTo(a1); never executed (the execution status of this line is deduced): int days = a2.daysTo(a1); | - |
| 1941 | int secs = a2.secsTo(a1); never executed (the execution status of this line is deduced): int secs = a2.secsTo(a1); | - |
| 1942 | int msecs = qMax(0, a1.time().msec() - a2.time().msec()); never executed (the execution status of this line is deduced): int msecs = qMax(0, a1.time().msec() - a2.time().msec()); | - |
| 1943 | if (days < 0 || secs < 0 || msecs < 0) { never evaluated: days < 0 never evaluated: secs < 0 never evaluated: msecs < 0 | 0 |
| 1944 | ret = arg1; never executed (the execution status of this line is deduced): ret = arg1; | - |
| 1945 | } else { | 0 |
| 1946 | QDateTime dt = a2.addDays(days).addSecs(secs); never executed (the execution status of this line is deduced): QDateTime dt = a2.addDays(days).addSecs(secs); | - |
| 1947 | if (msecs > 0) never evaluated: msecs > 0 | 0 |
| 1948 | dt.setTime(dt.time().addMSecs(msecs)); never executed: dt.setTime(dt.time().addMSecs(msecs)); | 0 |
| 1949 | ret = QVariant(dt); never executed (the execution status of this line is deduced): ret = QVariant(dt); | - |
| 1950 | } | 0 |
| 1951 | } | - |
| 1952 | default: break; | 0 |
| 1953 | } | - |
| 1954 | return ret; never executed: return ret; | 0 |
| 1955 | } | - |
| 1956 | | - |
| 1957 | /*! | - |
| 1958 | \internal | - |
| 1959 | Multiplies \a arg1 by \a multiplier and returns the result. | - |
| 1960 | */ | - |
| 1961 | | - |
| 1962 | QVariant operator*(const QVariant &arg1, double multiplier) | - |
| 1963 | { | - |
| 1964 | QVariant ret; executed (the execution status of this line is deduced): QVariant ret; | - |
| 1965 | | - |
| 1966 | switch (arg1.type()) { | - |
| 1967 | case QVariant::Int: | - |
| 1968 | ret = static_cast<int>(qBound<double>(INT_MIN, arg1.toInt() * multiplier, INT_MAX)); executed (the execution status of this line is deduced): ret = static_cast<int>(qBound<double>((-2147483647 - 1), arg1.toInt() * multiplier, 2147483647)); | - |
| 1969 | break; executed: break;Execution Count:50 | 50 |
| 1970 | case QVariant::Double: ret = QVariant(arg1.toDouble() * multiplier); break; executed: break;Execution Count:73 | 73 |
| 1971 | case QVariant::DateTime: { | - |
| 1972 | double days = QDATETIMEEDIT_DATE_MIN.daysTo(arg1.toDateTime().date()) * multiplier; never executed (the execution status of this line is deduced): double days = QDate(100, 1, 1).daysTo(arg1.toDateTime().date()) * multiplier; | - |
| 1973 | int daysInt = (int)days; never executed (the execution status of this line is deduced): int daysInt = (int)days; | - |
| 1974 | days -= daysInt; never executed (the execution status of this line is deduced): days -= daysInt; | - |
| 1975 | long msecs = (long)((QDATETIMEEDIT_TIME_MIN.msecsTo(arg1.toDateTime().time()) * multiplier) never executed (the execution status of this line is deduced): long msecs = (long)((QTime(0, 0, 0, 0).msecsTo(arg1.toDateTime().time()) * multiplier) | - |
| 1976 | + (days * (24 * 3600 * 1000))); never executed (the execution status of this line is deduced): + (days * (24 * 3600 * 1000))); | - |
| 1977 | ret = QDateTime(QDate().addDays(int(days)), QTime().addMSecs(msecs)); never executed (the execution status of this line is deduced): ret = QDateTime(QDate().addDays(int(days)), QTime().addMSecs(msecs)); | - |
| 1978 | break; | 0 |
| 1979 | } | - |
| 1980 | default: ret = arg1; break; | 0 |
| 1981 | } | - |
| 1982 | | - |
| 1983 | return ret; executed: return ret;Execution Count:123 | 123 |
| 1984 | } | - |
| 1985 | | - |
| 1986 | | - |
| 1987 | | - |
| 1988 | double operator/(const QVariant &arg1, const QVariant &arg2) | - |
| 1989 | { | - |
| 1990 | double a1 = 0; never executed (the execution status of this line is deduced): double a1 = 0; | - |
| 1991 | double a2 = 0; never executed (the execution status of this line is deduced): double a2 = 0; | - |
| 1992 | | - |
| 1993 | switch (arg1.type()) { | - |
| 1994 | case QVariant::Int: | - |
| 1995 | a1 = (double)arg1.toInt(); never executed (the execution status of this line is deduced): a1 = (double)arg1.toInt(); | - |
| 1996 | a2 = (double)arg2.toInt(); never executed (the execution status of this line is deduced): a2 = (double)arg2.toInt(); | - |
| 1997 | break; | 0 |
| 1998 | case QVariant::Double: | - |
| 1999 | a1 = arg1.toDouble(); never executed (the execution status of this line is deduced): a1 = arg1.toDouble(); | - |
| 2000 | a2 = arg2.toDouble(); never executed (the execution status of this line is deduced): a2 = arg2.toDouble(); | - |
| 2001 | break; | 0 |
| 2002 | case QVariant::DateTime: | - |
| 2003 | a1 = QDATETIMEEDIT_DATE_MIN.daysTo(arg1.toDate()); never executed (the execution status of this line is deduced): a1 = QDate(100, 1, 1).daysTo(arg1.toDate()); | - |
| 2004 | a2 = QDATETIMEEDIT_DATE_MIN.daysTo(arg2.toDate()); never executed (the execution status of this line is deduced): a2 = QDate(100, 1, 1).daysTo(arg2.toDate()); | - |
| 2005 | a1 += (double)QDATETIMEEDIT_TIME_MIN.msecsTo(arg1.toDateTime().time()) / (long)(3600 * 24 * 1000); never executed (the execution status of this line is deduced): a1 += (double)QTime(0, 0, 0, 0).msecsTo(arg1.toDateTime().time()) / (long)(3600 * 24 * 1000); | - |
| 2006 | a2 += (double)QDATETIMEEDIT_TIME_MIN.msecsTo(arg2.toDateTime().time()) / (long)(3600 * 24 * 1000); never executed (the execution status of this line is deduced): a2 += (double)QTime(0, 0, 0, 0).msecsTo(arg2.toDateTime().time()) / (long)(3600 * 24 * 1000); | - |
| 2007 | default: break; | 0 |
| 2008 | } | - |
| 2009 | | - |
| 2010 | return (a1 != 0 && a2 != 0) ? (a1 / a2) : 0.0; never executed: return (a1 != 0 && a2 != 0) ? (a1 / a2) : 0.0; | 0 |
| 2011 | } | - |
| 2012 | | - |
| 2013 | int QAbstractSpinBoxPrivate::variantCompare(const QVariant &arg1, const QVariant &arg2) | - |
| 2014 | { | - |
| 2015 | switch (arg2.type()) { | - |
| 2016 | case QVariant::Date: | - |
| 2017 | Q_ASSERT_X(arg1.type() == QVariant::Date, "QAbstractSpinBoxPrivate::variantCompare", never executed (the execution status of this line is deduced): qt_noop(); | - |
| 2018 | qPrintable(QString::fromLatin1("Internal error 1 (%1)"). | - |
| 2019 | arg(QString::fromLatin1(arg1.typeName())))); | - |
| 2020 | if (arg1.toDate() == arg2.toDate()) { never evaluated: arg1.toDate() == arg2.toDate() | 0 |
| 2021 | return 0; never executed: return 0; | 0 |
| 2022 | } else if (arg1.toDate() < arg2.toDate()) { never evaluated: arg1.toDate() < arg2.toDate() | 0 |
| 2023 | return -1; never executed: return -1; | 0 |
| 2024 | } else { | - |
| 2025 | return 1; never executed: return 1; | 0 |
| 2026 | } | - |
| 2027 | case QVariant::Time: | - |
| 2028 | Q_ASSERT_X(arg1.type() == QVariant::Time, "QAbstractSpinBoxPrivate::variantCompare", never executed (the execution status of this line is deduced): qt_noop(); | - |
| 2029 | qPrintable(QString::fromLatin1("Internal error 2 (%1)"). | - |
| 2030 | arg(QString::fromLatin1(arg1.typeName())))); | - |
| 2031 | if (arg1.toTime() == arg2.toTime()) { never evaluated: arg1.toTime() == arg2.toTime() | 0 |
| 2032 | return 0; never executed: return 0; | 0 |
| 2033 | } else if (arg1.toTime() < arg2.toTime()) { never evaluated: arg1.toTime() < arg2.toTime() | 0 |
| 2034 | return -1; never executed: return -1; | 0 |
| 2035 | } else { | - |
| 2036 | return 1; never executed: return 1; | 0 |
| 2037 | } | - |
| 2038 | | - |
| 2039 | | - |
| 2040 | case QVariant::DateTime: | - |
| 2041 | if (arg1.toDateTime() == arg2.toDateTime()) { evaluated: arg1.toDateTime() == arg2.toDateTime()| yes Evaluation Count:379 | yes Evaluation Count:13056 |
| 379-13056 |
| 2042 | return 0; executed: return 0;Execution Count:379 | 379 |
| 2043 | } else if (arg1.toDateTime() < arg2.toDateTime()) { evaluated: arg1.toDateTime() < arg2.toDateTime()| yes Evaluation Count:7221 | yes Evaluation Count:5835 |
| 5835-7221 |
| 2044 | return -1; executed: return -1;Execution Count:7221 | 7221 |
| 2045 | } else { | - |
| 2046 | return 1; executed: return 1;Execution Count:5835 | 5835 |
| 2047 | } | - |
| 2048 | case QVariant::Int: | - |
| 2049 | if (arg1.toInt() == arg2.toInt()) { evaluated: arg1.toInt() == arg2.toInt()| yes Evaluation Count:871 | yes Evaluation Count:3269 |
| 871-3269 |
| 2050 | return 0; executed: return 0;Execution Count:871 | 871 |
| 2051 | } else if (arg1.toInt() < arg2.toInt()) { evaluated: arg1.toInt() < arg2.toInt()| yes Evaluation Count:2027 | yes Evaluation Count:1242 |
| 1242-2027 |
| 2052 | return -1; executed: return -1;Execution Count:2027 | 2027 |
| 2053 | } else { | - |
| 2054 | return 1; executed: return 1;Execution Count:1242 | 1242 |
| 2055 | } | - |
| 2056 | case QVariant::Double: | - |
| 2057 | if (arg1.toDouble() == arg2.toDouble()) { evaluated: arg1.toDouble() == arg2.toDouble()| yes Evaluation Count:1267 | yes Evaluation Count:3129 |
| 1267-3129 |
| 2058 | return 0; executed: return 0;Execution Count:1267 | 1267 |
| 2059 | } else if (arg1.toDouble() < arg2.toDouble()) { evaluated: arg1.toDouble() < arg2.toDouble()| yes Evaluation Count:2254 | yes Evaluation Count:875 |
| 875-2254 |
| 2060 | return -1; executed: return -1;Execution Count:2254 | 2254 |
| 2061 | } else { | - |
| 2062 | return 1; executed: return 1;Execution Count:875 | 875 |
| 2063 | } | - |
| 2064 | case QVariant::Invalid: | - |
| 2065 | if (arg2.type() == QVariant::Invalid) never evaluated: arg2.type() == QVariant::Invalid | 0 |
| 2066 | return 0; never executed: return 0; | 0 |
| 2067 | default: code before this statement never executed: default: | 0 |
| 2068 | Q_ASSERT_X(0, "QAbstractSpinBoxPrivate::variantCompare", never executed (the execution status of this line is deduced): qt_noop(); | - |
| 2069 | qPrintable(QString::fromLatin1("Internal error 3 (%1 %2)"). | - |
| 2070 | arg(QString::fromLatin1(arg1.typeName())). | - |
| 2071 | arg(QString::fromLatin1(arg2.typeName())))); | - |
| 2072 | } | 0 |
| 2073 | return -2; never executed: return -2; | 0 |
| 2074 | } | - |
| 2075 | | - |
| 2076 | QVariant QAbstractSpinBoxPrivate::variantBound(const QVariant &min, | - |
| 2077 | const QVariant &value, | - |
| 2078 | const QVariant &max) | - |
| 2079 | { | - |
| 2080 | Q_ASSERT(variantCompare(min, max) <= 0); never executed (the execution status of this line is deduced): qt_noop(); | - |
| 2081 | if (variantCompare(min, value) < 0) { never evaluated: variantCompare(min, value) < 0 | 0 |
| 2082 | const int compMax = variantCompare(value, max); never executed (the execution status of this line is deduced): const int compMax = variantCompare(value, max); | - |
| 2083 | return (compMax < 0 ? value : max); never executed: return (compMax < 0 ? value : max); | 0 |
| 2084 | } else { | - |
| 2085 | return min; never executed: return min; | 0 |
| 2086 | } | - |
| 2087 | } | - |
| 2088 | | - |
| 2089 | | - |
| 2090 | QT_END_NAMESPACE | - |
| 2091 | | - |
| 2092 | #include "moc_qabstractspinbox.cpp" | - |
| 2093 | | - |
| 2094 | #endif // QT_NO_SPINBOX | - |
| 2095 | | - |
| | |