SetText() doesn't work on a QString Variable but works on text in quotes. QT
-
I'm trying to change the text of a QLabel like this:
@movieTitle->setText(Title);@
Title is a QString. But that doesn't work. So I tested it by putting a word in quotes like:
@movieTitle->setText("Batman");@
And that works! I can't even fathom what this issue is. Any ideas? Thanks a million!
-
@
QLabel *m_label = new QLabel("New Label", this);
m_label->setText("very new label");QString text;
text = "super new label";
m_label.setText(text);
@If you have not any error messages. please trace in the debug mode the value of your variable Title
-
Hi,
what's the symptom for not working? Any error message?
QLabel->setText() will work with a QString variable - try setting a new variable and test:
@
QString c = "Batman";
movieTitle->setText(c);
@ -
Initialize Title just before setText like this:
Title="Hello";
movieTitle->setText(Title);is it working now?
review your code and check if "Title" has a Qstring value?