我有
class MainWindow : public QMainWindow {
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void getData();
private:
Ui::MainWindow *ui;
Dialog *second;
};
和
class Dialog: public QDialog {
Q_OBJECT
public:
explicit Dialog(QWidget *parent = 0); QDialog * dialog;
QPushButton *pushButton;
QPushButton *pushButton_2;
};
我可以将 Dialog 类中的按钮与 MainWindow 类中的函数 getData() 连接起来(Dialog 是 Mainwindow 类的子类)
我试过了
connect(*second->pushButton, SIGNAL(clicked()), this,
SLOT(getData()));
但我得到了
error: no matching function for call to
‘MainWindow::connect(QPushButton&, const char [11], MainWindow* const, const char [11])’
我如何连接它们?