How to add style via setStyleSheet() without losing orignal style in Qt?

前端 未结 3 842
孤城傲影
孤城傲影 2021-01-12 01:26

I Konw I can use setStyleSheet() to set style in Qt.But I encountered a problem,when I used setStyleSheet() twice first styles lost,which a

3条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-12 02:12

    By using double column for the second entry.

    ui->pushButton_2->setStyleSheet(
                "QPushButton{background-color:red;color:white}\
                 QPushButton::hover{color:black}");
    

提交回复
热议问题