[PyQt] Model/view: values of type Decimal not shown
Hans-Peter Jansen
hpj at urpla.net
Fri Jul 27 13:33:51 BST 2012
Am Thursday 26 July 2012 20:24:13 schrieb Sibylle Koczian:
> Hello,
>
> I don't know how to get numeric data from my model to my GUI, if they
> aren't floats but decimal.Decimal. In the following example the last
> column of the view and the last QLineEdit of the form both stay
> empty. The model data are printed to the console and it can be seen
> that the model contains the correct data for the last column and that
> they have the right type. But the GUI doesn't show them. What should
> I change?
You need to supply a QStyledItemDelegate to handle decimals. It might be
feasible to wrap QDoubleSpinBox as editor widget and access the value
with cleanText...
I contributed the star delegate demo to demonstrate the delegation
facility.
Hth,
Pete
More information about the PyQt
mailing list