As the Qt doc reports:
QBrush :: QBrush ()
Creates a default black brush with the Qt :: NoBrush style (i.e., this brush will not fill the shapes).
In your second example, you must set the style of the QBrush object using setStyle (), for example, using Qt :: SolidPattern .
QGraphicsScene * scence = new QGraphicsScene();
QBrush *brush = new QBrush();
brush->setStyle(Qt::SolidPattern);
brush->setColor(QColor(60,20,20));
scence->setBackgroundBrush(*brush);
QGraphicsView *view = new QGraphicsView();
view->setScene(scence);
view->showFullScreen();
Hope this helps!
source
share