[Qt-interest] Adding widget to QGraphicsView

Yuvaraj R yuvaraj at ongobiz.com
Wed Jul 22 17:02:40 CEST 2009


Thank you very Much..

Because my careless ,i faced bugs..\

I Corrected by

 initializing the object in Constructor..

label = new QLabel;

Thanks

Yuvaraj R
On Wed, Jul 22, 2009 at 8:20 PM, Srdjan Todorovic <
todorovic.s at googlemail.com> wrote:

> Hi,
>
> On 22/07/2009, Yuvaraj R <yuvaraj at ongobiz.com> wrote:
> > I declared the the Qlabel ,QlineEdit as private in Class..
> >
> > if use the label apart from the constrcutor application crashing..
>
> > QLabel *label = new QLabel();
>
> This is local to the constructor?
> Falls out of scope soon...
>
> > void Widget::show_message1()
> >
> > {
> >
> > QMessageBox::information(0,"",QString("yuvaraj"));
> >
> > label->hide();
>
> BANG!
> Class member pointer 'label' is not initialised at this point.
>
> > }
>
> Do you understand the concept of scope?
>
> If yes
> {
>   fix your code
> }
>
> else
>   find and read a good C/C++ book
>
> You did not run a debugger to discover that label is not a valid pointer.
>
> Srdjan
> _______________________________________________
> 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/20090722/a1835c04/attachment.html 


More information about the Qt-interest-old mailing list