Hello

I have a very simple problem with the setStyleSheet() function. I need to apply a simple style to a label.
If I make my form only with code (without using Qt Designer) I can't apply my style. An example:

Qt Code:
  1. Form::Form(QWidget *parent) : QWidget(parent) {
  2. this->myLabel = new QLabel(this);
  3. this->myLabel->move(0,0);
  4. this->myLabel->resize(300, 100);
  5. this->setStyleSheet("#myLabel{background-color: rgb(0, 0, 255);}");
  6. }
To copy to clipboard, switch view to plain text mode 

It doesn't work, but if I make my form with Qt Designer it works:

Qt Code:
  1. Form::Form(QWidget *parent) : QWidget(parent), ui(new Ui::ClientFrame) {
  2. ui->setupUi(this);
  3. this->setStyleSheet("#label {background-color: rgb(0, 0, 255);}");
  4. }
To copy to clipboard, switch view to plain text mode 

Someone can help me to fix the first code please??

Thanks!!