[Qt-interest] setSizePolicy has no effect in subclass of QDialog

Tony Rietwyk tony.rietwyk at rightsoft.com.au
Tue Jun 2 17:06:57 CEST 2009


Stephen wrote:

2009/6/2 Tony Rietwyk <tony.rietwyk at rightsoft.com.au> 




Do you have a layout within the dialog?  In that case, sizePolicy doesn't apply.  To get the dialog to size according to its contents, have a look at QLayout::setSizeConstraint( QLayout::SetFixedSize ).  Though, I suspect this will affect both directions, not just vertically.  




Yes, I have a grid layout inside the dialog, which I created via designer.
Why does this mean that sizePolicy doesn't apply ? 
 

Because that's what the QWidget sizePolicy property doco says! 
 
If there is a QLayout <outbind://68/qlayout.html>  that manages this widget's children, the size policy specified by that layout is used. If there is no such QLayout <outbind://68/qlayout.html> , the result of this function is used.

Regards, 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090603/925f2202/attachment.html 


More information about the Qt-interest-old mailing list