[Qt-interest] qreal precision problem
Mihail Naydenov
mlists at ymail.com
Mon Sep 21 15:19:36 CEST 2009
QString::number ( double n, char format = 'g', int precision = 6 ) handles this in general.
May be you can set the display role data for the item to a custom string, made from the number.
(sorry if I talk nonsense, dont have any experience with that )
MihailNaydenov
>
>From: Ankit Agarwal <ankit17.ag at gmail.com>
>To: Qt Interest (E-mail) <qt-interest at trolltech.com>
>Sent: Monday, September 21, 2009 1:14:22 PM
>Subject: [Qt-interest] qreal precision problem
>
>>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?
>
>--
>Regards,
>Ankit Agarwal
>Blog : http://ankit17.wordpress.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090921/b7ca5c75/attachment.html
More information about the Qt-interest-old
mailing list