[PyQt] Is the result of SIGNAL() a constant?
digulla at hepe.com
Wed Jan 9 21:39:38 GMT 2008
Giovanni Bajo schrieb:
>> I don't have a real example, but that's not the point. The point is
>> that they are different as far as Qt is concerned and so both need to
>> be able to be represented in the same class (even though the
>> programmer that designed the class needs to be shot).
> But given that such users can still obtain the same features
> (auto-completion, etc.) through usage of constants:
> class Foo(QObject):
> SIG_FOO_1 = SIGNAL("foo(QString*)")
> SIG_FOO_2 = SIGNAL("foo(const QString &)")
> What is exactly the advantage of supporting this feature out-of-the-box
> in PyQt?
When you want to use this signal, you can refer to SIG_FOO instead of
repeating the same string over and over just to find out much later that
you have a typo in it and the signal isn't really connected.
It's the old "replace string literal by constant" enhancement.
Aaron "Optimizer" Digulla a.k.a. Philmann Dark
"It's not the universe that's limited, it's our imagination.
Follow me and I'll show you something beyond the limits."
More information about the PyQt