PDA

View Full Version : FillRect with text



paolom
9th December 2010, 17:27
Hi,

I need to paint over an image a repeated text ( like "Demo Version" ) .
In particular, this text need to be rotated.

I think the easiest solution is to use the fillRect with a QBrush Qt::TexturePattern, but I work in a different thread ( not GUI ) and the fillRect crash cause


QPixmap: It is not safe to use pixmaps outside the GUI thread


Any suggestions ?

Thanks

high_flyer
9th December 2010, 17:46
Any suggestions ?
Yes, you must do your painting actions in the painEvent().

paolom
9th December 2010, 17:52
Yes, I know this. But how ???

I want to paint a text over a qimage , with a rotation. The text is a string that need to be repeated over the full image.

For instance, the text which appeared in a print layout using a demo version of a software.

I hope you can understand my bad english !

high_flyer
9th December 2010, 19:06
But how ???
You have to overload the paintEevent() of the widget in which you want this.
You do know what overloading is right?

wysota
10th December 2010, 09:32
You can paint of QImage (as opposed to QPixmap) in a thread. But then eventually you'll have to convert the image to a pixmap to display it and this has to be done in the main thread where you will have to follow what high_flyer described anyway.