I have been reading the section "Connecting Slots By Name" on this PyQt5 documentation page which basically describes new signals and slots functionality. This piece caught my eye:
For example the QtGui.QSpinBox class has the following signals:
void valueChanged(int i); void valueChanged(const QString &text);
When the value of the spin box changes both of these signals will be emitted.
So I sketched up the following script to test this double call behaviour:
#!/usr/bin/env python3
from PyQt5 import QtCore, QtGui
from PyQt5.QtWidgets import QMainWindow, QSpinBox
class Test(QMainWindow):
def __init__(self):
super().__init__()
self.spb = QSpinBox()
self.spb.valueChanged.connect(self.onValueChanged)
self.setCentralWidget(self.spb)
def onValueChanged(self, x):
print("QSpinBox: value changed! " + str(x))
if __name__ == "__main__":
import sys
from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv)
t = Test()
t.show()
sys.exit(app.exec_())
And it looks to me like only one signal is coming through. What am I missing? Please note that I am a complete PyQt
noob.