title: How to stylize custom classes in Qt using external style sheets?
body: <p>I have the following codes for my application-</p>
  
  <p>file headerArea.cpp</p>
  
  <pre><code>void MainWindow::createDocks(){
      //TOP DOCK OR TITLEBAR
      titleBar = new headerArea();
      addDockWidget(Qt::TopDockWidgetArea,titleBar);
  }
  
  void headerArea::paintEvent (QPaintEvent *){
      QStyleOption opt;
      opt.init (this);
      QPainter p (this);
      style ()-&gt;drawPrimitive (QStyle::PE_Widget, &amp;opt, &amp;p, this);
  }
  </code></pre>
  
  <p>and in my style sheet-</p>
  
  <pre><code>headerArea#titleBar{
      background: #ccc;
  }
  </code></pre>
  
  <p>The style sheet doesn't seem to work on my application. It doesn't even work for-</p>
  
  <pre><code>headerArea{
      background: #ccc;
  }
  </code></pre>
  
  <p>But it works fine when I apply the style to the parent class QDockWidget which the class headerArea inherits from-</p>
  
  <pre><code>QDockWidget{
      background: #ccc;
  }
  </code></pre>
  
  <p>I'd really appreciate any kind of help.
  Thanks!</p>