这个错误是因为在imgShowThread类的构造函数中,第二个参数没有提供默认值。请确保imgShowThread类的构造函数声明中,第二个参数有一个默认值。
例如,在头文件(.h)中:
class imgShowThread : public QObject
{
Q_OBJECT
public:
explicit imgShowThread(QObject *parent = nullptr, QLabel *label = nullptr);
};
在源文件(.cpp)中实现构造函数时,可以给第二个参数提供一个默认值:
imgShowThread::imgShowThread(QObject *parent, QLabel *label)
: QObject(parent), m_label(label)
{
// 构造函数的其他操作...
}
这样做将解决该错误,并允许在创建imgShowThread对象时不传递第二个参数。
内容由零声教学AI助手提供,问题来源于学员提问




