This commit is contained in:
erinn 2019-09-25 10:26:45 -07:00
parent 077ef4cc11
commit b03846f1a2
3 changed files with 11 additions and 9 deletions

View File

@ -42,8 +42,10 @@ func main() {
qmlSource = core.NewQUrl3("qrc:/qml/main.qml", 0)
}
core.QCoreApplication_SetAttribute(core.Qt__AA_Use96Dpi, true)
core.QCoreApplication_SetAttribute(core.Qt__AA_EnableHighDpiScaling, false)
app := gui.NewQGuiApplication(len(os.Args), os.Args)
core.QCoreApplication_SetAttribute(core.Qt__AA_EnableHighDpiScaling, true)
//QApplication::setAttribute(Qt::AA_Use96Dpi);
quickcontrols2.QQuickStyle_SetStyle("Default")
engine := qml.NewQQmlApplicationEngine(nil)

View File

@ -28,9 +28,9 @@ ColumnLayout {
background: Rectangle {
radius: 2
implicitWidth: root.width
implicitHeight: ptToPx(sec.intbase)
//color: windowItem.cwtch_background_color
//implicitWidth: root.width
//implicitHeight: ptToPx(sec.intbase)
color: "#DDDDFF"
border.color: "#000000"
}
}
@ -53,9 +53,9 @@ ColumnLayout {
background: Rectangle {
radius: 2
implicitWidth: root.width
implicitHeight: ptToPx(sec.realbase)
//color: windowItem.cwtch_background_color
//implicitWidth: root.width
//implicitHeight: ptToPx(sec.realbase)
color: "#DDDDFF"
border.color: "#000000"
}
}

View File

@ -18,11 +18,11 @@ ApplicationWindow {
}
function ptToPx(pt) {
return Screen.pixelDensity * 25.4 * pt / 72
return Screen.pixelDensity * 25.4 * Math.round(pt) / 72
}
function pxToPt(px) {
return px * 72 / (Screen.pixelDensity * 25.4)
return Math.round(px) * 72 / (Screen.pixelDensity * 25.4)
}
ColumnLayout {