How can i call a function with three arguments while a button is clicked?
I have a function with three arguments
I want to call it when a button is clicked. My problem is that if i will use “QObject::connect();” then i can’t pass arguments so how can i do it?
Note that it is perfectly possible to have signals and slots with multiple arguments. So I don’t really understand the issue.
If you want to connect to a slot with three arguments, you just make sure you have a signal that matches that. I guess what you want to do, is connect a signal with no parameters to a slot that has multiple, while supplying the values for the arguments at connect time. Right? There is no direct support for that. However, you can do it indirectly. You can take some inspiration from QSignalMapper, and create a version of that supporting multiple arguments. Or, you wait for Qt5 and use a lambda function.