QT 图片按钮

//设置按钮样式
    pushButton=new QPushButton(this);
    pushButton->setGeometry(65,370,130,66);  	//位置和大小
    pushButton->setFocusPolicy(Qt::NoFocus);	//不聚焦在此按钮上
    connect(pushButton,SIGNAL(clicked()),this,SLOT(pushButton_clicked()));	//绑定事件
    pushButton->setStyleSheet("QPushButton{border-image: url(:/new/prefix2/pushbutton1/asj.bmp);}"		//设置效果
                              "QPushButton:hover{border-image: url(:/new/prefix2/pushbutton1/asj1.bmp);}"	//鼠标放在上面的效果
                              "QPushButton:pressed{border-image: url(:/new/prefix2/pushbutton1/asj1.bmp);}");	//按下去的效果

你可能感兴趣的:(QT)