btse
btse

Reputation: 8021

Access font of widget that was set using application wide stylesheet

I have an issue where I am setting the font for all QLineEdit's in my application by setting the stylesheet on the global qApp object, but the returned QFont object of a newly created QLineEdit does not reflect the font that I have set in the stylesheet. I am attempting to use the QFont to set some QFontMetrics. Does anyone know how to do this properly?

Upvotes: 1

Views: 123

Answers (1)

btse
btse

Reputation: 8021

Found the answer on my own.

Calling QWidget::ensurePolished() updates the widget's QStyle to reflect what has been set in the stylesheet.

Upvotes: 3

Related Questions