Determining Qt stylesheet options programmatically?

前端 未结 2 704
挽巷
挽巷 2021-01-18 00:25

Is it possible to look up stylesheet values at runtime in Qt?

I\'m working on a custom button derived from QPushButton that has some stylesheet properti

2条回答
  •  太阳男子
    2021-01-18 00:43

    Internally, when you call QApplication::setStyleSheet() Qt creates a QStyle sub-class called QStyleSheetStyle.

    That means you can query style sheet information via the normal QStyle methods. Just remember to fill in the options and widget parameters properly to ensure you get the right values from the style sheet.

提交回复
热议问题