You cannot connect stateChanged() to kuldes() this way. stateChanged() signals that the checkbox has been checked (argument = 1) or unchecked (argument = 0). So kuldes() gets only 0 or 1 from stateChanged(). If you want to pass some integer value, you need to use some variable visible in kuldes() while processing stateChanged(). One possibility is deriving your own checkbox with ledcounter as an additional data member, defining your own signal, say MyStateChanged, connecting stateChanged to yourself a whenever the state changes, update ledcounter and emit MyStateChanged(). Now, connect MyStateChanged to kuldes(). kuldes() can now get the right checkbox using sender() and see the ledcounter.
The correct connect() at line 10 should be:
MainWindow::connect(ledek[ledcounter], SIGNAL(stateChanged(int)), this, SLOT(kuldes(int)));
MainWindow::connect(ledek[ledcounter], SIGNAL(stateChanged(int)), this, SLOT(kuldes(int)));
To copy to clipboard, switch view to plain text mode
Bookmarks