I've given up on trying to paint a QMdiArea, and instead I'm using the code below to paint on a scene -> view -> layout -> groupBox. Strangely, although I get a black rectangle, from the pen, the brush has no effect - I can't fill the rect.
EDIT: I found the answer:
brush.setStyle(Qt::SolidPattern);
groupBox_test->setLayout(layout);
brush.setColor(Qt::red);
pen.setColor(Qt::black);
layout->addWidget(aview);
scene->addRect(0,0,50,50,pen,brush);
aview->show();
QVBoxLayout *layout = new QVBoxLayout();
groupBox_test->setLayout(layout);
QBrush brush;
QPen pen;
brush.setColor(Qt::red);
pen.setColor(Qt::black);
QGraphicsScene *scene = new QGraphicsScene();
QGraphicsView *aview = new QGraphicsView(scene);
layout->addWidget(aview);
scene->addRect(0,0,50,50,pen,brush);
aview->show();
To copy to clipboard, switch view to plain text mode
Bookmarks