Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Purpose of sizeHint() and minimumSizeHint() ? (solved)
Forum Updated to NodeBB v4.3 + New Features

Purpose of sizeHint() and minimumSizeHint() ? (solved)

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 9.4k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    houmingc
    wrote on last edited by houmingc
    #1

    What is the purpose of sizeHint() and minimumSizeHint() ?
    I see it often in widget class
    QSize LED ::sizeHint() const{
    return QSize(diamX_ , diamY_);
    }

    QSize LED ::minimumSizeHint() const {
    return QSize(diamX_, diamY_);
    }

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      sizeHint : const QSize
      This property holds the recommended size for the widget.

      minimumSizeHint : const QSize
      This property holds the recommended minimum size for the widget.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        houmingc
        wrote on last edited by houmingc
        #3

        So which function takes precedence? sizeHint or minimumSizeHint
        Or user have to explicitly call either function?

        mrjjM 1 Reply Last reply
        0
        • H houmingc

          So which function takes precedence? sizeHint or minimumSizeHint
          Or user have to explicitly call either function?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @houmingc

          hi
          Both are used
          When the widget is created the system uses sizeHint for how to big to make at start.
          When the widget is resized ( by layout, by user dragging) the minimumSizeHint is used to
          make sure it never becomes smaller than that.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved