qmltest/qml/main.qml

50 lines
1.2 KiB
QML
Raw Normal View History

2019-09-18 19:38:51 +00:00
import QtGraphicalEffects 1.0
import QtQuick 2.7
import QtQuick.Controls 2.4
import QtQuick.Controls.Material 2.0
import QtQuick.Layouts 1.3
import QtQuick.Window 2.11
import QtQuick.Controls.Styles 1.4
import QtQuick.Controls 1.4
ApplicationWindow {
id: windowItem
width: 1200
height: 800
visible: true
title: "qmltest"
style: ApplicationWindowStyle {
background: Rectangle { color: "#FFFFFF"; anchors.fill: parent; }
}
function ptToPx(pt) {
2019-09-25 17:26:45 +00:00
return Screen.pixelDensity * 25.4 * Math.round(pt) / 72
2019-09-18 19:38:51 +00:00
}
function pxToPt(px) {
2019-09-25 17:26:45 +00:00
return Math.round(px) * 72 / (Screen.pixelDensity * 25.4)
2019-09-18 19:38:51 +00:00
}
ColumnLayout {
id: col
property real scale: 1.5
Text { text: "Screen.pixelDensity: " + Screen.pixelDensity + ", col.scale: " + col.scale}
Slider {
id: zoomSlider
minimumValue: 0.5
maximumValue: 4.0
value: col.scale
updateValueWhileDragging: true
onValueChanged: {
col.scale = zoomSlider.value
}
width: 400
}
TestRow { realbase: 10 * col.scale }
TestRow { realbase: 16 * col.scale }
TestRow { realbase: 24 * col.scale }
TestRow { realbase: 36 * col.scale }
TestRow { realbase: 48 * col.scale }
2019-09-18 19:38:51 +00:00
}
}