Results 1 to 6 of 6

Thread: why there is no maximumSizeHint

  1. #1
    Join Date
    Jun 2008
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question why there is no maximumSizeHint

    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

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: why there is no maximumSizeHint

    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().

  3. #3
    Join Date
    Jun 2008
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: why there is no maximumSizeHint

    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

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: why there is no maximumSizeHint

    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...

  5. #5
    Join Date
    Jun 2008
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: why there is no maximumSizeHint

    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

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: why there is no maximumSizeHint

    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...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.