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. SetPalette() for QLCDnumber
Qt 6.11 is out! See what's new in the release blog

SetPalette() for QLCDnumber

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 1.7k 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.
  • F Offline
    F Offline
    Faruq
    wrote on last edited by
    #1

    Hi everyone, I tried to change the font color of the QLCDnumber into some certain color such as red and dark yellow. (Such as the code below)

        ui->TestQLCD->setSegmentStyle(QLCDNumber::Filled);
        ui->TestQLCD->setPalette(Qt::darkYellow);
    

    I understand that setPalette(Qt:: LALALA) where LALALA is a fixed range of color.
    However, I would like to change to certain other colour such as Orange or Brown. Do I have to manipulate QBrush or QColor to achieve this?

    F 1 Reply Last reply
    0
    • F Faruq

      Hi everyone, I tried to change the font color of the QLCDnumber into some certain color such as red and dark yellow. (Such as the code below)

          ui->TestQLCD->setSegmentStyle(QLCDNumber::Filled);
          ui->TestQLCD->setPalette(Qt::darkYellow);
      

      I understand that setPalette(Qt:: LALALA) where LALALA is a fixed range of color.
      However, I would like to change to certain other colour such as Orange or Brown. Do I have to manipulate QBrush or QColor to achieve this?

      F Offline
      F Offline
      Faruq
      wrote on last edited by Faruq
      #2

      @Faruq

      Hi everyone, I have solved it. So instead of my 1st post entry. I decided to use QColor to replace the Qt::LALALA where LALALA is the certain fixed range of colors as shown in the documentation.

         ui->TestQLCD->setSegmentStyle(QLCDNumber::Filled)
         ui->TestQLCD->setPalette(QColor(255,165,0,255));
      

      Do take note that the transparency is at the last digit ( 0 = full transparentcy while 255 is the full opaque)

      Whatever it is i encountered a puzzled response when i input
      ui->TestQLCD->setSegmentStyle(QLCDNumber::Filled);
      QColor c1=(255,165,0,255);
      ui->TestQLCD->setPalette(c1);

      It became blue/Dark blue no matter what number I tried. Puzzling but worth for others to know. Hope It is useful to the new sheeps like myself. :)

      1 Reply Last reply
      1

      • Login

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