[Qt-interest] setSizePolicy has no effect in subclass of QDialog
Stephen Collyer
scollyer at netspinner.co.uk
Tue Jun 2 16:08:36 CEST 2009
2009/6/2 Farid Derradji <farid.derradji at itwm.fraunhofer.de>
> Hello Stephen,
>
> > I don't understand what you mean by the final sentence above.
> > Could you expand on this ?
>
> what I mean is the following:
>
> every control inside a layout has to exactly tell how it wishes to be
> arranged. And this is achieved via size policies.
>
OK, but surely you're not suggesting that I set the size policy separately
for each widget inside the layout ? It seems to me that the height
restriction
should be done on either the outermost widget or the outermost layout
somehow - then the inner widgets won't have to respond to inappropriate
resize events.
> I've found a way to achieve what I want in designer: if you click
> on the form background, there is a context menu "Size constraints"
> from which you can set min/max height/width. If you reduce the design
> form to its maximum desired height, and set "Size Constraints"->
> "Set Maximum Height", then the dialog cannot be resized vertically.
I think that here you *statically* restricted the maximum size (or
> minimum size respectively).
That's right - however, I can find any other way of doing it at the moment.
> Does your dialog really properly react now
> if one of your sub controls changes in size (e.g. due to a font change)?
>
Good question, and I suspect that answer is no, but given that
I can find no other way of achieving the result ..
>
> And, by the way, wouldn't it be better to use QLayout::minimumSize ()
> instead ?
>
You mean QWidget::setMaximumSize() ? If so, this is exactly what
designer is using:
EditServerDialog->setMaximumSize(QSize(16777215, 211));
--
Stephen Collyer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090602/aece4b8f/attachment.html
More information about the Qt-interest-old
mailing list