Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2020
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. import QtQuick 2.11
  2. import QtQuick.Window 2.2
  3.  
  4. Item {
  5. anchors.fill: parent
  6. readonly property real bg_width: 2280.
  7. readonly property real bg_height: 1440.
  8. readonly property real refWidth: 480 * (bg_width/570) /*1920.*/
  9. readonly property real refHeight: 320 * (bg_height/360) /*1280.*/
  10. readonly property real refDpi: 72.
  11. readonly property int dpi: Screen.pixelDensity * 25.4 // 1 дюйм = 25.4 мм
  12. readonly property real ratio: Math.min(height/refHeight1(), width/refWidth1())
  13. property real ratioFont: Math.min(height*refDpi/(dpi*refHeight), width*refDpi/(dpi*refWidth));
  14.  
  15. function refWidth1() {
  16. return (width > height) ? refWidth : refHeight;
  17. }
  18. function refHeight1() {
  19. return (width > height) ? refHeight : refWidth;
  20. }
  21.  
  22. Component.onCompleted: {
  23. if (ratioFont < 1.)
  24. ratioFont = 1.
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement