Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.11
- import QtQuick.Window 2.2
- Item {
- anchors.fill: parent
- readonly property real bg_width: 2280.
- readonly property real bg_height: 1440.
- readonly property real refWidth: 480 * (bg_width/570) /*1920.*/
- readonly property real refHeight: 320 * (bg_height/360) /*1280.*/
- readonly property real refDpi: 72.
- readonly property int dpi: Screen.pixelDensity * 25.4 // 1 дюйм = 25.4 мм
- readonly property real ratio: Math.min(height/refHeight1(), width/refWidth1())
- property real ratioFont: Math.min(height*refDpi/(dpi*refHeight), width*refDpi/(dpi*refWidth));
- function refWidth1() {
- return (width > height) ? refWidth : refHeight;
- }
- function refHeight1() {
- return (width > height) ? refHeight : refWidth;
- }
- Component.onCompleted: {
- if (ratioFont < 1.)
- ratioFont = 1.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement