QT QSS selector by part of the ID

Viewed 211

I can apply QSS to a QPushButton like this, by ID or all QPushButton's (with no #ID at all).

QPushButton#BTN_A{
  background-color: white; 
  color: #659D32;
  border: 1px solid #659D32;
  font-size: 14px; 
}

QPushButton{
  background-color: white; 
  color: #659D32;
  border: 1px solid #659D32;
  font-size: 14px; 
}

However I'd like to apply the QSS to all buttons that start with #BTN

In CSS it would be something like:

div[class*="test"] {
   background: #ffffff;
}

I've tried QPushButton#BTN*, QPushButton#BTN^* At the moment I'm not even sure if it's possible.

1 Answers

The correct syntax is

QPushButton[objectName*="BTN"]
Related