PDA

View Full Version : setwindowtitle.



sonuani
7th March 2008, 10:53
hi,
I have a qtoolbutton's object which i have typecasted to QWidget.so that i can use it.
I want the text in qtoolbutton to change when a particular condition becomes true.
I tried doing this using Setwindowtext.Its not working.What is the problem in my code.


QToolButton* toolbuttonmsg;
QWidget* msg = toolbuttonmsg;
msg->setWindowTitle("Hi");

ashishsaryar
7th March 2008, 11:23
Do it ..


QToolButton* toolbuttonmsg = new QToolButton();
QWidget* msg = toolbuttonmsg;
msg->setWindowTitle("Hi");
msg->show();

it will work .

sonuani
7th March 2008, 11:30
hi,
I tried that but it doesnt work.The text is not getting updated with the new one

wysota
7th March 2008, 11:55
Try this:

msg->window()->setWindowTitle("xxx");

sonuani
7th March 2008, 12:37
i Tried that too but still no change in the label....sorry in the previous message i had specifiied QToolbutton.Its wrong.Its just a label.

wysota
7th March 2008, 13:01
Label? You want to change the text of a label? Use QLabel::setText() then...