Qt-interest Archive, February 2007
QDataWidgetMapper problem
Message 1 in thread
Hi,
I have a QDataWidgetMapper connected to a QLineEdit. When entering text
into the line edit manually, the data is passed to the model. But when
programmatically setting it using QLineEdit::setText, the mapper does
nothing, and the set string is lost. I tried to call
QDataWidgetMapper::submit after setText, but that just crashed the
application.
Any idea how I can make that work? I'd prefer not to directly call the
model's setData method because I want to learn how to effectively use
QDataWidgetMapper.
Thanks.
M
--
[ signature omitted ]
Message 2 in thread
Martin wrote:
> Hi,
>
> I have a QDataWidgetMapper connected to a QLineEdit. When entering text
> into the line edit manually, the data is passed to the model. But when
> programmatically setting it using QLineEdit::setText, the mapper does
> nothing, and the set string is lost. I tried to call
> QDataWidgetMapper::submit after setText, but that just crashed the
> application.
>
> Any idea how I can make that work? I'd prefer not to directly call the
> model's setData method because I want to learn how to effectively use
> QDataWidgetMapper.
>
> Thanks.
> M
No data widget mapper experts out there?
--
[ signature omitted ]
Message 3 in thread
Martin wrote:
> Martin wrote:
>
>> Hi,
>>
>> I have a QDataWidgetMapper connected to a QLineEdit. When entering text
>> into the line edit manually, the data is passed to the model. But when
>> programmatically setting it using QLineEdit::setText, the mapper does
>> nothing, and the set string is lost. I tried to call
>> QDataWidgetMapper::submit after setText, but that just crashed the
>> application.
>>
>> Any idea how I can make that work? I'd prefer not to directly call the
>> model's setData method because I want to learn how to effectively use
>> QDataWidgetMapper.
>>
>>
Submit both of these issues to support at trolletch as it might be a
bug. It defiantly should not crash.
However, I can see a benefit to not having setText submit the data.
This would be the case when you want to load the form with some "default
data" that the user may or may not want to change before the submit.
Like importing the billing address for the shipping address. Also, you
might want to think of if you really want to use live edit or manual
submit. For most form based editing (think databases) its easier and
more efficient and easier for the user to use manual submit. It makes
perfect sense given there is usually a cancel button on the dialog.
--Justin
begin:vcard
begin:vcard
fn:Justin Noel
n:Noel;Justin
org:ICS;Engineering
adr:;;54B Middlesex Trpk;Bedford;MA;01730;USA
email;internet:justin@xxxxxxx
title:Sr. Consulting Engineer / Certified Qt Instructor
tel;work:(617) 621-0060
url:http://www.ics.com
version:2.1
end:vcard