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. Getting background color of a frame value in a Label

Getting background color of a frame value in a Label

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 669 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.
  • K Offline
    K Offline
    Kayagni
    wrote on last edited by
    #1

    I am trying to get the red value of the background color of a frame, to put it into a label.
    This color value has been set by a QColorDialog, and applied with QPalette.
    There is no value in my label... What am I doing wrong?

    Here's the code

    void PatternEditor::on_boutonCouleurInit_clicked()
    {
    QColor couleur = QColorDialog::getColor(Qt::white, this); //sets couleur with QColorDialog

    QPalette palette; 
    palette.setColor(QPalette::Background, couleur); //sets background color
    ui->initColorWidget->setAutoFillBackground(true); 
    ui->initColorWidget->setPalette(palette); //apply color to the background's frame
    ui->codeCouleurInitLabel->setText(QChar(couleur.red())); //(should) set text of my label with the red color value of couleur
    

    }

    1 Reply Last reply
    0
    • K Offline
      K Offline
      Kayagni
      wrote on last edited by
      #2

      Fixed... In fact, it was just a matter of QChar translation...

      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