[Qt-interest] problem in QWidget type cast
Chandru...
sekarwagmare at gmail.com
Tue Aug 11 14:20:01 CEST 2009
thanks and its working ...
On Tue, Aug 11, 2009 at 11:34 AM, Andre Haupt <andre at bitwigglers.org> wrote:
> On Tue, Aug 11, 2009 at 04:37:12PM +0530, Chandru... wrote:
> > hi friends,
> >
> > i got a problem in QList
> > as i subject all my object in a Widget class to a QList by
> >
> > "*QList wlist;
> > wlist = embed->findChildren<QWidget *>()*;"
> >
> > this list have QLabel, QTextEdit, etc ..
> > but all were typecast to QWidget in the QList ..
> >
> > now i want to access a label in wlist.at(2) .. which currently returning
> a
> > QWidget pointer ..
> >
> > where to use qobject_cast?
> > how to call a typical QLabel function ex:setText on the QList item with
> type
> > cast ..
>
> does thus help?
>
> QLabel *label = qobject_cast<QLabel *>(wlist.at(2));
> if (label)
> label->setText("bla");
>
>
> regards,
>
> Andre
>
--
WAGMARE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090811/f194d41b/attachment.html
More information about the Qt-interest-old
mailing list