[Qt-interest] Assiging the SQl database table values for Label and listwidget items

Israel Brewster israel at frontierflying.com
Fri Jul 17 18:32:40 CEST 2009


On Jul 16, 2009, at 10:38 PM, Yuvaraj R wrote:

> Thanks
>
>     How do set for QLabel.
>
>
> Thanks
>
> Yuvaraj R

If you are just asking how to set the text of a QLabel, then that is  
done with the setText(QString) function of the QLabel ( http://doc.trolltech.com/4.5/qlabel.html#text-prop 
  ). That has nothing to do with a SQL database however. But perhaps  
you were actually asking how to set the text of a QLabel based on a  
value stored in a SQL database? If so, you should probably look at the  
Qt SQL documentation for how to pull data from SQL databases ( http://doc.trolltech.com/qtsql.html 
  ). QSqlQuery may do the trick for you, if setting a QLabel is all  
you need. On the other hand, if you are trying to populate a  
listwidget (as your initial message implied) then I would have to  
agree with Charles Yin that a QListView and one of the SQL Model  
classes is the way to go - again, see the above referenced  
documentation.
-----------------------------------------------
Israel Brewster
Computer Support Technician II
Frontier Flying Service Inc.
5245 Airport Industrial Rd
Fairbanks, AK 99709
(907) 450-7250 x293
-----------------------------------------------

>
> On Fri, Jul 17, 2009 at 11:49 AM, Charles Yin <yinyunqiao at gmail.com>  
> wrote:
> QListWidget uses internal model to manage the data. So you should  
> probably use QListView instead and call the setModel() method for  
> your customized database model class. Although the QListWidget  
> inherits from QListView, it's not the best way to do MV programming.
>
> Charles Yin
>
> On Fri, Jul 17, 2009 at 2:54 PM, Yuvaraj R <yuvaraj at ongobiz.com>  
> wrote:
> Hi All
>
>  How do assign the QSql database Table values for label listwidget..
>
> Any Idea. Always  welcome
>
>
> Thanks
>
> Yuvaraj R
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090717/a01026cd/attachment.html 
-------------- 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/20090717/a01026cd/attachment.bin 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090717/a01026cd/attachment-0001.html 


More information about the Qt-interest-old mailing list