<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: PyKDE4: new style signals and slots</title>
	<atom:link href="http://www.dennogumi.org/2010/03/pykde4-new-style-signals-and-slots/feed" rel="self" type="application/rss+xml" />
	<link>http://www.dennogumi.org/2010/03/pykde4-new-style-signals-and-slots</link>
	<description>On the web since 1999</description>
	<lastBuildDate>Tue, 27 Jul 2010 23:23:35 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: gml</title>
		<link>http://www.dennogumi.org/2010/03/pykde4-new-style-signals-and-slots/comment-page-1#comment-12877</link>
		<dc:creator>gml</dc:creator>
		<pubDate>Fri, 02 Apr 2010 10:50:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.dennogumi.org/?p=763#comment-12877</guid>
		<description>Thanks you, I&#039;ll try it. This night I&#039;ve avoid the problem by a work-around : keeping updated a list of email widgets, then when the clicked event is trigged, searching for the email which is set &quot;selected&quot; with the mouse events. 

Not really beautiful and efficient, but it works.

I will try your solution this afternoon, it can reduce my code size a little, and it&#039;s much more sexy. Thanks again for your help and your patience !</description>
		<content:encoded><![CDATA[<p>Thanks you, I&#8217;ll try it. This night I&#8217;ve avoid the problem by a work-around : keeping updated a list of email widgets, then when the clicked event is trigged, searching for the email which is set &#8220;selected&#8221; with the mouse events. </p>
<p>Not really beautiful and efficient, but it works.</p>
<p>I will try your solution this afternoon, it can reduce my code size a little, and it&#8217;s much more sexy. Thanks again for your help and your patience !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Einar</title>
		<link>http://www.dennogumi.org/2010/03/pykde4-new-style-signals-and-slots/comment-page-1#comment-12876</link>
		<dc:creator>Einar</dc:creator>
		<pubDate>Fri, 02 Apr 2010 07:10:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.dennogumi.org/?p=763#comment-12876</guid>
		<description>I found out the reason: it must be a callable, and instead (my bad, because I didn&#039;t realize it) you call the function inside, which returns None as it&#039;s a signal. So, to fix this you have two options:

1. Use partial from functools:

from functools import partial

uid = 1
wrapped_slot = partial(self.openWindow, uid)
self.message.button.clicked.connect(wrapped_slot)

2. Make a whole slot for it, but in that case you need to put uid in an instance variable or something:

self._uid = 1

self.message.button.clicked.connect(self.open_window)

def open_window(self):

    self.openWindow.emit(self._uid)</description>
		<content:encoded><![CDATA[<p>I found out the reason: it must be a callable, and instead (my bad, because I didn&#8217;t realize it) you call the function inside, which returns None as it&#8217;s a signal. So, to fix this you have two options:</p>
<p>1. Use partial from functools:</p>
<p>from functools import partial</p>
<p>uid = 1<br />
wrapped_slot = partial(self.openWindow, uid)<br />
self.message.button.clicked.connect(wrapped_slot)</p>
<p>2. Make a whole slot for it, but in that case you need to put uid in an instance variable or something:</p>
<p>self._uid = 1</p>
<p>self.message.button.clicked.connect(self.open_window)</p>
<p>def open_window(self):</p>
<p>    self.openWindow.emit(self._uid)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gml</title>
		<link>http://www.dennogumi.org/2010/03/pykde4-new-style-signals-and-slots/comment-page-1#comment-12874</link>
		<dc:creator>gml</dc:creator>
		<pubDate>Fri, 02 Apr 2010 00:36:43 +0000</pubDate>
		<guid isPermaLink="false">http://www.dennogumi.org/?p=763#comment-12874</guid>
		<description>Ok, when I set : 

openWindow = QtCore.pyqtSignal(int)

within my class (not the Widget class, the upper one), but outside the __init__, it works. 

Then I get another problem :

uid = 1
message.button.clicked.connect(self.openWindow.emit(uid))

(I&#039;ve used message.button, which is a QPushButton, to be sure that the problem doesn&#039;t come from clickable or not)

I get this :

    message.button.clicked.connect(self.openWindow.emit(uid))
TypeError: connect() slot argument should be a callable or a signal, not &#039;NoneType&#039;

It doesn&#039;t make sense for me :/</description>
		<content:encoded><![CDATA[<p>Ok, when I set : </p>
<p>openWindow = QtCore.pyqtSignal(int)</p>
<p>within my class (not the Widget class, the upper one), but outside the __init__, it works. </p>
<p>Then I get another problem :</p>
<p>uid = 1<br />
message.button.clicked.connect(self.openWindow.emit(uid))</p>
<p>(I&#8217;ve used message.button, which is a QPushButton, to be sure that the problem doesn&#8217;t come from clickable or not)</p>
<p>I get this :</p>
<p>    message.button.clicked.connect(self.openWindow.emit(uid))<br />
TypeError: connect() slot argument should be a callable or a signal, not &#8216;NoneType&#8217;</p>
<p>It doesn&#8217;t make sense for me :/</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gml</title>
		<link>http://www.dennogumi.org/2010/03/pykde4-new-style-signals-and-slots/comment-page-1#comment-12871</link>
		<dc:creator>gml</dc:creator>
		<pubDate>Thu, 01 Apr 2010 21:05:38 +0000</pubDate>
		<guid isPermaLink="false">http://www.dennogumi.org/?p=763#comment-12871</guid>
		<description>It doesn&#039;t seem to work, or i&#039;m just too new to Qt to understand...

I use this to make QWidget clickable : http://diotavelli.net/PyQtWiki/Making%20non-clickable%20widgets%20clickable to make my QWidget clickable.

Then, here is my code :

self.openWindow = QtCore.pyqtSignal(int)
self.clickable(message).connect(self.openWindow.emit(11))

And when I try it : 
  self.clickable(message).connect(self.openWindow.emit(11))
AttributeError: &#039;PyQt4.QtCore.pyqtSignal&#039; object has no attribute &#039;emit&#039;

What i&#039;m doing wrong ?</description>
		<content:encoded><![CDATA[<p>It doesn&#8217;t seem to work, or i&#8217;m just too new to Qt to understand&#8230;</p>
<p>I use this to make QWidget clickable : <a href="http://diotavelli.net/PyQtWiki/Making%20non-clickable%20widgets%20clickable" rel="nofollow">http://diotavelli.net/PyQtWiki/Making%20non-clickable%20widgets%20clickable</a> to make my QWidget clickable.</p>
<p>Then, here is my code :</p>
<p>self.openWindow = QtCore.pyqtSignal(int)<br />
self.clickable(message).connect(self.openWindow.emit(11))</p>
<p>And when I try it :<br />
  self.clickable(message).connect(self.openWindow.emit(11))<br />
AttributeError: &#8216;PyQt4.QtCore.pyqtSignal&#8217; object has no attribute &#8216;emit&#8217;</p>
<p>What i&#8217;m doing wrong ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gml</title>
		<link>http://www.dennogumi.org/2010/03/pykde4-new-style-signals-and-slots/comment-page-1#comment-12870</link>
		<dc:creator>gml</dc:creator>
		<pubDate>Thu, 01 Apr 2010 18:05:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.dennogumi.org/?p=763#comment-12870</guid>
		<description>Indeed, QWidget doesn&#039;t have clicked(), i&#039;ve implemented it.

I&#039;ll try your solution as soon as i can, thanks you !</description>
		<content:encoded><![CDATA[<p>Indeed, QWidget doesn&#8217;t have clicked(), i&#8217;ve implemented it.</p>
<p>I&#8217;ll try your solution as soon as i can, thanks you !</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Einar</title>
		<link>http://www.dennogumi.org/2010/03/pykde4-new-style-signals-and-slots/comment-page-1#comment-12869</link>
		<dc:creator>Einar</dc:creator>
		<pubDate>Thu, 01 Apr 2010 16:29:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.dennogumi.org/?p=763#comment-12869</guid>
		<description>I&#039;m not sure if QWidget has the clicked() signal: if it doesn&#039;t have it, you&#039;ll have to implement it yourself in the appropriate event. As for the rest, you just define a signal in your class

openWindow = QtCore.pyqtSignal(int)

(assuming that you store the ID as an int)

then something like this, in the appropriate place of the code(assuming you have the id in &quot;my_id&quot;):

self.widget.clicked.connect(self.openWindowl.emit(my_id))</description>
		<content:encoded><![CDATA[<p>I&#8217;m not sure if QWidget has the clicked() signal: if it doesn&#8217;t have it, you&#8217;ll have to implement it yourself in the appropriate event. As for the rest, you just define a signal in your class</p>
<p>openWindow = QtCore.pyqtSignal(int)</p>
<p>(assuming that you store the ID as an int)</p>
<p>then something like this, in the appropriate place of the code(assuming you have the id in &#8220;my_id&#8221;):</p>
<p>self.widget.clicked.connect(self.openWindowl.emit(my_id))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: gml</title>
		<link>http://www.dennogumi.org/2010/03/pykde4-new-style-signals-and-slots/comment-page-1#comment-12868</link>
		<dc:creator>gml</dc:creator>
		<pubDate>Thu, 01 Apr 2010 16:21:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.dennogumi.org/?p=763#comment-12868</guid>
		<description>Hi,

i&#039;m unable to find a way to do a really simple thing in PyQt, maybe you could help  me ?

I have a QScrollwidget containing a lot of QWidgets. Each QWidget have a UID attribute. I would like the following thing : when I click on a QWidget, it will emit a signal containing the UID argument.

Actually, each QWidget represents an email, and when I click on an email-widget, I would like to open it in another window, using his UID.

Do you have an idea ?

Regards,
gml</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>i&#8217;m unable to find a way to do a really simple thing in PyQt, maybe you could help  me ?</p>
<p>I have a QScrollwidget containing a lot of QWidgets. Each QWidget have a UID attribute. I would like the following thing : when I click on a QWidget, it will emit a signal containing the UID argument.</p>
<p>Actually, each QWidget represents an email, and when I click on an email-widget, I would like to open it in another window, using his UID.</p>
<p>Do you have an idea ?</p>
<p>Regards,<br />
gml</p>
]]></content:encoded>
	</item>
</channel>
</rss>
