[Qt-interest] qreal precision problem

Andre Somers andre at familiesomers.nl
Mon Sep 21 12:44:46 CEST 2009


Ankit Agarwal wrote:
> Hi,
> I have a QTableWidget. I need to add qreal values to a particular column.
> Sorting is enabled on the table.
> I use setData() for setting the data in the column.
>
> Problem : I need to show only 2 digits after decimal places.
>
> How can I control this?
>
I would create a simple delegate to do this, and set it for use on that 
column. Just subclass QItemDelegate, and reimplement it's paint() and 
sizeHint() methods.

André




More information about the Qt-interest-old mailing list