LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 06-17-2010, 02:05 PM   #1
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714
PyQt4 Signals and Slots


I tried searching online but I couldn't figure out how to create your own signals and slots in PyQt4.
 
Old 06-17-2010, 03:53 PM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Did you try to enter

documentation signal slot PyQt4

as a search entry into your favorite WEB search engine ?

Last edited by Sergei Steshenko; 06-17-2010 at 03:56 PM.
 
1 members found this post helpful.
Old 06-20-2010, 09:05 PM   #3
dugan
Senior Member
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 4,988

Rep: Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555
The old way (Qt < 4.5):

A slot in PyQt4 is just a regular method.

You don't create signals. You just emit and connect them.

So, for example:

Code:
class Sample(QObject):

    def __init__(self, parent = None):
        
        # Assuming Python 2.
        super(Sample, self).__init__(parent)

        self.connect(self, QtCore.SIGNAL("sampleSignal"), self.callingMethod)

    def slotMethod(self, arg1):
        print arg1

    def callingMethod(self):
        self.emit(QtCore.SIGNAL("sampleSignal"), "foo")
The new way:
http://www.riverbankcomputing.co.uk/...d-slot-support

(first hit using the previous poster's Google keywords).

Last edited by dugan; 06-20-2010 at 09:22 PM.
 
Old 06-20-2010, 09:23 PM   #4
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by dugan View Post
...
(first hit using the previous poster's Google keywords).
Exactly.

Last edited by Sergei Steshenko; 06-20-2010 at 09:24 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PyQt4 fails install on CentOs Poopzilla Linux - Software 3 01-06-2010 12:40 PM
[SOLVED] Porting Qt highlighting example code to PyQt4 Snouffelaire Programming 4 11-20-2009 01:02 PM
Python/PyQt4 - Newbie Structure question ocularb0b Programming 0 01-28-2008 10:42 AM
Qt signals and slots for custom class ManuPeng Programming 2 04-06-2007 06:17 PM
Problem with Slots and Signals Gnarg Programming 2 10-07-2005 08:19 AM


All times are GMT -5. The time now is 12:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration