May 2019
Intermediate to advanced
542 pages
13h 37m
English
Just as C++ signals and slots can be overloaded to accept different argument signatures, we can overload our custom PyQt signals and slots. For instance, suppose that, if a valid integer string is entered into our pop-up window, we'd like to emit it as both a string and an integer.
To do this, we first have to redefine our signal:
submitted = qtc.pyqtSignal([str], [int, str])
Instead of just passing in a single variable type, we're passing in two lists of variable types. Each list represents the argument list of a signal signature. So, we've registered two signals here: one that sends out a string only, and one that sends out an integer and a string.
In FormWindow.onSubmit(), we can now examine the text in the ...
Read now
Unlock full access