Go to file
Ivan Solovev b4bb3a5415 Introduce QDoubleValidator::setRange overload with two parameters
The QDoubleValidator::setRange() used to have 3 parameters, with
the third one (the number of decimals) having a default value of 0.
Such default value does not make much sense for a *double* validator.
Also, since a default value was used, omitting the decimals was
silently overwriting the previous decimals value, discarding the
value that could be previously explicitly specified by user.

[ChangeLog][QtCore][QDoubleValidator][Important Behavior Changes] The
QDoubleValidator::setRange() method now has two overloads.
The first overload takes 3 parameters, but does not support a
default value for decimals.
The second overload takes only two parameters, not changing the
number of decimals at all.
Hence, the number of decimals will only be changed if the user
explicitly specifies it.
To maintain the old behavior of setRange(), pass 0 as the 3rd
argument explicitly.

Note that it is a source-incompatible change. But it should be fine,
because using QDoubleValidator with 0 digits after decimal point does
not make much sense and so, hopefully, is not that common.

At the same time, change the default-constructed QDoubleValidator
to use -1 for decimals, which allows arbitrarily many digits in
the fractional part. The value was previously 1000, which allowed
more than anyone would reasonably use, so this should make no
practical difference.

Some more unit tests to cover the behavior of the setRange()
overloads are also added.

As a dirve-by: remove unnecessary QValidator::State to int conversions
in the unit tests. QCOMPARE is capable of comparing these enums and
provides a better output in case of failure for enums.

Task-number: QTBUG-90719
Change-Id: I523d6086231912e4c07555a89cacd45854136978
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2021-09-20 09:39:13 +02:00
.github/workflows Github Actions: many minor updates 2021-01-22 18:48:54 +01:00
bin Add missing -help argument to qt-configure-module 2021-08-20 19:44:43 +02:00
cmake Remove unused EXE_FLAGS option from qt_internal_add_executable() 2021-09-18 01:54:08 +10:00
coin Revert "coin: Generate JUnit result files" 2021-09-16 17:02:44 +00:00
config.tests Fix the precompile_header configure test 2021-06-19 01:08:23 +02:00
dist Add Qt 6.0.0 changes file 2020-11-16 10:02:08 +02:00
doc Doc: Centralize RFC documentation-links in rfc.qdoc 2021-09-16 15:52:27 +02:00
examples Doc: Centralize RFC documentation-links in rfc.qdoc 2021-09-16 15:52:27 +02:00
lib
libexec Teach syncqt to filter out QT_DEPRECATED_* macros 2021-09-07 08:28:09 +02:00
mkspecs Remove conditioning on Android embedded 2021-09-17 17:30:14 +02:00
qmake Doc: Fix broken links 2021-09-17 13:01:46 +00:00
src Introduce QDoubleValidator::setRange overload with two parameters 2021-09-20 09:39:13 +02:00
tests Introduce QDoubleValidator::setRange overload with two parameters 2021-09-20 09:39:13 +02:00
util Remove conditioning on Android embedded 2021-09-17 17:30:14 +02:00
.cmake.conf Bump version 2021-09-14 13:19:55 +03:00
.gitattributes Give batch files CRLF line endings 2020-11-04 15:02:29 +00:00
.gitignore testlib: Accurately name JUnit test, and only run for JUnitXML reporter 2021-07-29 15:39:40 +02:00
.lgtm.yml Skip LGTM analysis for the bootstrap library and tools 2020-07-16 01:04:34 +02:00
.qmake.conf Bump version 2021-09-14 13:19:55 +03:00
.tag
CMakeLists.txt CMake: Enforce minimum CMake version in user projects 2021-08-04 16:03:08 +02:00
conanfile.py Conan: Rename 'extra_cmake_args' Conan option as 'cmake_args_qtbase' 2021-08-30 05:51:36 +00:00
config_help.txt Remove dysfunctional -coverage configure argument 2021-08-10 12:00:13 +02:00
configure Remove unsupported, host-related options from configure shell script 2021-08-05 02:44:27 +02:00
configure.bat Fix our usage of CMake script mode in Windows configure 2021-08-20 19:44:43 +02:00
configure.cmake Add Qt PrintSupport to the configure summary 2021-09-03 21:35:06 +02:00
dependencies.yaml
LICENSE.FDL
LICENSE.GPL2
LICENSE.GPL3
LICENSE.GPL3-EXCEPT
LICENSE.LGPL3
LICENSE.LGPLv3
LICENSE.QT-LICENSE-AGREEMENT
qt_cmdline.cmake Remove dysfunctional -coverage configure argument 2021-08-10 12:00:13 +02:00
sync.profile Implement generating of a module cpp export header 2021-06-24 20:40:49 +02:00