[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] Cannot add item to itemgroups while itemchange() is defined
From:       "Zoellner, Christian" <Christian.Zoellner () student ! hpi ! uni-potsdam ! de>
Date:       2013-05-21 9:56:28
Message-ID: 743744BA6A0A634AB062798355C63A4B03D0E7 () MXSTU2012 ! hpi ! uni-potsdam ! de
[Download RAW message or body]

Hello guys,
I currently have a very mysterious problem with PyQT and neither Stackoverf=
low (http://stackoverflow.com/q/16614187/2394681) nor any of my friends and=
 coworkers can help me with it.
I'm building a PyQt QGraphicsView project where some QGraphicItems can be m=
oved around between different QGraphicsItemGroups. For that, I use the addI=
temToGroup() method of the "new" parent itemGroup.
This works fine, but only so long as I do not define the itemChange() metho=
d in my custom child-item class. Once I define that method (even if I just =
pass the function call to the super class), the childItems will not be adde=
d to ItemGroups no matter what I try.
class MyChildItem(QtGui.QGraphicsItemGroup):
    def itemChange(self, change, value):
        # TODO: Do something for certain cases of ItemPositionChange
        return QtGui.QGraphicsItemGroup.itemChange(self, change, value)
        #return super().itemChange(change, value)   # Tried this variation =
too
Am I simply too stupid for properly calling a superclass method in Python, =
or is the problem somewhere in the QT / PyQT magic?
I use Python 3.3 with PyQt 4.8 and QT 5.
I would really appreciate any kind of help or ideas.
Thanks a lot,
Christian Z=F6llner


[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
p
	{mso-style-priority:99;
	mso-margin-top-alt:auto;
	margin-right:0in;
	mso-margin-bottom-alt:auto;
	margin-left:0in;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
pre
	{mso-style-priority:99;
	mso-style-link:"HTML Preformatted Char";
	margin:0in;
	margin-bottom:.0001pt;
	font-size:10.0pt;
	font-family:"Courier New";}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
span.HTMLPreformattedChar
	{mso-style-name:"HTML Preformatted Char";
	mso-style-priority:99;
	mso-style-link:"HTML Preformatted";
	font-family:"Courier New";}
span.kwd
	{mso-style-name:kwd;}
span.pln
	{mso-style-name:pln;}
span.typ
	{mso-style-name:typ;}
span.pun
	{mso-style-name:pun;}
span.com
	{mso-style-name:com;}
.MsoChpDefault
	{mso-style-type:export-only;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,&quot;serif&quot;">Hello guys,<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
style="font-size:12.0pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">I \
currently have a very mysterious problem with PyQT and neither Stackoverflow (<a \
href="http://stackoverflow.com/q/16614187/2394681">http://stackoverflow.com/q/16614187/2394681</a>)
  nor any of my friends and coworkers can help me with it.<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,&quot;serif&quot;">I'm building a PyQt QGraphicsView project where some \
QGraphicItems can be moved around between different QGraphicsItemGroups.  For that, I \
use the addItemToGroup() method of the &quot;new&quot; parent itemGroup. <o:p> \
</o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,&quot;serif&quot;">This works fine, but only so long as I do not define \
the itemChange() method in my custom child-item class.  Once I define that method \
(even if I just pass the function call to the super class), the childItems will not \
be added to ItemGroups no matter what I try.<o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier \
New&quot;">class MyChildItem(QtGui.QGraphicsItemGroup):<o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp; def itemChange(self, change, \
value):<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # TODO: Do something for \
certain cases of ItemPositionChange<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-size:10.0pt;font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return \
QtGui.QGraphicsItemGroup.itemChange(self, change, value)<o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-size:10.0pt;font-family:&quot;Courier \
New&quot;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; #return \
super().itemChange(change, value)&nbsp;&nbsp; # Tried this variation \
too<o:p></o:p></span></p> <p class="MsoNormal" \
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
style="font-size:12.0pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">Am \
I simply too stupid for properly calling a superclass method in Python, or is the \
problem somewhere in the  QT / PyQT magic?<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
style="font-size:12.0pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">I \
use Python 3.3 with PyQt 4.8 and QT 5. <o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
style="font-size:12.0pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;">I \
would really appreciate any kind of help or ideas.<o:p></o:p></span></p> <p \
class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,&quot;serif&quot;">Thanks a lot,<o:p></o:p></span></p> <p \
class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,&quot;serif&quot;">Christian Zöllner<o:p></o:p></span></p> <p \
class="MsoNormal"><o:p>&nbsp;</o:p></p> </div>
</body>
</html>



_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
--===============0544811968073872635==--

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic