QPushButton 一组中凸显选中的一个,且只能选中一个。
QButtonGroup * buttonGroup = new QButtonGroup(this); buttonGroup->setExclusive(true); ui->pushButton_Confirm->setCheckable(true); ui->pushButton_Reset->setCheckable(true); buttonGroup->addButton(ui->pushButton_Confirm); buttonGroup->addButton(ui->pushButton_Reset); QPushButton#pushButton_Confirm, QPushButton#pushButton_Reset { background-color:rgba(4, 124, 123, 1); font-size:14px; color:rgba(255, 255, 255, 1); min-height: 40px; border:0px solid; } QPushButton#pushButton_Confirm:hover, QPushButton#pushButton_Reset:hover, QPushButton#pushButton_Confirm:pressed, QPushButton#pushButton_Reset:pressed, QPushButton#pushButton_Confirm:checked, QPushButton#pushButton_Reset:checked{ background-color:rgba(10, 91, 93, 1); }