Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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 are set by first use of setStyleSheet().

For exmaple,

setStyleSheet("QLabel{color:red;}");

…………

setStyleSheet("QLabel{border-image:url(……)}")

When I set border-image,the red color property lost.

I tried to solve it by using

setStyleSheet(styleSheet()+QString("QLabel{border-image:url(……)}"));

but it was the same that only the border-image property existed.

Must I add every style property when I use setStyleSheet(),although that I set it before.

Thanks for bearing my poor written English.Any tips will be appreciated.