Hi, wrote the code and now i have problem. I would like next figures to be seen underneath the figures which have been already drawn. I wrote simple code below as example of the problem, line should be drawn underneath the rectangle:
{
setMinimumSize(400,400);
setAutoFillBackground(true);
}
painter.
setBrush(QBrush(Qt
::yellow));
painter.
setCompositionMode(QPainter::CompositionMode_SourceOver);
painter.
setPen(QPen(Qt
::red));
}
Window::Window(QWidget *parent) :
QWidget(parent)
{
setMinimumSize(400,400);
setBackgroundRole(QPalette::Base);
setAutoFillBackground(true);
}
void Window::paintEvent(QPaintEvent *){
QPainter painter(this);
painter.setBrush(QBrush(Qt::yellow));
painter.drawRect(QRect(QPoint(100,100),QPoint(200,200)));
painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
painter.setPen(QPen(Qt::red));
painter.drawLine(QPointF(150,50),QPointF(150,300));
}
To copy to clipboard, switch view to plain text mode
Bookmarks