Problem drowing in tabWidget...
I'm having a problem with a simple QWidget program that draws an ellipse inside a child tabWidget (in sоme of tabs).
I have Main ui form and a tabWidget in it.
Here is part of the code:
{
painter.
setRenderHint(QPainter::Antialiasing,
true);
painter.
setPen(QPen(Qt
::black,
12, Qt
::ashDotLine, Qt
::RoundCap));
painter.
setBrush(QBrush(Qt
::green, Qt
::olidPattern));
painter.drawEllipse(80, 80, 400, 240);
}
void MainWindow::paintEvent(QPaintEvent *event)
{
QPainter painter(ui->tab_2);
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setPen(QPen(Qt::black, 12, Qt::ashDotLine, Qt::RoundCap));
painter.setBrush(QBrush(Qt::green, Qt::olidPattern));
painter.drawEllipse(80, 80, 400, 240);
}
To copy to clipboard, switch view to plain text mode
Line 3 QPainter painter(ui->tab_2); doesn't do anything. The program draws the ellipse only if I replace line 3 with QPainter painter(this); but that draws on the parent QWidget (Main form) and not on the child QWidget (tabWidget) as desired.
Any Suggestion?
Thanks!
Bookmarks