invalid conversionfrom‘int’to‘QWidget
时间: 2024-05-29 17:10:12 浏览: 66
This error message usually occurs when you try to pass an integer value as an argument to a function that expects a QWidget object.
For example, if you have a function that takes a QWidget object as an argument:
void myFunction(QWidget* widget);
And you try to call it with an integer argument:
int myInteger = 10;
myFunction(myInteger);
You will get the "invalid conversion from 'int' to 'QWidget'" error message.
To fix this error, you need to pass a QWidget object instead of an integer. You can create a QWidget object and pass it to the function:
QWidget* myWidget = new QWidget();
myFunction(myWidget);
Or if you have a QWidget object already, you can pass it directly:
QWidget* myWidget = ...;
myFunction(myWidget);
Make sure that the argument you are passing to the function is of the correct data type.
阅读全文