[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] QGraphicsView.setBackgroundBrush don't work
From: leo kirotawa <kirotawa () gmail ! com>
Date: 2010-10-23 17:24:04
Message-ID: AANLkTi=Bup0XNQhc4bPX8=tsc-MKZ4T4CW7iD1_bSEjE () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
thanks for you help
Now it work fine, was just the image path, but what is curious that it dont
work begore, very strange.
[]'s
On Sat, Oct 23, 2010 at 5:00 AM, Vincent Vande Vyvre <
vincent.vandevyvre@swing.be> wrote:
> 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 PyQt@riverbankcomputing.comhttp://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 <https://launchpad.net/oqapy>
>
> _______________________________________________
> PyQt mailing list PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
--
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)
日本語の学生です。
コンピュータサイエンスの学位.
[Attachment #5 (text/html)]
thanks for you help<div>Now it work fine, was just the image path, but what is \
curious that it dont work begore, very \
strange.</div><div><br></div><div>[]'s<br><br><div class="gmail_quote">On Sat, \
Oct 23, 2010 at 5:00 AM, Vincent Vande Vyvre <span dir="ltr"><<a \
href="mailto:vincent.vandevyvre@swing.be">vincent.vandevyvre@swing.be</a>></span> \
wrote:<br> <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px \
#ccc solid;padding-left:1ex;">
<div text="#000000" bgcolor="#ffffff">
Le 23/10/10 09:09, leo kirotawa a écrit :
<blockquote type="cite"><div><div></div><div class="h5"> Hi,
<div><br>
</div>
<div>I have the piece of code <br clear="all">
<br>
</div>
<div><br>
</div>
<div>
<div> view = QtGui.QGraphicsView(scene)</div>
<div> </div>
<div> view.setRenderHint(QtGui.QPainter.Antialiasing)</div>
<div> view.setRenderHint(QtGui.QPainter.Antialiasing)</div>
<div> pixmap = QtGui.QImage(":/images/background.jpg")</div>
<div> </div>
<div> view.setBackgroundBrush(QtGui.QBrush(pixmap))</div>
<div> view.setCacheMode(QtGui.QGraphicsView.CacheBackground)</div>
<div><br>
</div>
<div>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?</div>
-- <br>
Leônidas S. Barbosa (Kirotawa)<br>
[DesenvolvedorWeb/CEFET/RN]<br>
[Ciências da Computação/UFRN]<br>
[pós-graduando em Inteligência Computacional/Processamento Gráfico /UFRN<br>
[Estudante de japonês nível Intermediário I - Japanese Student]<br>
[Desenvolvedor em python, PyGame]<br>
blog nerd: <a href="http://corecode.wordpress.com/" \
target="_blank">corecode.wordpress.com/</a><br> blog music: <a \
href="http://essenaomanja.blogspot.com" target="_blank">essenaomanja.blogspot.com</a> \
<div>blog tirinhas: <a href="http://elminiche.wordpress.com/" \
target="_blank">elminiche.wordpress.com/</a><br> <br>
"Mais sábio é aquele que sabe que não sabe" (Sócrates)<br>
<br>
日本語の学生です。<br>
コンピュータサイエンスの学位.<br>
</div>
<br>
</div>
</div></div><pre><fieldset></fieldset>
_______________________________________________
PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com" \
target="_blank">PyQt@riverbankcomputing.com</a> <a \
href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" \
target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a></pre> \
</blockquote> Hi,<br>
<br>
I have reproduce your code like this:<br>
<br>
class GraphicView(object):<br>
def __init__(self, MainWindow):<br>
MainWindow.resize(864, 649)<br>
self.centralwidget = QtGui.QWidget(MainWindow)<br>
self.gridLayout = QtGui.QGridLayout(self.centralwidget)<br>
self.scene = QtGui.QGraphicsScene(self.centralwidget)<br>
self.graphicsView = QtGui.QGraphicsView(self.scene)<br>
self.graphicsView.setRenderHints(QtGui.QPainter.Antialiasing)<br>
pixmap = QtGui.QImage("amymc1.jpg") <br>
self.graphicsView.setBackgroundBrush(QtGui.QBrush(pixmap))<br>
self.graphicsView.setCacheMode(QtGui.QGraphicsView.CacheBackground)<br>
self.gridLayout.addWidget(self.graphicsView, 0, 0, 1, 1)<br>
MainWindow.setCentralWidget(self.centralwidget)<br>
<br>
On Qt 4.6, PyQt 4.7.2<br>
and Qt 4.7, PyQt 4.7.4<br>
<br>
That functions but the result is unexpected.(See attachement)<br><font \
color="#888888"> <br>
<div>-- <br>
Vincent V.V.<br>
<a href="https://launchpad.net/oqapy" target="_blank">Oqapy</a></div>
</font></div>
<br>_______________________________________________<br>
PyQt mailing list <a \
href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a><br> <a \
href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" \
target="_blank">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br></blockquote></div><br><br \
clear="all"><br>-- <br>Leônidas S. Barbosa (Kirotawa)<br> \
[DesenvolvedorWeb/CEFET/RN]<br>[Ciências da Computação/UFRN]<br>[pós-graduando em \
Inteligência Computacional/Processamento Gráfico /UFRN<br>[Estudante de japonês \
nível Intermediário I - Japanese Student]<br>[Desenvolvedor em python, \
PyGame]<br> blog nerd: <a href="http://corecode.wordpress.com/" \
target="_blank">corecode.wordpress.com/</a><br>blog music: <a \
href="http://essenaomanja.blogspot.com" \
target="_blank">essenaomanja.blogspot.com</a><div>blog tirinhas: <a \
href="http://elminiche.wordpress.com/" \
target="_blank">elminiche.wordpress.com/</a><br> <br>"Mais sábio é aquele que \
sabe que não sabe" \
(Sócrates)<br><br>日本語の学生です。<br>コンピュータサイエンスの学位.<br></div><br>
</div>
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic