Label display issue
I would like to display the text as below in qlabel in my gui:
what i get now is only 1 line output, the latest output will keep replace the old one.
how can i get it the new info will pop out in the new line?
try appending old ones with new line using
You need to change textFormat to RichText and activate wordWrap. And you have to make sure the label has actually a size able to show more than one line. Then you can add rich text with new lines.
Thanks for the ans.
But i want display different text in the label.
Is the only way i can do is use different label?
Like i want to update new information into the label in next line and keep the old info (instead of replace now), can i do it?
@ChrisCl Wouldn't QListView be better for your requirements?
Sorry, i'm new to qt.
Actually i want to display the console info on my gui, that's why i'm asking this question.
I did follow the step show on the post but it only display one time info to me.
For example message->setText("\n123=" + QString::number(8.2f) + "Mfz\n");
it will only one time of this message.
But how if i want looping this message and display it 100times and 100 lines on my label, how to do it?
You can do it like I described above.
But you should think whether you're using the right widget?
You could use QListView or QPlainTextEdit depending on your requirements. QLabel is usually used for simple labels, not multi line text.
What do you mean by "console info"?
I manage to solve the problem already, by using TextEdit with cursor.
use for loop to display multiple text with single qlabel