summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qabstractspinbox.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix -Wimplicit-fallthrough for clangTim Blechmann2024-03-011-0/+1
| | | | | | | | | | | | | | | | | | | Clang's `-Wimplicit-fallthrough` warnings are a little stricter than gcc's interpretation: switch (i) { case 0: foo(); case 4: break; } While gcc accepts the implicit fallthrough, if the following statement is a trivial `break`, clang will warn about it. Pick-to: 6.7 Change-Id: I38e0817f1bc034fbb552aeac21de1516edcbcbb0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QAbstractSpinBox: use pmf-style connectsChristian Ehrlicher2023-11-091-10/+10
| | | | | | | | Use pmf-style connections instead old string-based ones. Change-Id: Idab3a9d60e7cddcd2076476a21dbb1b5d2e4189c Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Include what you need: <QPointer>Marc Mutz2023-10-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | All these TUs relied on transitive includes of qpointer.h, maybe to a large extent via qevent.h, though, given that qevent.h is more or less the only public QtBase header that includes qpointer.h, something else seems to be at play here. Said qevent.h actually needs QPointer in-name-only, so a forward declaration would suffice. Prepare for qevent.h dropping the include. The algorithm I used was: If the TU mentions 'passiveGrabbers', the name of the QEvent function that returns QPointers, and the TU doesn't have qpointer.h included explicitly, include it. That may produce False Positives, but better safe than sorry. Otherwise, in src/, add an include to all source and header files which mention QPointer. Exception: if foo.h of a foo.cpp already includes it, don't include again. Task-number: QTBUG-117670 Change-Id: I3321cccdb41ce0ba6d8a709cea92427aba398254 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
* Port from container.count()/length() to size()Marc Mutz2022-10-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is semantic patch using ClangTidyTransformator: auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o) makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container'. <classes> are: // sequential: "QByteArray", "QList", "QQueue", "QStack", "QString", "QVarLengthArray", "QVector", // associative: "QHash", "QMultiHash", "QMap", "QMultiMap", "QSet", // Qt has no QMultiSet Change-Id: Ibe8837be96e8d30d1846881ecd65180c1bc459af Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add QStyleHints::keyboardAutoRepeatRateF()Tor Arne Vestbø2022-09-291-1/+1
| | | | | | | | | | The keyboardAutoRepeatRate() function returning an int assumes the rate can not be lower than one event per second, but this is not always the case, e.g. on macOS where the slowest setting for key repeat results in a two second delay between events. Change-Id: I806fb57883ce0085c835fb0a43d6b86bd6da375a Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace QT_NO_ACCESSIBILITY with QT_CONFIG(accessibility)Allan Sandfeld Jensen2022-06-151-3/+3
| | | | | | | Pick-to: 6.4 Change-Id: Iee4bd8970810be1b23bdba65a74de912401dca65 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Marc Mutz <marc.mutz@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* QtWidgets: use _L1 for for creating Latin-1 string literalsSona Kurazyan2022-05-021-3/+5
| | | | | | Task-number: QTBUG-98434 Change-Id: I310ea8f19d73a79d985ebfb8bfbff7a02c424360 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtWidgets: stop using QLatin1Char constructor for creating char literalsSona Kurazyan2022-04-261-2/+2
| | | | | | | | | | | Required for porting away from QLatin1Char/QLatin1String in scope of QTBUG-98434. As a drive-by, fix qsizetype -> int narrowing conversion warnings for the touched lines. Change-Id: I133b80334b66e0a5ab9546dd8e1ff0631e79601e Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Add style hint for preventing spin box selection on up/downVolker Hilsheimer2021-10-081-1/+2
| | | | | | | | | | | | | | | | | | | | | | On a mobile device, selecting text in a line edit brings up the text action popup for select/copy/cut. In a spinbox where the user changes the value using the buttons, this can be very irritating, without providing any usability - the user is unlikely to start typing, at least not without first transferring focus into the lineedit first to bring up the keyboard. This style hint allows styles to override the default behavior of QAbstractSpinBox. Implement the customization for the Android style, and add a test case for QSpinBox. [ChangeLog][QtWidgets][QStyle] A new style hint, SH_SpinBox_SelectOnStep, specifies whether pressing the up/down buttons or keys in a spinbox will automatically select the text. Fixes: QTBUG-93366 Change-Id: If06365a7c62087a2213145e13119f56544ac33b5 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Adjust code format, add space after 'if'Zhang Sheng2020-11-161-2/+2
| | | | | | Change-Id: Ice081c891ff7f4b766f49dd4bd5cf18c30237acf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Doc: Add missing brief statements for \property documentationTopi Reinio2020-11-121-1/+1
| | | | | | | | ... where applicable. Fixes: QTBUG-88232 Change-Id: I835df434765caededd35d5114965b4a1663e7942 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QAbstractSpinBox: don't emit update signals twiceRichard Moe Gustavsen2020-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | A QAbstractSpinBox has a spinClickThresholdTimer that is detecting if the user is doing a press'n'hold on one of the spin buttons, to activate auto-repeat. But if the valueChanged() handler in the application spends too much time before it returns, the spinClickThresholdTimer will fire before we get a chance to cancel it from the pending mouseRelease event. The result is that the spinbox will think that the user is doing a press'n'hold, and increment the value once more. To avoid this, we start the timer _after_ the call to valueChanged() instead. Pick-to: 5.15 Fixes: QTBUG-86483 Change-Id: Iff5de4f8da562738e02848c98bc1fbc9fe227748 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Make initStyleOption virtual for various classesThorbjørn Lund Martsum2020-07-311-0/+2
| | | | | | | | | | | | | | | | | | | | Often a simple change in the styleoptions is needed in e.g a paintEvent, but it was impossible without copying the whole paint-function which is not always trivial and also wouldn't be kept up-to-date if it was changed in Qt. The initStyleOption is similar to viewOptions in QAbstractTableView and it is handy that this function is virtual. Furthermore QStyledItemDelegate::initStyleOption is already virtual. This change only makes initStyleOption virtual for public classes. [ChangeLog][QtWidgets] InitStyleOption has been made virtual in public Qt classes to make override of stylebehavior more simple. Change-Id: I38974c6d4dd0793ca5976ecf3aa28892215a1579 Task-number: QTBUG-77642 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
* Add ; to Q_UNUSEDLars Schmertmann2020-07-071-1/+1
| | | | | | | | This is required to remove the ; from the macro with Qt 6. Task-number: QTBUG-82978 Change-Id: I3f0b6717956ca8fa486bed9817b89dfa19f5e0e1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Clean up data members and initialization in QAbstractSpinBoxVolker Hilsheimer2020-07-071-9/+3
| | | | | | | | Group the bit flags together and generally order roughly by size to give the compiler better packing options. Change-Id: I9468d5aaef96e115ad363c59222e626d792a0edc Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* Maintain keyboard modifier state in QAbstractSpinBox's input event handlersVolker Hilsheimer2020-07-021-3/+9
| | | | | | | | | | Gets rid of calls to QGuiApplication::keyboardModifiers. Need to handle key and mouse events, since the spin buttons may be clicked on without the spinbox having focus. Task-number: QTBUG-73829 Change-Id: I455c42987f19bb5b7997dc8d61272863d7bc394e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Port QtWidgets from QStringRef to QStringViewLars Knoll2020-06-101-1/+1
| | | | | Change-Id: Ibe348e7aea838ab8c2d628bb43709c867a506637 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Replace calls to deprecated QEvent accessor functionsShawn Rutledge2020-06-081-3/+3
| | | | | | | Many of these were generated by clazy using the new qevent-accessors check. Change-Id: Ie17af17f50fdc9f47d7859d267c14568cc350fd0 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QApplication: remove obsolete globalStrut functionalityVolker Hilsheimer2020-04-101-4/+2
| | | | | | Change-Id: If56873f86f5291264cac720f8db7dbd4db756f49 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Replace most use of QVariant::type and occurrences of QVariant::TypeOlivier Goffart2020-01-231-35/+35
| | | | | | | | | | | | | | | | | | | | | I made a clazy automated check that replaced the use of QVariant::Type by the equivalent in QMetaType. This has been deprecated since Qt 5.0, but many uses were not yet removed. In addition, there was some manual changes to fix the compilation errors. Adapted the Private API of QDateTimeParser and QMimeDataPrivate and adjust QDateTimeEdit and QSpinBox. QVariant(QVariant::Invalid) in qstylesheet made no sense. But note that in QVariant::save, we actually wanted to use the non-user type. In the SQL module, many changes were actually reverted because the API still expects QVarient::Type. Change-Id: I98c368490e4ee465ed3a3b63bda8b8eaa50ea67e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-5/+5
| | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Deprecate constructing QFlags from a pointerAllan Sandfeld Jensen2019-11-201-2/+2
| | | | | | | | | This was used to support QFlags f = 0 initialization, but with 0 used as a pointer literal now considered bad form, it had been changed many places to QFlags f = nullptr, which is meaningless and confusing. Change-Id: I4bc592151c255dc5cab1a232615caecc520f02e8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QAbstractSpinBox css: properly honor spincontrol-disable-on-boundsChristian Ehrlicher2019-09-231-1/+1
| | | | | | | | | | | | The css style 'spincontrol-disable-on-bounds' was not properly honored within QAbstractSpinBox::initStyleOption() because the affected widget was not passed to QStyle::styleHint(). Therefore QStyleSheetStyle did not find the correct render rule. Fix it by passing 'this' as third argument to QStyle::styleHint(). Fixes: QTBUG-18008 Change-Id: Iabcebf0b83143f45309b4e7066bccb8d20bd0419 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Fix build without features.shortcutTasuku Suzuki2019-08-151-0/+2
| | | | | Change-Id: I56ccf104c57e24824e8d09951bb27415307d5abc Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* Remove usages of deprecated QApplication::keypadNavigationEnabledSona Kurazyan2019-07-231-6/+7
| | | | | | | | | | Added QApplicationPrivate::keypadNavigationEnabled() as a replacement of deprecated QApplication::keypadNavigationEnabled(), for the internal usage. Task-number: QTBUG-76491 Change-Id: I75f4c628b72d86b5e428e7e285a786d23abbf3f2 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
* QtWidgets: Fix static method invocationsFriedemann Kleint2019-06-281-3/+3
| | | | | | | | | | | | | | | | | | | | | Apply fixits by Creator and results of manual search focusing on QCore/Gui/Applicaton(Private) methods and variables to prepare for splitting out some classes. Task-number: QTBUG-69478 Task-number: QTBUG-76497 Task-number: QTBUG-76493 Change-Id: Iaf468166793e0cabb514b51c827b30317bf45a2d Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
* Merge remote-tracking branch 'origin/5.13' into devFriedemann Kleint2019-05-271-0/+1
|\ | | | | | | Change-Id: Ia279fc4a8226626041c772902a07b2f90f37b53b
| * QAbstractSpinBox: fix some ui glitchesChristian Ehrlicher2019-05-101-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix some ui glitches for QAbstractSpinBox: - update geometry when buttons are toggled on/off - calc button size with subControlRect instead hardcoded 20px - when buttons are not shown, don't add the button size in sizeFromContents for common and macOS style Fixes: QTBUG-39713 Fixes: QTBUG-75303 Task-number: QTBUG-67126 Change-Id: Ibf330c76deb16358a481bba6bd429fff6a5d57ae Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* | Add shortcut for select all in QSpinBoxFrederik Gladhorn2019-05-151-0/+1
| | | | | | | | | | | | | | | | This adds the shortcut to spinboxes and date edites. Fixes: QTBUG-48231 Change-Id: I91400e1990e4b1d7d971198c1e2a64149c2a835e Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | Add startOfDay() and endOfDay() methods to QDateEdward Welbourne2019-04-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These methods give the first and last QDateTime values in the given day, for a given time-zone or time-spec. These are usually the relevant midnight, or the millisecond before, except when time-zone transitions (typically DST changes) skip it, when care is needed to select the right moment. Adapted some code to make use of the new API, eliminating some old cruft from qdatetimeparser_p.h in the process. [ChangeLog][QtCore][QDate] Added startOfDay() and endOfDay() methods to provide a QDateTime at the start and end of a given date, taking account of any time skipped by transitions, e.g. a DST spring-forward, which can lead to a day starting at 01:00 or ending just before 23:00. Task-number: QTBUG-64485 Change-Id: I3dd7a34bedfbec8f8af00c43d13f50f99346ecd0 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Use the QTime API less clumsilyEdward Welbourne2019-04-011-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | Various patterns seem to have been copied, notably counting time from QTime(0, 0) rather than using QTime::msecsSinceStartOfDay() and its setter. Unsuitable value types also put in an appearance, and QTime()'s parameters after the first two default to 0 anyway. Corrected a lie in QTime()'s default constructor doc; it does not work the same as QTime(0, 0) at all. Change-Id: Icf1a10052a049e68fd0f665958f36dbe75ac46d5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Merge remote-tracking branch 'origin/5.13' into devQt Forward Merge Bot2019-03-141-1/+1
|\| | | | | | | | | | | | | Conflicts: src/corelib/tools/qcollator_win.cpp Change-Id: I6d806d7c58b2057ebde3ad915bb5551f34b700e5
| * Doc: replace 0 with \nullptr in documentationChristian Ehrlicher2019-03-131-1/+1
| | | | | | | | | | | | | | Replace some more 0 with \nullptr. Change-Id: I2af91bf3712eef5161b11da0c44614bc039ade03 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* | QSpinBox: add new signal textChanged(QString)Christian Ehrlicher2019-03-011-7/+7
|/ | | | | | | | | | | | | Add a new signal textChanged(QString) as a replacement for valueChanged(QString) so valueChanged(QString) can be removed with Qt6. This removes the ambiguous valueChanged() signal and also matches the 'text' property naming. Change-Id: I0676a7112f70add20a3a7ef9381268cd9b8a5851 Reviewed-by: Konstantin Shegunov <kshegunov@gmail.com> Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Fix can not -> cannotRobert Loehning2019-02-251-1/+1
| | | | | Change-Id: Ie9992f67ca59aff662a4be046ace08640e7c2714 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Documentation: Add \nullptr macro and use where applicableFriedemann Kleint2019-01-101-1/+1
| | | | | | | | | | | | | | | | Qt for Python users reading the documentation assume that int(0) can be passed for pointer parameters. Use the newly introduced \nullptr to disambiguate this. In a follow-up step, the \nullptr macro can be defined as None when generating the Qt for Python documentation. Task-number: PYSIDE-903 Change-Id: I3a45f87175a0668ab5f3f95f0aff409f7e3ef027 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Fix typo vice versaCristian Maureira-Fredes2018-10-151-2/+2
| | | | | Change-Id: I639d6f9d2019998d91b52506afa2cbd861a0dbe4 Reviewed-by: Gabriel de Dietrich (DO NOT ADD TO REVIEWS) <gabriel.dedietrich@gmail.com>
* qdoc: Fix several minor errors to reduce qdoc warningsMartin Smith2018-08-141-0/+7
| | | | | | | | | | This update corrects several minor documentation errors that cause qdoc warnings. These include incorrect or missing \fn commands, incorrect uses of \e and \a commands together, incorrect spellings, etc. Change-Id: Ib26edef541fa3440025490bcf79cc101623e7f7b Reviewed-by: Martin Smith <martin.smith@qt.io>
* Add QStyle::SH_SpinBox_StepModifier style hintNathan Collins2018-07-121-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows the developer to pick which keyboard modifier increases the number of steps a QAbstractSpinBox takes when the user interacts with it. The modifier can be either Qt::ControlModifier (default), Qt::ShiftModifier or Qt::NoModifier. Qt::NoModifier disables the step modifier. Note that on macOS, Control corresponds to the Command key. Holding the modifier increases the step rate when: - scrolling; - pressing the up/down keys; - pressing the spin box up/down buttons. [ChangeLog][QtWidgets][QStyle] QStyle::SH_SpinBox_StepModifier allows the developer to pick which keyboard modifier increases the number of steps a QAbstractSpinBox takes for the following interactions: scrolling, up/down keyboard keys and the spin box buttons. The Qt::ShiftModifier can now be used, or the feature can be disabled using Qt::NoModifier. Previously, only Qt::ControlModifier could be used as the modifier. Change-Id: Ib5518127e86a8f67798a9a1d6e860c6e35896e6f Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-06-071-1/+5
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/corelib/kernel/qeventdispatcher_cf.mm src/gui/kernel/qguiapplication_p.h src/gui/kernel/qwindowsysteminterface.cpp src/gui/kernel/qwindowsysteminterface.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnswindowdelegate.mm src/plugins/platforms/ios/qioseventdispatcher.mm src/plugins/platforms/windows/qwindowsdrag.h src/plugins/platforms/windows/qwindowsinternalmimedata.h src/plugins/platforms/windows/qwindowsmime.cpp src/plugins/platforms/winrt/qwinrtscreen.cpp Change-Id: Ic817f265c2386e83839d2bb9ef7419cb29705246
| * QAbstractSpinBox: Add more documentation cross linksAndre Hartmann2018-06-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | stepUp() and stepDown() already linked to stepBy(), so add the reverse too. keyPressEvent() talks about stepBy() too, so add it to the cross reference. Change-Id: I22c841821331eaed9607cfb2807dcf0e2886d952 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Luca Beldi <v.ronin@yahoo.it> Reviewed-by: Samuel Gaist <samuel.gaist@edeltech.ch> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * QAbstractSpinBox: Fix missing frame conditionGabriel de Dietrich2018-05-301-1/+1
| | | | | | | | | | | | | | | | Wrong check for SH_SpinBox_ButtonsInsideFrame in initStyleOption(). Change-Id: I35c6ff4d007f171fe44d7f3e5734c6f4586d871b Task-number: QTBUG-68238 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | Apply Qt::ControlModifier to all spin box interactionsNathan Collins2018-05-241-6/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A step modifier already existed when scrolling with the Qt::ControlModifier held. This patch applies this functionality to other methods of stepping a spin box. Holding the modifier increases the step rate when: - scrolling; - pressing the up/down keys; - pressing the spin box up/down buttons. [ChangeLog][QtWidgets][QAbstractSpinBox] The Qt::ControlModifier increases the number of steps a QAbstractSpinBox takes for the following interactions: scrolling, up/down keyboard keys and the spin box buttons. Previously, Qt::ControlModifier only affected scrolling. Task-number: QTBUG-67380 Change-Id: Icc8754d5c007da0771bfaef113603a2f334dd494 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* | Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-04-061-5/+4
|\| | | | | | | Change-Id: Ic811cd444e523b904211797112bba6aaec85dddd
| * Improve QAbstractSpinBox::stepBy() docsMitch Curtis2018-04-051-5/+4
| | | | | | | | | | Change-Id: I28e942b6b2952205641c751e4c120cb38ae13fd6 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
* | Allow adaptive decimal stepping for QSpinBox and QDoubleSpinBoxHarald Nordgren2018-03-221-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds the feature of adaptive decimal step sizes for the QSpinBox and QDoubleSpinBox. By performing a calculation in QAbstractSpinBox::stepBy() we continuously set the step size one power of ten below the current value. So when the value is 1100, the step is set to 100, so stepping up once increases it to 1200. For 1200 stepping up takes it to 1300. For negative values stepping down from -1100 goes to -1200. It also works for all decimal values. 0.041 is increased to 0.042 by stepping once, and so on. The step direction is taken into account to handle edges cases, so that stepping down from 100 takes the value to 99 instead of 90. Thus, a step up followed by a step down -- or vice versa -- lands on the starting value; 99 -> 100 -> 99. Setting this property effectively disregards singleStep, but preserves its value so that it takes effect again when adaptive decimal step is disabled. Adaptive decimal step allows values to be easily set to reasonable levels. If the spin box value is 12000, changing to 13000 often makes more sense than to 12001. The feature is turned off be default, when single stepping is desired. The accelerated property allows values to be changed quickly, as well, but it is imprecise. Holding down the button makes it hard to land on an even thousand, like 12000 or 13000. Often you end up somewhere nearby and would need a second adjustment to get to an even hundred or thousand. [ChangeLog][QtWidgets] Add option of adaptive decimal step size for QSpinBox and QDoubleSpinBox. Change-Id: I9f286479b821e240c8ea05c238932fc128c582bb Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | QAbstractSpinBox: respond to QEvent::LocaleChangeSven Pauli2018-03-051-0/+3
|/ | | | | | | | | | | Add a branch for QEvent::LocaleChange to the QAbstractSpinBox::event() handler to call updateEdit(). This will update the edit in case the locale's number features changed (decimal separator etc.). Task-number: QTBUG-65315 Change-Id: I9015b3a5bbe8e7b80f7bafa13f0f431507bc4cf7 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
* Introducing SH_SpinBox_ButtonsInsideFrameGabriel de Dietrich2018-02-051-2/+6
| | | | | | | | | | This is currently only used in QMacStyle since, on macOS, the spin-box buttons are always beside the line-edit. Hence, there is no need to tamper with the line-edit frame. Change-Id: I8ccfbab547fccae89a8ddeaeb7005cb17d5951e6 Reviewed-by: Jake Petroules <jake.petroules@qt.io>
* QMacStyle: CC_SpinBox is now HITheme-freeGabriel de Dietrich2018-02-051-0/+5
| | | | | | | | | | | | | | | | | | | | Bonus changes in this edition: * The focus frame shows only around the spin-box's line-edit, as it should. This requires getting access to the spin-box's line-edit, which we do by setting a property on the former. Notice that the stepper doesn't get focus. On this point, macOS is inconsistent (partly because there's no such thing as an NSSpinBox, and partly because spin-box buttons are a separate control), so we copy the same focus behavior as NSDatePicker. * We clean some QFocusFrame related dead code in QMacStyle::event(). Change-Id: I204ca2093d9db343c78f0420811dda35c463bbcd Reviewed-by: Jake Petroules <jake.petroules@qt.io>