Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Fixed Aspect Ratio Widgets during Resize

    General and Desktop
    2
    2
    761
    Loading More Posts
    • 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.
    • W
      windyweather last edited by

      I'm trying to fix a widget to 16x9 aspect inside a window that can be resized.
      I've searched the forums and other places and seen lots of discussion of
      int QLayoutItem::heightForWidth ( int w )
      but no complete examples.

      Can someone modify my simple program to show me how to do this?
      Here are the sources built version for LM17.
      http://www.windyweather.net/wp/2014/07/23/qt-fixed-aspect-ratio-resize/
      Thanks,
      ww

      1 Reply Last reply Reply Quote 0
      • Jeroentjehome
        Jeroentjehome last edited by

        Hi,
        The heightForWidth is good to use, you only need to add some spacers along with it to fill the empty space. One horizontal and a vertical one. That should do the trick.
        It is really that simple.

        Greetz, Jeroen

        1 Reply Last reply Reply Quote 0
        • First post
          Last post