PDA

View Full Version : Displaying QSqlRecords on QTableWidget (double precision problems)...



antoniomenezes
18th May 2010, 17:28
Hello All,

I'm sorry if this is such a novice problem, but I'm having really trouble wiht it.

My application executes database operations by using a separated thread, instead using the main thread. I read several comments about sharing data to different threads, so I decided to use a signal-slot mechanism to transfer a QList<QSqlRecord> from one thread to other.

When the other thread receives the record list, it stores the records (variant values) into a QTableWidget. The problem is that QTableWidget is not displaying the correct precision of doubles.

I have a previous application where I don't use threads, so I just set a QSqlQueryModel to a QTableView and all numeric values are correctly displayed.

Is there any simple solution to this problem?

Regards,
Antonio Menezes.

antoniomenezes
19th May 2010, 05:24
Hello!

Just to say I found a solution. I've used the setNumericalPrecisionPolicy method of QSqlDatabase. I guess in Qt 4.6.2 the default is not QSql::HighPrecision.

Reference: http://comments.gmane.org/gmane.comp.lib.qt.general/30819

Regards,
Antonio Menezes.