#include<QApplication> 
#include<QLabel> 
#include<QPushButton> 
#include<QHBoxLayout> 
#include<QSlider> 
void setLabel(QLabel *label); 
int main(int argc,char *argv[]) 
{ 
QApplication app(argc,argv); 
QWidget *window=new QWidget; 
window->setWindowTitle("WINDOWS窗口");//创建主窗体 
QHBoxLayout *layout=new QHBoxLayout; 
QLabel *label=new QLabel("<h2><i><font color=red>Hello</font></i></h2>");//子窗体 
QPushButton *btn=new QPushButton("click me!");//子窗体 
//QObject::connect(btn,SIGNAL(clicked()),&app,SLOT(quit())); 
QObject::connect(btn,SIGNAL(clicked()),label,SLOT(setLabel(QLabel *))); 
layout->addWidget(label); 
layout->addWidget(btn); 
window->setLayout(layout); 
window->show(); 
return app.exec(); 
} 
//我想实现点击按钮后,标签的字体变成 changed.可惜不行。。。我知道是局部变量的问题。请问有什么办法实现? 
void setLabel(QLabel *label) 
{ 
label->setText("changed"); 
label->setVisible(false); 
}