467,900 Members | 1,373 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,900 developers. It's quick & easy.

Custom PyQt4 Slots

ff
Is it possible to create custom PyQt4 Slots, i have searched high and
low to no avail;

I have an application that can set animation speed to different
levels, i want the user to alter this, now quite clearly i can write a
single function to control setting any speed with something like:

def setSpeed(self, speed):
some code in here to set speed

but if i have mutiple option for speed do i have to connect them all
to seperate callables for each individual speed which each in turn
call setSpeed with their respective speeds or can i create a slot that
can simply pass an integer to setSpeed in much the same way as the
built-in SIGNAL from something like a combo box can pass its current
index??

i realise this could be impossibly, knowing that would be equally
useful and i will just work around it, albeit with more verbose code!!

thanks

ff
Aug 11 '08 #1
  • viewed: 2319
Share:
3 Replies
ff schrieb:
Is it possible to create custom PyQt4 Slots, i have searched high and
low to no avail;

I have an application that can set animation speed to different
levels, i want the user to alter this, now quite clearly i can write a
single function to control setting any speed with something like:

def setSpeed(self, speed):
some code in here to set speed

but if i have mutiple option for speed do i have to connect them all
to seperate callables for each individual speed which each in turn
call setSpeed with their respective speeds or can i create a slot that
can simply pass an integer to setSpeed in much the same way as the
built-in SIGNAL from something like a combo box can pass its current
index??

i realise this could be impossibly, knowing that would be equally
useful and i will just work around it, albeit with more verbose code!!
http://docs.huihoo.com/pyqt/pyqt4.ht...and-qt-signals

"""
PyQt allows new signals to be defined dynamically. The act of emitting a
PyQt signal implicitly defines it. PyQt v4 signals are also referenced
using the QtCore.SIGNAL() function.
"""

Work on your google-fu...

Diez
Aug 11 '08 #2
Diez B. Roggisch schrieb:
ff schrieb:
>Is it possible to create custom PyQt4 Slots, i have searched high and
low to no avail;

I have an application that can set animation speed to different
levels, i want the user to alter this, now quite clearly i can write a
single function to control setting any speed with something like:

def setSpeed(self, speed):
some code in here to set speed

but if i have mutiple option for speed do i have to connect them all
to seperate callables for each individual speed which each in turn
call setSpeed with their respective speeds or can i create a slot that
can simply pass an integer to setSpeed in much the same way as the
built-in SIGNAL from something like a combo box can pass its current
index??

i realise this could be impossibly, knowing that would be equally
useful and i will just work around it, albeit with more verbose code!!

http://docs.huihoo.com/pyqt/pyqt4.ht...and-qt-signals

"""
PyQt allows new signals to be defined dynamically. The act of emitting a
PyQt signal implicitly defines it. PyQt v4 signals are also referenced
using the QtCore.SIGNAL() function.
"""
And not to forget:

"""
A slot is a function (in PyQt a slot is any Python callable).
"""

It's as easy as it can get.

Diez
Aug 11 '08 #3
ff
On Aug 11, 9:56*pm, "Diez B. Roggisch" <de...@nospam.web.dewrote:
Diez B. Roggisch schrieb:
ff schrieb:
Is it possible to create custom PyQt4 Slots, i have searched high and
low to no avail;
I have an application that can set animation speed to different
levels, i want the user to alter this, now quite clearly i can write a
single function to control setting any speed with something like:
def setSpeed(self, speed):
* * *some code in here to set speed
but if i have mutiple option for speed do i have to connect them all
to seperate callables for each individual speed which each in turn
call setSpeed with their respective speeds or can i create a slot that
can simply pass an integer to setSpeed in much the same way as the
built-in SIGNAL from something like a combo box can pass its current
index??
i realise this could be impossibly, knowing that would be equally
useful and i will just work around it, albeit with more verbose code!!
http://docs.huihoo.com/pyqt/pyqt4.ht...and-qt-signals
"""
PyQt allows new signals to be defined dynamically. The act of emitting a
PyQt signal implicitly defines it. PyQt v4 signals are also referenced
using the QtCore.SIGNAL() function.
"""

And not to forget:

"""
A slot is a function (in PyQt a slot is any Python callable).
"""

It's as easy as it can get.

Diez
Sorry, yeah getting confused between SIGNALS and SLOTS, thanks
Aug 11 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Harshad | last post: by
3 posts views Thread by Skink | last post: by
3 posts views Thread by Tina I | last post: by
25 posts views Thread by Daniel Jonsson | last post: by
2 posts views Thread by Pradnyesh Sawant | last post: by
2 posts views Thread by jiang.haiyun | last post: by
2 posts views Thread by Bighead | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.