mercredi 22 avril 2015

Drawing html with transparent background

I'm currently trying to draw an HTML formatted text of a QTextEdit into a QPixmap with a transparent background, to use it as an overlay for another widget.

My first attempt was, to use the QTextDocument of the QTextEdit and use drawContents() to draw it to a QPixmap.

As a second attempt, I passed the HTML to a QStaticText and painted this to my QPixmap, using a QPainter.

Both approaches paint the final text as expected, however, the background of the QPixmap is always grey. Also setting the background-color of the QTextEdit, inside the StyleSheet, to transparent does no change.

Is there any way, that I can make the background transparent?

Aucun commentaire:

Enregistrer un commentaire