Important: Please read the Qt Code of Conduct -

How to have multiple strings in one label

  • okay, so I am trying to output several strings in one Label which I created
    but each time the first string is being replaced by the second string

    for example, I have a label called MyLabel and I want the following string to show in the label

    but I also want the following message to show in the second line (after the above)

    but when I run it, the "First" is gone and only "Second" is displayed

    is it possible to keep adding strings to one label instead of creating a new label for each one?

  • How about this?
    @setText(ui->MyLabel->text() + "\nNew String in a second line");@

    I guess there is a very, very simple way. ;)

Log in to reply