Hello!

My program has a mainwindow with a number of toolbars. I want to add a toolbar that contains a QLabel displaying some text and would like the text to be, let's say, red.

What i'm doing:
Qt Code:
  1. MyWindow::MyWindow()
  2. {
  3. QToolBar* tb = new QToolBar(this);
  4.  
  5. QLabel* label = new QLabel;
  6. QPalette palette = label->palette();
  7. palette.setColor(QPalette::WindowText, QColor("#FF0000"));
  8. label->setPalette(palette);
  9. label->setText("wo0t");
  10.  
  11. tb->addWidget(label);
  12. this->addToolBar(QT::TopToolBarArea, tb);
  13. }
To copy to clipboard, switch view to plain text mode 

What i'm expecting: the toolbar text to be red.
What i'm getting: the toolbar text is not changing, at all.

Any thoughts? What am I doing wrong? Should I maybe set the text and the palette after construction has finished?