On Wed, 2009-03-18 at 09:15 +, pyqt-requ...@riverbankcomputing.com
wrote:
From: Wolfgang Rohdewald wolfg...@rohdewald.de
Subject: [PyQt] dragging a QGraphicsSvgItem
To: pyqt@riverbankcomputing.com
Message-ID: 200903180430.09934.wolfg...@rohdewald.de
Content-Type: text/plain; charset=us-ascii
While dragging it, I want to see the whole image of the item move.
What works is something like this:
(code goes into class Tile(QGraphicsSvgItem), def mousePressEvent)
...
pmapSize = self.tileset.tileSize.toSize()
if self.pixmap is None or self.pixmap.size() != pmapSize:
self.pixmap = QPixmap(pmapSize)
self.pixmap.fill(Qt.transparent)
painter = QPainter(self.pixmap)
QGraphicsSvgItem.paint(self, painter,
QStyleOptionGraphicsItem())
for item in self.childItems():
QGraphicsSvgItem.paint(item, painter,
QStyleOptionGraphicsItem())
drag.setPixmap(self.pixmap)
drag.setHotSpot(event.pos().toPoint())
but I do not want to render a SVG that is already rendered
Is there any way I can avoid rendering this item twice? Did I overlook
a QGraphicsSvgItem method that would return its rendered pixmap?
--
Wolfgang
I use a graphics scene and I never have to explicitly paint anything.
It seems like you could create a pixmap item when you load the svg then
you wouldn't have to render it again later.
___
PyQt mailing listPyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt