[Qt-interest] Overriding QSqlRelationalTableModel behaviour concerning NULL values

bar tomas bartomas at gmail.com
Thu Apr 8 17:37:14 CEST 2010


Hi,

No I haven't found a solution to this problem-will let you know if I do.
>From what I've read in the forums, the recommended practice is to
create null records in lookup tables referenced by foreign keys (with
id=0 and empty string as descriptive field) but I find this quite
unsatisfactory.
Am thinking of giving up on QSqlRelationalTableModel and using
something else; the inability to handle NULL values is too severe a
limitation.
Best wishes


On Thu, Apr 8, 2010 at 8:23 AM, Stéphane <stephane at hacout.com> wrote:
> Hi,
>
> Did you find a solution ? Have you got a private answert ? If yes could you
> give it to me please ? Because I am also concerned by this point and I'm
> disapointed that Qt doesn't give us an easy way to do this. It seem to me
> (but I am not a Qt expert) that we need to redefine the class and write the
> SQL command creation function as we need to be abble to get all records we
> want, but I find that a bit complicated to get the result, isn't it ?
>
> Best regards
> Stéphane
>
>> Hi,
>>
>> The default behaviour of QSqlRelationalTableModel is to not  show
>> records that have a NULL foreign key value.
>> This is due apparently to QSqlRelationalTableModel performing an inner
>> join instead of a left join.
>> Do you know what method I would need to override to change this
>> behaviour? Has anyone done this and have a code example of how this
>> can be done?
>>
>> Many thanks.
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>>
>
>




More information about the Qt-interest-old mailing list