Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QGraphicsItem transparency issue
JoeCFD last edited by JoeCFD
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?
Asperamanca last edited by
Try not setting a brush.