[Qt-interest] How can I persist all itens from QTableWidget in the data base ?
Israel Brewster
israel at frontierflying.com
Thu Aug 13 18:31:40 CEST 2009
On Aug 12, 2009, at 4:17 PM, Mhayk Whandson wrote:
> Hi all,
>
> I would like to know how can I save all itens from QTableWidget in the
> data base ? I am using postgreSQL, if you have some example this will
> help me a lot. I am saving the product name and product price in the
> QTableWidget and I would like get all this products added and persist
> in the PostgreSQL. I was readind the QTableWidget documentation and I
> just found the function:
>
> QModelIndex QTableWidget::indexFromItem ( QTableWidgetItem * item )
> const [protected]
>
> but the function above returns the QModelIndex assocated with the
> given item so, this don't help me. Are you have any idea to solve this
> problem ?
Don't use QTableWidget. Use a QTableModel with a QTableView. This is
exactly what they are designed for. See the documentation for the
QtSql module - < http://doc.trolltech.com/4.5/qtsql.html >
-----------------------------------------------
Israel Brewster
Computer Support Technician II
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------
>
> --
> Mhayk Whandson
> Linux User #413723
> E-mail: eu at mhayk.com.br
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Israel Brewster.vcf
Type: text/directory
Size: 397 bytes
Desc: not available
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090813/6fbad1e2/attachment.bin
More information about the Qt-interest-old
mailing list