0

I want to change all the button instances stylesheets of a widget, much like this question I found (Change Qt Stylesheet for all Instances of a Widget), however, I want to have a theme button so there is multiple stylesheets that I want to use in this manor.

In the example it changes all the button stylesheets on start up, I want to be able to do that within a function.

Any advice as to achieve this?

  • The concept is the same, `app.setStyleSheet(...)`, if you want it more consistent and correct, use `QApplication.instance()` instead of `app`. – musicamante Sep 20 '21 at 18:25
  • so if i went and did something like: app = QApplication.instance(); app.setStyleSheet(...); I'd work? (Cant test it now) – CrispyCassowary Sep 21 '21 at 12:57
  • There's no point in creating a local variable if you're not using it again, just do as said, use `QApplication.instance()` *instead* of app: `QApplication.instance().setStyleSheet(...)`. – musicamante Sep 21 '21 at 12:59
  • Ill be using it multiple times in certain cases. But thanks. – CrispyCassowary Sep 21 '21 at 13:56

0 Answers0