[Qt-interest] Adding widget to QGraphicsView
Srdjan Todorovic
todorovic.s at googlemail.com
Wed Jul 22 16:50:49 CEST 2009
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
More information about the Qt-interest-old
mailing list