QT-按钮风格+QPushButton样式:
根据以下步骤设置PushButton属性:
![在这里插入图片描述](https://img-blog.csdnimg.cn/
QPushButton{color: rgb(00, 00, 00);background:rgb(255, 255, 255);border:0px solid grey; border-radius: 6px;}
QPushButton:hover{border-color:rgb(82, 146, 254);background:rgb(240, 240, 240);}
QPushButton:pressed{border-color:gray;background:rgb(82, 146, 254);}
按钮样式设置,按下(pressed)时按钮颜色不变化,选中其他按键时才改变颜色:
在红色方框中添加相应的代码就看实现
void MainWindow::on_pButOnLine_clicked()
{
this->ui->stackedWidget->setCurrentIndex(0);
this->ui->pButOffLine->setDown(false);
this->ui->pButOnLine->setDown(true);
}
void MainWindow::on_pButOffLine_clicked()
{
this->ui->stackedWidget->setCurrentIndex(1);
this->ui->pButOffLine->setDown(true);
this->ui->pButOnLine->setDown(false);
}
在红色方框中添加相应的代码的现象