no matching function for call to‘Widget::Widget ()’
时间: 2024-05-04 13:19:43 浏览: 14
这个错误通常是因为您的代码中存在一个没有参数的 `Widget` 构造函数的调用,但是您的 `Widget` 类中并没有定义这样的构造函数。
解决方法可能有两种:
1. 在 `Widget` 类中添加一个没有参数的构造函数:
```cpp
class Widget {
public:
Widget() { /* 构造函数的实现 */ }
// ...
};
```
2. 修改您的代码,使其调用 `Widget` 类中已经定义的构造函数。
如果您需要更具体的帮助,请提供更多的代码和错误信息。
相关问题
no matching function for call to widget::connect
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.
D:\qtwenjian\qtranjiahui1\qtchuankou\Temperature_display\widget.cpp:154: error: no matching function for call to Widget::insert_table(QString\\&, QString\\&) insert_table(date,tempe);
这个错误是因为在 Widget 类的 insert_table 函数中传入了错误的参数类型。根据错误信息来看,insert_table 函数期望的参数类型是 QString&,而实际传入的参数类型是 QString。可能的原因是在调用 insert_table 函数时没有使用引用(&)符号。你可以在调用 insert_table 函数时,将参数加上引用符号,即:
insert_table(QString& date, QString& tempe);
这样就能够正确地匹配函数的参数类型了。