PDA

View Full Version : why there is no maximumSizeHint



manishkyl
13th June 2008, 07:02
i have a qwidget on which i want to do manual layout of child widgets
currenlty whenever the widget's size policies need to change i do setMaximumSize and setMinimumSize

qt has minimumSizeHint for widgets but no maximumSizeHint ... so how can i cache the maximum size like the way it is possible to do with custom layouts

wysota
13th June 2008, 07:29
What do you mean cache the maximum size? maximumSizeHint() would do the same thing as maximumSize() except that it would take into consideration the contents of the widget. You can obtain the same by using setMaximumSize() from within your code. But I'm not sure why would you want to do that... If you control widgets in a custom way, sizeHints are completely ignored and you can set whatever geometry you like using setGeometry().

manishkyl
13th June 2008, 07:38
i have my custom widget which i would put in a layout
i want to reimplement maximumSizeHint (if it was there) like i can reimplement minimumSizeHint

wysota
13th June 2008, 08:08
I still don't understand why would you want to do that in this case... Reimplementing sizeHint and setting the size policy to Maximum should be enough...

manishkyl
13th June 2008, 08:34
i want to communicate three different values (which qt allows for a layout item like qlayout)
sizeHint - preferred size
minimumSizeHint - max size (compromise on higher side)
maximumSizeHint - a min size ((compromise on lower side)

for a widget we have sizeHint, minimumSizeHint and sizePolicy ( and ofcourse non reimplementable minimumSize and maximumSize )

what i dont understand is how the later three can do the work of former three
i want to return a value different from the maximum size from my sizeHint function

wysota
13th June 2008, 10:35
Why don't you use setMaximumSize() to set the maximum size then? What is your exact use-case? Why do you want to constrain all three sizes? I know there have been plans to include maximumSizeHint() but I guess mostly for completeness and not because of real needs...