[PyKDE] [PyQt3] QSpinWidget derived widgets
Hans-Peter Jansen
hpj at urpla.net
Wed Oct 25 16:59:05 BST 2006
Hi Phil et.al.,
attached is an example, what can be done within PyQt, if QSpinWidget is made
available. I know, your policy is: don't wrap internal Qt classes, but this
one may deserve an exception for these reasons:
- the risk, that Trolltech will change these interfaces in Qt3 is next to
zero
- the cost for you is minimal, given that you assimilate my qspinwidget.sip
(well, since QSpinWidget is defined in qrangecontrol.h, it would
perfectly fit into sip/qt/qrangecontrol.sip IMHO)
The only caveat in this area is, that I may not gotten the versioning
right.. It's just <%If (Qt_3_0_0 -) .. %End> ATM..
- It's not possible to fully explore Pythons advantages within e.g. custom
QSpinBox derived widgets since its unfortunate integer range limitation.
The archive contains an type agnostic rangecontrol.py module, a int based
SpinBox implementation with slightly advanced interfaces and functionality:
up to 5 values can be given to the constructor:
SpinBox(minValue, maxValue, lineStep, pageStep, value)
The "page" stepping (Page Up/Page Down) is missing and the value must be
given with setValue() originally.
Additionally, a DecimalSpinBox widget is provided, which makes Decimals
available without any artificial limitations, where the number of decimals
given as value parameter typically specifies them, but could also be given
as 'decimals' keyword argument, similar to 'decimalpoint' and 'separator'
arguments.
For those, who want to play with it, run the build.sh in qspinwidget to
build the wrapper, and then 'python spinbox.py'. Let us know, if you like
it, plan to use it, enhance it or what ever you think about it.
Enjoy,
Pete
-------------- next part --------------
A non-text attachment was scrubbed...
Name: spinbox.tar.bz2
Type: application/x-tbz
Size: 7421 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20061025/3d1a3922/spinbox.tar.bin
More information about the PyQt
mailing list