1. What exactly is a signal. In hardware, an interrupt can be viewed as a
signal and the voltage on a pin will suddenly jump to +5V as an indicator
that an interrupt has occurred. With Qt signals - if a widget-c++ code has
to 'signal' an event - what does it do?
As a consequence of not understanding the above..
2. How do you connect a single signal to multiple slots? Do the
slots/methods get called one by one? or are they treated as independent
threads and run on different cores?
3. pg 130 of Summerfield
def __init__(self, parent=None):
super(...blah initialize QObject with parent
self.connect(self, SIGNAL("valuedChanged(int)"), self.checkzero)
if self.value() == 0:
basically when SpinBox gets set to zero we emit 'atzero' and return a zeros
What i don't get is the valueChanged(int) bit.. he clearly defines an (int)
being passed to checkzero so shouldn't the definition reflect the same?
A. additionally I did not understand short circuit signals where you can
drop the (type1, type2) in the signature and just do
Is this doable ONLY in emit() or also in connect()??
4. pg 131 'any data can be passed as arguments to the emit method and they
can be passed as Python objects'
self.emit(SIGNAL("atzero"), 10, 20, 30) or
self.emit(SIGNAL("atzero"), [10, 20, 30])
does he mean i can pass a SINGLE OBJECT of any python type or does he mean
multiple independent containers?
(assuming the definition matches)
5. He says 'a signal with one argument is a Qt signal or a non-short-circuit
So if I have a Qt widget in C++ and it emits a valueChanged(int) signal..
okay he's going to have to convert our asm/x86 int to python-integer and
then call the python-method that was mapped to 'valueChanged' with the
python-integer argument OR the signal is being generated from Python code
itself AND WILL be converted to C++ datatype - huh???? why??
I'm guessing there's some dispatch code that maintains a mapping table?? SO
why can't it differentiate between inhouse python widget and Qt-c++ widget??
6. "If we use the SIGNAL() function with a signalSignature (a possibly empty
parenthesized list of comma-separated PyQt types)..."??
how can it be an empty () list..?? If there's a list it's no longer empty..
7. What exactly is a Python signal vs a Qt signal originating from a C++-
asm-widget?? PyQt is a wrapper around C++Qt so.. where are the python
self.__rate = 17.5
def setRate(self, rate):
if rate != self.__rate:
self.__rate = rate
print "TaxRate changed to %.2f%%" % value
vat = TaxRate()
vat.connect(vat, SIGNAL("rateChanged"), rateChanged)
vat.setRate(17.5) # No change will occur (new rate is the same)
vat.setRate(8.5) # A change will occur (new rate is different)
Isn't this a mistake? self.connect( should be:
vat.connect(vat, SIGNAL("rateChanged"), rate)