[Qt-interest] Issue with QDataWidgetMapper & QCheckBox
Timothy Reaves
treaves at silverfieldstech.com
Sun Dec 13 23:51:09 CET 2009
On Dec 13, 2009, at 4:45 PM, Lorenzo Masini wrote:
> Il giorno dom, 13/12/2009 alle 16.34 -0500, Timothy Reaves ha scritto:
>> 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?
>
> Why aren't you using the "checked" property?
>
> cheers
> Lorenzo
>
I am setting the mapping thus:
telescopeMapper->addMapping(ui->telescopeVFlip, 4, "checked");
telescopeMapper->addMapping(ui->telescopeHFlip, 5, "checked");
Is that not correct?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091213/03b42432/attachment.html
More information about the Qt-interest-old
mailing list