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. Resizing Height and Width of widget while keeping aspect ratio
Forum Updated to NodeBB v4.3 + New Features

Resizing Height and Width of widget while keeping aspect ratio

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 853 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.
  • B Offline
    B Offline
    bearsomg
    wrote on last edited by
    #1

    I've seen many topics about keeping the aspect ratio of a widget constant when resizing it, but none that seem to cover resizing both the width and height.

    So far I overrode the heightForWidth method to return the width scaled by the aspect ratio, and this works as expected. However, this will only work when the window's aspect ratio is smaller than the wanted widge aspect ratio, since it uses width as the calculation. As such, when the width of the window is too wide, the widget will fill up the entire window, presumably increasing in height, when the width should be remaining constant.

    Basically, I need the end result of this to be the widget retaining its aspect ratio regardless of whether the aspect ratio of the window is greater or smaller than the wanted aspect ratio. What would be thhe correct way to do this?

    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