I have a QGraphicsScene and a QGraphicsView. I am currently using the QGraphicsView to draw a backgorund image. I have reimplemented the QGraphicsView::drawBackground() function like this:
def drawBackground(self, painter, rect): sceneRect = self.sceneRect() if self.background: rectf = QRectF(self.background.rect()) painter.drawPixmap(sceneRect, self.background, rectf) else: painter.fillRect(rect.intersect(sceneRect), QBrush(Qt.lightGray)) painter.setBrush(Qt.NoBrush) painter.drawRect(sceneRect) self.background is a QPixmap: self.background = QPixmap(':/some_image.png') The problem with this is that if the PNG is not in my .qrc file, the background image does not show up. I would like to make it so that I can use any image I want without having to put it into the .qrc. How would I do this? I took a look at QGraphicsScene::drawBackground() which requires a QPainter as a parameter. However, I am not sure of how to tell the QPainter which image to use. -- View this message in context: http://old.nabble.com/Question-about-drawing-background-images-in-a-QGraphicsScene-and-QGraphicsView-tp30406365p30406365.html Sent from the PyQt mailing list archive at Nabble.com. _______________________________________________ PyQt mailing list PyQt@riverbankcomputing.com http://www.riverbankcomputing.com/mailman/listinfo/pyqt