小弟刚学QT,看到signal和 solt的时候,写了个例子,却总是编译不过,请教大家,代码如下.
.#include <QApplication>
#include <QPushButton>
#include <QMessageBox>
class Mybox
{
Q_OBJECT
public slots:
void popup();
};
void Mybox::popup()
{
QMessageBox msgBox;
msgBox.setText("Hello,world");
msgBox.exec();
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton *button = new QPushButton("Quit");
Mybox* box = new Mybox;
QObject::connect(button, SIGNAL(clicked()),
box, SLOT(popup()));
button->show();
return app.exec();
}