LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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
 
LinkBack Search this Thread
Old 06-17-2010, 01:05 PM   #1
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713Reputation: 713
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, 02:53 PM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 451Reputation: 451Reputation: 451Reputation: 451Reputation: 451
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 02:56 PM.
 
1 members found this post helpful.
Old 06-20-2010, 08:05 PM   #3
dugan
Senior Member
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 4,238

Rep: Reputation: 1299Reputation: 1299Reputation: 1299Reputation: 1299Reputation: 1299Reputation: 1299Reputation: 1299Reputation: 1299Reputation: 1299
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 08:22 PM.
 
Old 06-20-2010, 08:23 PM   #4
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 451Reputation: 451Reputation: 451Reputation: 451Reputation: 451
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 08: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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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


All times are GMT -5. The time now is 10:49 PM.

Main Menu
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