[PyQt] Beginners - signal - slots - question

Jochen Georges jochengeorges at yahoo.de
Fri Dec 21 15:31:58 GMT 2007


On Friday 21 December 2007 12:26:02 Henrik Pauli wrote:
> On Friday 21 December 2007, Jochen Georges wrote:
> > Hello,

 ..snip

> > Which is the right QLineEdit-Signal?
> > 	the action should start when return is pressed, but the
> > 	signal "returnPressed" has no parameter "QString"
> > 	and
> > 	textChanged(QString) or textEdited(QString) react on every single input
> > How do i place my own method, that changes the text?
>
> Here's a hint that might get you going:
>
> Create a new slot for your own use :)  In PyQt it’s just a python method,
> you can do anything in it.

OK, that works: (but it does not look like good style, does it?)

QtCore.QObject.connect(self.lineEdit,QtCore.SIGNAL("returnPressed()"),self.blabla)

def blabla(self):
	#some code
        self.lb_ergebnis.setText(myString)

#---------

QtCore.QObject.connect(self.lineEdit,QtCore.SIGNAL("returnPressed()"),
		self.lb_ergebnis, QtCore.SLOT(setText(self.blabla)))
def blabla(self):
	#some code
        return myString

mmhhh ...

how can i pass an argument to the slot-name?


thanks for any hint

beste gruesse
jochen



More information about the PyQt mailing list