[Qt-interest] Issue with QDataWidgetMapper & QCheckBox

Israel Brewster israel at frontierflying.com
Mon Dec 14 18:40:10 CET 2009


On Dec 13, 2009, at 12:34 PM, Timothy Reaves wrote:

> 	I have a a QDataWidgetMapper set up for a form.  There are two  
> QCheckBoxes on this form.  The values display the checked state  
> properly, but changes are not saved.  When I call submit() on the  
> mapper, it fails with this error:
> QSqlError(20, "Unable to fetch row", "datatype mismatch")
>
> 	The two columns are defined as BOOLEAN in a SQLite database. When I  
> listen to the table model beforeUpdate, the fields are being passed  
> as QString "true" or "false".  What is the correct way to convert  
> them to BOOLEAN?

I want to say the last time I attempted this, I ended up setting the  
boolean column manually rather than using the mapper for the  
checkboxes. It's been a while though, so I may not be remembering  
correctly, or things may have changed in Qt. Note also that while this  
should be a functional workaround, it may not necessarily be the best  
option, and I would think in principle at least that using the mapper  
should work.

>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest

-----------------------------------------------
Israel Brewster
Computer Support Technician II
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Israel Brewster.vcf
Type: text/directory
Size: 417 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091214/96ad4f9d/attachment.bin 
-------------- next part --------------




More information about the Qt-interest-old mailing list