no matching function for call to widget::connect
时间: 2024-05-03 16:21:14 浏览: 342
This error message typically occurs in Qt when you try to connect a signal to a slot, but the arguments of the signal and the slot do not match. To fix it, you need to make sure that the arguments of the signal and the slot are compatible.
For example, if you have a signal that takes an integer parameter and a slot that takes a string parameter, you will get this error message. To fix it, you either need to change the signal to take a string parameter or change the slot to take an integer parameter.
Here's an example of how to connect a signal to a slot with compatible arguments:
```
QObject::connect(sender, &Sender::valueChanged, receiver, &Receiver::updateValue);
```
In this example, the signal "valueChanged" takes an integer parameter and the slot "updateValue" also takes an integer parameter, so they are compatible. If your code is still giving you the "no matching function for call to widget::connect" error message, double-check the arguments of the signal and the slot to make sure they match.
阅读全文