Implement custom data models for spinners
Gunnar Sletta
gunnar at trolltech.com
Fri Feb 22 14:19:08 CET 2008
Helge Fredriksen wrote:
> Hello!
>
> I wonder if somebody can show me an example of how I can implement a
> custom datamodel for a QSpinBox. I have a set of valid numbers that the
> spinner should jump between when it is stepped up and down, and the
> valid number are NOT in a continuous range.
Hi Helge,
QAbstractSpinBox has some virtual methods stepBy and validate which you
should be able to reimplement to get the behaviour you need.
http://doc.trolltech.com/qtjambi-4.3.3_01/com/trolltech/qt/gui/QAbstractSpinBox.html#stepBy(int)
http://doc.trolltech.com/qtjambi-4.3.3_01/com/trolltech/qt/gui/QAbstractSpinBox.html#validate(com.trolltech.qt.gui.QValidator.QValidationData)
-
best regards,
Gunnar
More information about the Qt-jambi-interest
mailing list