Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Unable to view rectangle(red color) drawn using Qpainter when the window background is set to black color
kshp last edited by
i want to draw a red color rectangle on a black backgrounded window but unable to view the rectangle. My code is as below:
void MainWindow::paintEvent(QPaintEvent *e)
Hi and welcome to devnet,
The pen is used for the lines and outlines. If you want to have a rect in red, either use a red brush or use the fillRect function.
kshp last edited by kshp
Using red brush or fillRect is making inner part of the rectangle also filled up with red color. I want only the border of the rectangle to be filled with red and inner part to be transparent.
Then set the brush to Qt::transparent.