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

前端 未结 3 869
孤城傲影
孤城傲影 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:11

    You can set stylesheets without QLabel tag:

    setStyleSheet("color:red;");
    

    After setting one stylesheet property, you can add another property like:

    setStyleSheet( styleSheet().append(QString("border-image:url(……);")) );
    

提交回复
热议问题