In GroupBox I've placed few QLabels. Now - depending on which of this labels I click - I want to change background colour of one of those QLabel.
I've tried
Qt Code:
  1. QPalette palette = label->palette();
  2. if (somethink)
  3. palette.setColor(label->backgroundRole(),QColor(Qt::blue));
  4. else
  5. palette.setColor(label->backgroundRole(),QPalette::Window);
  6. label->setText(someText);
  7. label->setPalette(palette);
  8. label->setAutoFillBackground(true);
  9. label->update();
To copy to clipboard, switch view to plain text mode 

In the result - if i click on QLabel which should change background of others - no effect. When label->setAutoFillBackground(true); is set - widget turns him self into black block. When i click on widgets which should change background - then they are changing it to a proper one.

Then I've tried Style sheets. In places where I was changing palette - now I've placed
Qt Code:
  1. label->setStyleSheet("QLabel { background-color: blue }");
To copy to clipboard, switch view to plain text mode 
and where I reset
Qt Code:
  1. label->setStyleSheet("");
To copy to clipboard, switch view to plain text mode 

No difference.
PS. I'm coding under Windows XP. My application is using different styles like QPlastique, QWindows, QMotif - under each of them I see no effect from above code.