I apologize, my main concern was about QTextEdit, and I happened to try to do that (as a totally different issue) on a QImage with QPainter. That failed as well, and I mistook this thread for my newer problem.

I'm still using the code in the OP.