没有匹配函数来调用 'QGridLayout::addWidget(QPushButton, int&, int&)

no matching function for call to 'QGridLayout::addWidget(QPushButton, int&, int&)

嘿,我正在给自己写一个游戏,但是我不能把应该代表敌人的小部件放在 QGridLayout 中,我已经在 .h 中定义了一个 QStringList 但是函数忽略了 .h 所以网格和定义上的指针必须在函数内部

错误

E:\QT\Try\mainwindow.cpp:56: 
no matching function for call to 
'QGridLayout::addWidget(QPushButton, int&, int&)'
         Grid->addWidget(QPushButton(Enemy_name),b,i);
                                                    ^

E:\QT\Try\mainwindow.cpp:58: Chyba: 'Enemy_list' was not declared in this scope
         Enemy_list[i]=Enemy_name;
         ^

.h

#include <QMainWindow>
#include <QStringList>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

    int diff;

    QStringList Enemy_list;


private slots:
    void on_actionNewGame_triggered();

    void on_actionLeft_triggered();

    void on_actionRight_triggered();
private:
    Ui::MainWindow *ui;
    void spawn(int diff);
};

.cpp

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include "dialog.h"
    #include <QStringList>

    void MainWindow::on_actionNewGame_triggered()
{
    Dialog mDialog;
    mDialog.setModal(true);
    mDialog.exec();

    switch (mDialog.on_buttonBox_accepted()){
    case 2:
        this->setWindowTitle("A not Quality Ripoff -- Medium");
        spawn(2);
        break;
    case 3:
        spawn(3);
        this->setWindowTitle("A not Quality Ripoff -- Hard");
        break;
    default:
        spawn(1);
        this->setWindowTitle("A not Quality Ripoff -- Easy");
        break;
    }
}
void spawn(int diff){
    Ui::MainWindow *kappa;
    const int row = diff*4;
    int col;
    int x=0;
    switch (diff){
    case 3:
        x=x+10;
    case 2:
        x=x+10;
    default:
        x=x+20;
        col = x/row;
        if (x %row >=1) col++;

        for(int i=0;i<col;i++){
            for(int b=0; b<row;b++){

            QString Enemy_name = "Enemy_n"+QString::number(i*b);

            QGridLayout *Grid = kappa->Enemy;
            Grid->addWidget(QPushButton(Enemy_name),b,i);

            Enemy_list[i]=Enemy_name;
            }
        }
        break;
    }
}

作为初学者,我很乐意提供任何帮助

第一个错误: 将行 Grid->addWidget(QPushButton(Enemy_name),b,i); 更改为 Grid->addWidget(new QPushButton(Enemy_name),b,i);

第二个错误:将行 void spawn(int diff){ 更改为 void MainWindow::spawn(int diff){