Unsolved 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?
-
@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()
orQSize::scaled()
fits your needs. -
@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