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. qlabel and qstring color
Qt 6.11 is out! See what's new in the release blog

qlabel and qstring color

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 467 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.
  • S Offline
    S Offline
    s002wjh
    wrote on last edited by
    #1

    how to make this QString::number(0) blue?

    QLabel("test "+QString::number(0),this);

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      By taking a look in the documentation QLabel::setText() which explains exactly what setText() supports when you want to style your text

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      S 1 Reply Last reply
      3
      • Christian EhrlicherC Christian Ehrlicher

        By taking a look in the documentation QLabel::setText() which explains exactly what setText() supports when you want to style your text

        S Offline
        S Offline
        s002wjh
        wrote on last edited by
        #3

        @Christian-Ehrlicher

        i try settext, but how do i make partial QString::number(0) blue. i can only set the entire things blue QLabel("test "+QString::number(0),this); but not the QString::number(0) blue

        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Did you read the link? And if - did you read that QLabel::setText() accepts html?

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          2

          • Login

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