d@nyal
29th May 2010, 18:36
Hi,
I have several labels on my screen(mainwindow.ui) And I need to draw on them(Overlay).
Unfortunately "Qpainter" just draws behind labels.
void MainWindow::paintEvent( QPaintEvent * event )
{
QPainter painter(this);
painter.setPen(QPen(Qt::black, 2));
//ui->pushButton->clearFocus();
//ui->pushButton->setAutoFillBackground(true);
//ui->pushButton->setBackgroundRole();
//ui->pushButton->setForegroundRole();
//painter.setBackgroundMode();
QPainterPath path;
path.moveTo(qrand() % 80, qrand() % 320);
path.cubicTo(200, 80, 320, 80, 480, 320);
painter.setPen(QPen(Qt::black, 8));
painter.drawPath(path);
}
I searched for lots of beheviars belonging "QPainter" and "QLabel".
Can you guide me how can I fix it?
Thanks.
I have several labels on my screen(mainwindow.ui) And I need to draw on them(Overlay).
Unfortunately "Qpainter" just draws behind labels.
void MainWindow::paintEvent( QPaintEvent * event )
{
QPainter painter(this);
painter.setPen(QPen(Qt::black, 2));
//ui->pushButton->clearFocus();
//ui->pushButton->setAutoFillBackground(true);
//ui->pushButton->setBackgroundRole();
//ui->pushButton->setForegroundRole();
//painter.setBackgroundMode();
QPainterPath path;
path.moveTo(qrand() % 80, qrand() % 320);
path.cubicTo(200, 80, 320, 80, 480, 320);
painter.setPen(QPen(Qt::black, 8));
painter.drawPath(path);
}
I searched for lots of beheviars belonging "QPainter" and "QLabel".
Can you guide me how can I fix it?
Thanks.