[Qt-interest] How can I manage a model how insert, delete data in lines and columns

Israel Brewster israel at frontierflying.com
Wed Sep 9 17:57:17 CEST 2009


On Sep 8, 2009, at 10:53 AM, wim.delvaux at adaptiveplanet.com wrote:

> On Tuesday 08 September 2009 20:13:31 Mhayk Whandson wrote:
>> Hi all,
>>
>> How can I create,delete and modify information from the model which
>> after I will save in the database ? Exist any class that can help me
>> with these operations ? Could you show me an axample ? I would like  
>> to
>> insert several informations in the model how product name, price and
>> manufacturer.
>>
>> best regards,
>
> well depends on the complexity of your database
> 1. QSqlQueryModel : READONLY, any SQL query
>
> 2. QSqlTableModel : Only table, no relations with other tables
>
> 3. QSqlRelationtalTableModel : table with relations but does not  
> work at least
> not in 4.5.1.

Actually, QSqlRelationalTableModel works just fine, even in 4.5.1 -  
aside from a bug (which I reported and was fixed in the source tree,  
or so they claim) which causes problems when you save a record  
containing NULL values. I'm using all three of these in a couple of my  
programs. But yeah - these are the clasess you need, specifically  
(judging from the original post) QSqlTableModel, coupled with a  
QSqlTableView. See http://doc.trolltech.com/qtsql.html for more  
information on how to use all of these classes.

>
> Solution ? write your own ...
>
> CU
> W
>
> _______________________________________________
> 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/20090909/d4ec6ad7/attachment.bin 
-------------- next part --------------




More information about the Qt-interest-old mailing list