此段代码来自Qt自带screenshot例子
/** descr:创建QPushButton的实例 input:text 按钮上显示的内容;receiver 按钮创建信号槽时的槽对象;member 接受信号的槽 output:void return:创建的QPushButton实例 */ QPushButton *Screenshot::createButton(const QString &text, QWidget *receiver, const char *member) { QPushButton *button = new QPushButton(text); button->connect(button, SIGNAL(clicked()), receiver, member); return button; }
QPushButton *quitScreenshotButton; quitScreenshotButton = createButton(tr("Quit"), this, SLOT(close()));