[PATCH] KDoubleSpinBox and KDoubleValidator
Marc Mutz
Marc.Mutz at uni-bielefeld.de
Wed Jul 10 18:00:32 BST 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi!
Since I've stumbled now for the n'th time over the fact that there's no
spin box for fractional numbers and KDoubleNumInput hasn't got a
spinbox, either, I sat down and wrote one. In the course of that I
found KFloatValidator lacking precision support and implemented
KDoubleValidator, which cleanly inherits from QDoubleValidator more or
less just adds localization support. The KDoubleValidator::validate()
method could've been made more intelligent, but then I'd have to
cut'n'paste much code from KLocale::readNumber(). Let's wait instead
that either QDoubleValidator's decimalSymbol() etc become config'able
in Qt4 (so KDoubleValidator could become a trivial subclass) or that
someone extends KLocale::readNum() to report QValidator::State-like -
well, state.
KDoubleSpinBox could use a bias for when
( maxValue() - minValue ) * 10^precision < INT_MAX - INT_MIN
but
max( abs( maxValue() ), abs( minValue() ) ) * 10^precison > INT_MAX
but that can be implemented when it turns out to be needed.
Please consider adding to knum{input,validator}.{h,cpp}
KFloatValidator should be marked obsolete, since it can't do precision
validation and doesn't understand anything but decimalSymbol() anyway.
Marc
- --
Marc Mutz <mutz at kde.org>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
iD8DBQE9LGg43oWD+L2/6DgRAvSLAJ9iaH9QfuEiFuoaPdP/i1OcEa5ZBACgjauM
Ixj8Aod8i2HX9+f29n5KiR8=
=pTLT
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kdoublespinbox.tar.bz2
Type: application/x-tbz
Size: 4167 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20020710/d39ebf57/attachment.bin>
More information about the kde-core-devel
mailing list