Different KDoubleSpinBox
Thomas Friedrichsmeier
thomas.friedrichsmeier at ruhr-uni-bochum.de
Wed Apr 4 22:43:41 BST 2007
Hi,
recent discussion about KDoubleNumInput reminded me of this:
In RKWard, we have a home-grown spinbox for double numbers. The key difference
to KDoubleSpinBox (which uses a fraction of two integers, one of which is
fixed, internally) is that it can use the whole range of doubles:
http://rkward.svn.sourceforge.net/viewvc/rkward/trunk/rkward/rkward/misc/rkspinbox.cpp?view=log
For the curious:
- The integer value of QSpinBox is not proportional to the double value in any
way, in this approach. The only use of the int value is to detect, if / by
how many steps the value was changed. The logic is something like:
1) set the (internal integer) value to 0
2) whenever the internal value has changed, change the real (double) value by
that many steps
3) goto 1
- The step size grows logarithmically with the current value. That is, a
single step will always affect the n-th most significant digit (where n is
configurable), making it possible to actually scroll through large ranges of
numbers.
Well, this code is still Qt3, and contains some RKWard specifics. It also
provides an integer spinbox with logarithmic step sizes in the same class,
which may not be a good idea, after all. So it would need to be adjusted
quite a bit for KDE. However, before I even start on this:
1) Do you see a real use for this, somewhere inside kdelibs, at all?
2) Since it behaves slightly different from KDoubleSpinBox, it should probably
be a new class. What name should be used?
3) If this was to be included in KDE 4.0, when would it have to be finished?
4) Would somebody help me getting the API straight?
Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070404/03e5eb42/attachment.sig>
More information about the kde-core-devel
mailing list