PDA

View Full Version : sizeHint() and heightForWidth(int) problem



nifei
12th March 2009, 03:53
Hi, all,
I called QWidget::sizeHint() and heightForWidth(int) each time before the widget is shown and met a strange problem. I got different sizes the 1st time and 2nd time, and then get the same value each time, just except the first sizeHint(). Same issue exists in heightForWidth(int w). I don't know why. and this makes it look weird since for the first time the widget is much bigger than other times.

BTW: i put the widget in a QGrphicsProxyWidget in a QGraphicsScene, does this effect its sizeHint?

wysota
12th March 2009, 14:36
Maybe the widget was not yet polished when you asked for its sizeHint()? You may call QWidget::ensurePolished() before doing that to make sure the widget is setup properly.