Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to have multiple strings in one label

How to have multiple strings in one label

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 960 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Cody_52
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • T Offline
      T Offline
      thEClaw
      wrote on last edited by
      #2

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

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

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved