Trolltech Home | Qt-embedded-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-embedded-interest Archive, November 2006
Dynamically changing the text of lable


Message 1 in thread

Hi Freinds,
Using designer i created a widget and in that i created a lable.NAME as text
and with name as NAME_LBL.
It is there in ABC.h (which is created by ABC.ui)
In ABC class it is there as
QLabel*  NAME_LBL;
And in ABC.cpp it is implemented as

NAME_LBL = new QLabel( this, "NAME_LBL" );
NAME_LBL->setText( tr( "NAME" ) );

I then inherited the ABC class in my implementation file as
class XYZ:public ABC

So now in this implementation file
In one of the function i wanted to change the name of the Lable to WXY.
I tryed as

XYZ mppt     //Class object declaration in global

 mppt .NAME_LBL->setText( "WXY" );

But when i compile this it is not compiling and it is giving as forward
declaration error.....

But this is the usual C++ approach no? Acceesing using class object.

Am i doing any thing wrong?
I wanted to change the lables dynamically in run time .that is the reason i
am trying this basic one.
Kindly suggest me if i am doing anything wrong.

Thanks in advance

Regards,
Harsha

Message 2 in thread

Try adding #include <QLabel> to get rid of the forward declaration
error.
Of course, this is just a guess because you didn't send the actual error
text.
 
Cheers
Ben


________________________________

	From: harshavardhanreddy mandeepala
[mailto:hvreddy1110@xxxxxxxxx] 
	Sent: Monday, November 20, 2006 10:46 AM
	To: qtopia-interest
	Cc: qt-embedded-interest@xxxxxxxxxxxxx
	Subject: Dynamically changing the text of lable
	
	
	Hi Freinds,
	Using designer i created a widget and in that i created a
lable.NAME as text and with name as NAME_LBL.
	It is there in ABC.h (which is created by ABC.ui)       
	In ABC class it is there as 
	QLabel*  NAME_LBL; 
	And in ABC.cpp it is implemented as
	
	NAME_LBL = new QLabel( this, "NAME_LBL" );  
	NAME_LBL->setText( tr( "NAME" ) );
	
	I then inherited the ABC class in my implementation file as
	class XYZ:public ABC
	
	So now in this implementation file
	In one of the function i wanted to change the name of the Lable
to WXY.
	I tryed as 
	
	XYZ mppt     //Class object declaration in global 
	
	 mppt .NAME_LBL->setText( "WXY" ); 
	
	But when i compile this it is not compiling and it is giving as
forward declaration error.....
	
	But this is the usual C++ approach no? Acceesing using class
object.
	
	Am i doing any thing wrong?
	I wanted to change the lables dynamically in run time .that is
the reason i am trying this basic one. 
	Kindly suggest me if i am doing anything wrong.
	
	Thanks in advance
	
	Regards,
	Harsha