Qt中如何使鼠标左键在PushButton中失效

2024-11-29 11:59:38
推荐回答(2个)
回答1:

//重写这个函数
void mousePressEvent(QMouseEvent *event){
if (event->button() == Qt::LeftButton)
{
return;
}else{
QPushButton::mousePressEvent(event);

}
}

回答2:

ui->Pushbutton->enable(false);