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. Fixed Aspect Ratio Widgets during Resize
Forum Updated to NodeBB v4.3 + New Features

Fixed Aspect Ratio Widgets during Resize

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 896 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.
  • W Offline
    W Offline
    windyweather
    wrote on last edited by
    #1

    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
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      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
      0

      • Login

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