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. Not able to set color and variable to Qt SetText (Solved)
QtWS25 Last Chance

Not able to set color and variable to Qt SetText (Solved)

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 901 Views
  • 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.
  • H Offline
    H Offline
    houmingc
    wrote on last edited by
    #1

    I could
    ui->label->setText(StationList[1]);
    but i could not set color and variable to Qt SetText.
    Not able to do it for many hours.

                QColor color = cyan;
                QString Text;
                QString fonttemplate = tr("<font color='%1'> %2</font>");
    
                //ui->labelCurrentStation->setText("<font color='cyan'> Talad  </font>");
                ui->labelCurrentStation->setText(fonttemplate.arg(cyan,Text));
    
    1 Reply Last reply
    0
    • H Offline
      H Offline
      houmingc
      wrote on last edited by
      #2

      found the answer.

      ui->label->setText(QString("<font color='cyan'> %1</font>").arg(StationList[2]));

      It work

      1 Reply Last reply
      0
      • A Offline
        A Offline
        aliks-os
        wrote on last edited by
        #3

        Please mark in the title of the post [SOLVED]

        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