Hi,
I have several labels on my screen(mainwindow.ui) And I need to draw on them(Overlay).
Unfortunately "Qpainter" just draws behind labels.

Qt Code:
  1. void MainWindow::paintEvent( QPaintEvent * event )
  2. {
  3. QPainter painter(this);
  4. painter.setPen(QPen(Qt::black, 2));
  5.  
  6. //ui->pushButton->clearFocus();
  7. //ui->pushButton->setAutoFillBackground(true);
  8. //ui->pushButton->setBackgroundRole();
  9. //ui->pushButton->setForegroundRole();
  10.  
  11.  
  12. //painter.setBackgroundMode();
  13.  
  14. path.moveTo(qrand() % 80, qrand() % 320);
  15. path.cubicTo(200, 80, 320, 80, 480, 320);
  16. painter.setPen(QPen(Qt::black, 8));
  17. painter.drawPath(path);
  18. }
To copy to clipboard, switch view to plain text mode 
I searched for lots of beheviars belonging "QPainter" and "QLabel".

Can you guide me how can I fix it?


Thanks.