[Interest] How to use QStyle.sizeFromContents with QStyleOptionFrame?

Tony Rietwyk tony at rightsoft.com.au
Thu Sep 10 03:39:04 CEST 2015


Hi Everybody, 

Using Qt 5.5.0 from installed binaries, in my QFrame based custom widget
sizeHint override I want to have: 

	QSize contentSize = ....;

	QStyleOptionFrame optFrame;
	initStyleOption(&optFrame);
	QSize styleSize = style()->sizeFromContents( QStyle::CT_Frame,
optFrame, contentSize, this );

But of course, CT_Frame doesn't exist!  So how can I make this work?  A
global style sheet is used to produce different frame borders, padding,
background colors, etc.  

Thanks in advance, 

Tony.





More information about the Interest mailing list