hello,
I have a brush constructed from a pixmap. When I set this brush to a widget the pixmap is tiled.
Is there a way to prevent this tiling?
Richard
hello,
I have a brush constructed from a pixmap. When I set this brush to a widget the pixmap is tiled.
Is there a way to prevent this tiling?
Richard
Perhaps it will help if I tell you what I'm trying to do.
I made an image editor program but it is slow because I redraw the image after every edit. The base image does not change so I'm trying to set it as a background.
I tried using a brush, which made the program much more responsive, but it tiled the image to fit its container instead of resizing it.
Do you another approach to achieve this?
what are you using the brush on ?? QWidget ?
You can simple use QPainter::drawPixmap to draw the Pixmap.
I'm using a graphicscene within a graphicview to display the image so I can zoom.
I tried puting the drawPixmap function in the drawBackground event and so far it seems to work:
Qt Code:
def drawBackground(self, painter, rect): if self.img: painter.drawPixmap(rect, self.img, rect)To copy to clipboard, switch view to plain text mode
thanks for your help!
hmm..unfortunately it crashes in windows.
What code are u using ? crash must be due some invalid pointer or something else
the thing is I'm using python which is supposed to take care of the memory management for me.
I've attached my little program if anyone feels motivated to take a look. To run it you need pyqt4 and PIL.
On Linux:
> python EyeEditor.py
and on Windows (if you have python and the other dependencies installed) you just double click EyeEditor.py
Then go File->Open and choose an image to view.
I traced it with a debugger on windows and found it crashed at line 23 of ZoomView.py where I try to display the image. But I have no problems on Linux, only Windows.
Any tips are very welcome!
Richard
Bookmarks