[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: Re: [PyQt] problem with passing arguments to a slot
From: Hans-Peter Jansen <hpj () urpla ! net>
Date: 2008-01-18 10:04:17
Message-ID: 200801181104.17489.hpj () urpla ! net
[Download RAW message or body]
Am Freitag, 18. Januar 2008 schrieb sschoellhammer:
> Hello everybody,
>
> I really like PyQt but I have one crucial problem. For some reason I
> cannot pass an argument from a signal to my own slot function. If there
> isn't any - like a simple "clicked()" signal it all works ok but once I
> have anything with an argument my own function doesnt even seem to get
> called :/ Here's a little bit of code:
>
> import sys
> from PyQt4.Qt import *
>
> class MainWindow(QMainWindow, Ui_MainWindow):
> def __init__(self, parent = None):
> QMainWindow.__init__(self, parent)
> self.setupUi(self)
>
> self.connect(self.btnSetAnimRoot, SIGNAL("clicked()"),self.browse)
> self.connect(self.lineEditAnimRoot, SIGNAL("textChanged ( const QString
> & text )"),self.test)
It's as simple as omitting "text" here. SIGNAL's argument is the C++
signature without the variable names.. See:
http://www.riverbankcomputing.com/Docs/PyQt4/pyqt4ref.html#pyqt-signals-and-qt-signals
> self.connect(self.lineEditAnimRoot, SIGNAL("returnPressed
> ()"),self.test2)
>
> #this function doesnt work - it doest even seem to get called
> def test(self,text):
> print text
>
> #if i no parameter is passed there is no problem
> def test2(self):
> print "pressed"
>
>
> I read this tutorial (http://blog.qgis.org/?q=node/102) and I seem to be
> doing exactly the same but I just cant get this to work.
>
> Please if you know help me out, this is driving me crazy!
>
> Thanks in advance,
> seb
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic