Adding a text to the QTabWidget in c++
-
wrote on 15 Apr 2013, 09:02 last edited by
I have class which inherits QTabWidget. Inside the generated tab I want to display some text.The text should not be editable by the user.But during the application execution there can be a case/s which will cause the text change. Which class should I use for text? Thought about QTextEdit - but it doesn`t look like best idea - since the user should not change the text.Also thought about QTextLabel - but it also is not good - since the application displays text not label.
-
wrote on 15 Apr 2013, 09:07 last edited by
Why don't you just use QLabel?
-
wrote on 15 Apr 2013, 09:15 last edited by
You use QLabel and when you want to change the text you emit a signal, connect that signal to QLabel's setText slot and that should do it
-
wrote on 15 Apr 2013, 09:15 last edited by
Is QLabel is designed to update text dynamically?I am looking for the best option for displayed above functionality
-
wrote on 15 Apr 2013, 09:19 last edited by
Please be more specific about dynamically
-
wrote on 15 Apr 2013, 09:30 last edited by
The user can change modes or insert some input data for application,so the application execution changes:some values application calculates changes,some computation modes changes .
These changes happen during the application execution and I may want to update the above data every several seconds.In the text (I am asking about) I want to report to the user about every such change -
wrote on 15 Apr 2013, 09:47 last edited by
Well, whenever you want to update the data just emit the signal with the text you want... For example, let's say you have a signal updateStatus(QString). The user inputs something and you want to tell him "Hey, you just did something". (This is all assumed to be in your QTabWidget subclass)
@
1st. connect(this, SIGNAL(updateStatus(QString)), tabLabel, SLOT(setText(QString)));2nd. emit updateStatus("Hey, you just did something");
@This should change your labels text yo Hey, you just did something.
1/7