0

The application I am working on uses QToolButtons as simple elements in a layout and as QActions added to QToolBars. I would like to apply a style on all the QToolButtons in my application except the ones within a QToolBar. I saw that I can set a style on all QToolButtons with the entry:

QToolButton{ background-color: rgb(255, 0, 0); }

And I can apply a style for all the QToolButtons inside a QToolBar using:

QToolBar > QToolButton { background-color: rgb(0, 255, 0); }

But how can I perform the required styling without adding a style entry for the buttons in QToolBar, so that they would still have the default styling?

sajas
  • 1,599
  • 1
  • 17
  • 39
  • See this: [How to set stylesheet for multiple buttons but not all](https://stackoverflow.com/questions/69553926/how-to-set-stylesheet-for-multiple-buttons-but-not-all), where this [answer](https://stackoverflow.com/a/72488168/17726418) implements this: [Customizing Using Dynamic Properties](https://doc.qt.io/qt-6/stylesheet-examples.html#customizing-using-dynamic-properties), in Qt Designer. – Abderrahmene Rayene Mihoub Jun 30 '23 at 16:14

0 Answers0