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. Relation between size policies, setting fixed size, and setting minimum size of widgets
Forum Updated to NodeBB v4.3 + New Features

Relation between size policies, setting fixed size, and setting minimum size of widgets

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 351 Views 1 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.
  • F Offline
    F Offline
    fire121
    wrote on last edited by
    #1

    I'm wondering about the behavior and the relationship between Qwidget's setSizePolicy and setFixedSize methods (and of course the other setting width and height methods).

    (all the following numbers are pixels)
    for example, I tried in the designer setting the size policy of a widget (Qlabel) to be expanding and at the same time set its fixed size using the setFixedSize method (to some size) - When I run the widget I've seen that I can shrink it as much as I want and on the other way I can stretch it as much as I want, So what is the impact or the meaning of using setFixedSize together with expanding policy?

    For another example, I set the Minimum width of the Qlabel to 800 and fixed horizontal size policy, and set the minimum size of the form holding this Qlabel to 200 with expanding horizontal size policy, when I played with the form I have been able to shrink it far more than 800 (Qlabel almost disappeared) but couldn't shrink it more than 200, So what is the significance of setting the minimum size of Qlabel in this case?

    The last example, I had another Qlabel with a fixed height set to 40 and it was placed on a form with some other widgets, when I set it's vertical policy to Minimum expanding it enlarged the height of the form, with lots of empty space between it and the other elements preceding it (above it), with no reason - like I said, just lot of empty space. But when I changed the size policy to Fixed it got to be ok, it was placed Immediately (with some margin) after the preceding widgets of that form, below them. So the question is, why does setting its size policy to minimum expanding cause this waste of space when the fixed size is defined as only 40? why does the form grows so much and not just by the size of the widgets + it's margins?

    Thank you in advance!

    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