c++qtqt5qgraphicsrectitem

how to fill a QGraphicsRectItem with certain color?


I have been trying to find a way to fill an instance of QGraphicsRectItem with any color, let's say red color, but I failed to find a clear way as of how to accomplish this naive task, It would be great if you could provide some hints, links, etc.

Thanks a lot


Solution

  • You have to use setBrush():

    your_rect_item->setBrush(Qt::red)