Le 23/10/10 09:09, leo kirotawa a écrit :
 Hi,

I  have the piece of code 


 view = QtGui.QGraphicsView(scene)
   
    view.setRenderHint(QtGui.QPainter.Antialiasing)
    view.setRenderHint(QtGui.QPainter.Antialiasing)
    pixmap = QtGui.QImage(":/images/background.jpg")
    
    view.setBackgroundBrush(QtGui.QBrush(pixmap))
    view.setCacheMode(QtGui.QGraphicsView.CacheBackground)

So my scene have 800 x 600 pixel, and my image too. When I try put the background in view just show a view in white color with no image. What I 'm doing wrong?
--
Leônidas S. Barbosa (Kirotawa)
[DesenvolvedorWeb/CEFET/RN]
[Ciências da Computação/UFRN]
[pós-graduando em Inteligência Computacional/Processamento Gráfico /UFRN
[Estudante de japonês nível Intermediário I  - Japanese Student]
[Desenvolvedor em python, PyGame]
blog nerd: corecode.wordpress.com/
blog music: essenaomanja.blogspot.com
blog tirinhas: elminiche.wordpress.com/

"Mais sábio é aquele que sabe que não sabe" (Sócrates)

日本語の学生です。
コンピュータサイエンスの学位.

_______________________________________________ PyQt mailing list [email protected] http://www.riverbankcomputing.com/mailman/listinfo/pyqt
Hi,

I have reproduce your code like this:

class GraphicView(object):
    def __init__(self, MainWindow):
        MainWindow.resize(864, 649)
        self.centralwidget = QtGui.QWidget(MainWindow)
        self.gridLayout = QtGui.QGridLayout(self.centralwidget)
        self.scene = QtGui.QGraphicsScene(self.centralwidget)
        self.graphicsView = QtGui.QGraphicsView(self.scene)
        self.graphicsView.setRenderHints(QtGui.QPainter.Antialiasing)
        pixmap = QtGui.QImage("amymc1.jpg")  
        self.graphicsView.setBackgroundBrush(QtGui.QBrush(pixmap))
        self.graphicsView.setCacheMode(QtGui.QGraphicsView.CacheBackground)
        self.gridLayout.addWidget(self.graphicsView, 0, 0, 1, 1)
        MainWindow.setCentralWidget(self.centralwidget)

On Qt 4.6, PyQt 4.7.2
and Qt 4.7, PyQt 4.7.4

That functions but the result is unexpected.(See attachement)

--
Vincent V.V.
Oqapy


<<attachment: background.jpg>>

_______________________________________________
PyQt mailing list    [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to