Porting Qt stylesheets app to a QStyle based one

51 views Asked by At

According to Say No to Qt Style Sheets, "QStyle subclass is overall a much better solution for styling widgets than is Qt Style Sheets".

I've encountered some difficulties during porting my stylesheet app to a QStyle-ed one. The main question is: what is the way to define a class of a style for multiple widgets? For example, I have a stylesheet:

QLabel.Number { 
    border: 2px solid red; 
    border-radius: 8px;
    background: lightyellow; 
    color: red;
}

and each QLabels widget can get this style through

widget.setProperty("class", "Number");

How to realize this technique with QStyle approach?

0

There are 0 answers