[PyQt] simpler 'connect' function
pshinners at blizzard.com
Tue Jan 15 20:35:16 GMT 2008
> No, you still have to wrap the string in a call to QtCore.SIGNAL()
> but that's still a "string" to me: No type checking, no way to know
> if your signal is really connected to anything and whether it will
> fire or not.
> That's why I'm against string literals in an API. If that API doesn't
> even offer any checks to string literals, that's even worse.
I'd be against using constants to define the signals. What type of value
is going to match things like "const QString&"?
How can Pyqt possibly check that the given callback accepts the type of
arguments requested? The type of safety you are asking for is not
possible, regardless of the signal argument type. Python could help with
some introspection, but a predefined constant does not help any more
than a string literal.
> The actual call is
> QObject.connect(other, SIGNAL("clicked()"), self,
> i.e. it connects "other, SIGNAL("clicked()")" to
> "self, self.onOtherClicked" (because > the fourth parameter could be a
> method of a third Python object).
I assume this type of call is only given as a placeholder to match the
C++ syntax. Pyqt takes a single callable as the "slot", the fourth
paramater is optional and unnecessary.
Still hoping to see
More information about the PyQt