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
    @ui->MyLabel->setText("First");@

    but I also want the following message to show in the second line (after the above)
    @ui->MyLabel->setText("Second");@

    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?
    thanks



  • 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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.