The compilation error is that you are trying to pass QSizePolicy::Policy to setSizePolicy(QSizePolicy) , but there is no implicit conversion from QSizePolicy::Policy (which is the policy for one dimension) to QSizePolicy (which is a class containing, among other things, one Policy per size (height, width)). However, QSizePolicy does not work on top-level widgets (windows).
setFixedSize() only works if you know the size of the dialog box in advance (and usually you donβt do this, which changes the font size and languages). You can do
window()->setFixedSize( window()->sizeHint() );
but much better to use
window->layout()->setSizeConstraint( QLayout::SetFixedSize );
This allows the layout to determine the size of the dialog box, but does not allow you to change the size that I assume is what you are asking for.
Marc Mutz - mmutz Jul 20 '09 at 5:42 2009-07-20 05:42
source share