PDA

View Full Version : Changing labeltext from a class?



Kokos
5th February 2010, 00:33
Hello, I just started with QT, and trying to change labeltexts from a class.

In the main function I have this;


Linc lc; //window classthingy
lc.show()
Cly cl; //My classthingy
cl.init()

in Cly::init() i have this;


{
Linc lin;
lin.gui.label->setText("Blabla");
}

Which dont work, but if I take this;


lc.gui.label->setText("Blabla");

Into the main function,instead of Cly cl; cl.init() then it works!
Anyone got any solutions to this matter?

Im not sure if this is the right thread, it says 'Newbie' so I figured why not;p

qlarity_three
5th February 2010, 00:54
{
Linc lin;
lin.gui.label->setText("Blabla");
} //since lin is a local variable it is destroyed at this point. Maybe that has something to do with the problem your having.

Kokos
5th February 2010, 01:16
{
Linc lin;
lin.gui.label->setText("Blabla");
} //since lin is a local variable it is destroyed at this point. Maybe that has something to do with the problem your having.

ooh blarhg, thanks, figured it out now;>