PDA

View Full Version : dynamic text?



vonCZ
20th June 2007, 11:19
I have the following code in my constructor:


xRotLabel = new QLabel(this); // "QLabel *xRotLabel;" is in .h file
xRotLabel->setText("Initial Text");
connect(mb0pButton, SIGNAL(buttonClicked()), this, SLOT(changeText()));
here's the changeText() function:

void Window::changeText()
{
xRotLabel->setText("Changed Text");
}


I want to click the "mb0pButton" to make the text in the QLabel change, but it's not working. What am I missing?

jpn
20th June 2007, 11:39
connect(mb0pButton, SIGNAL(buttonClicked()), this, SLOT(changeText()));


Check the signal. Should it be QAbstractButton::clicked()? "buttonClicked" is a signal of QButtonGroup (which isn't parameterless either, btw).

vonCZ
20th June 2007, 11:41
right you are. Thanks.