QGraphicsItem transparency issue
I am using a QGraphicsItem to display a QString text within a rectangle in qchart.
It is done inside paint() of QGraphicsItem. I would like to set QGraphicsItem background transparent. It can be done by setting opacity of the painter in paint(). The code is as follows:
void MyGraphicsItem::paint( QPainter * painter, const QStyleOptionGraphicsItem* option, QWidget * widget )
painter->setBrush( Qt:white );
painter->drawText( text_rect, str_text );
if the painter has 0.0 opacity, text will disappear as well. How can I set the background of rectangle text_rect transparent while keeping the text visible?
Try not setting a brush.