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. QSize ratio..
Forum Updated to NodeBB v4.3 + New Features

QSize ratio..

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 590 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.
  • P Offline
    P Offline
    Pada_
    wrote on last edited by
    #1

    When you change from QSize (A, B) to QSize (A + x, B + y), how do you get x, y to get the same percentage of results as the first A and B ratios?

    JKSHJ jsulmJ 2 Replies Last reply
    0
    • P Pada_

      When you change from QSize (A, B) to QSize (A + x, B + y), how do you get x, y to get the same percentage of results as the first A and B ratios?

      JKSHJ Online
      JKSHJ Online
      JKSH
      Moderators
      wrote on last edited by
      #2

      @Pada_ said in QSize ratio..:

      When you change from QSize (A, B) to QSize (A + x, B + y), how do you get x, y to get the same percentage of results as the first A and B ratios?

      Can you give an example, using actual numbers that you want? Your question is unclear.

      Anyway, see if QSize::scale() or QSize::scaled() fits your needs.

      Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

      1 Reply Last reply
      1
      • P Pada_

        When you change from QSize (A, B) to QSize (A + x, B + y), how do you get x, y to get the same percentage of results as the first A and B ratios?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @Pada_ I would say to keep same ratio you need to do: x = ratio * y (because ratio = x / y)
        So, if you want to increase the height by 4 pixels and ratio is 1.5 (3/2) then you need to increase x by 1.5 * 4 = 6
        For example:
        A = 30
        B = 20
        ratio = 3/2 = 1.5
        y = 4
        => x = 1.5 * 4 = 6
        Anew = 36
        Bnew = 24
        36 / 24 = 1.5

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2

        • Login

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