Browse Source

fixes

master
erinn 3 years ago
parent
commit
b03846f1a2
  1. 4
      main.go
  2. 12
      qml/TestRow.qml
  3. 4
      qml/main.qml

4
main.go

@ -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)

12
qml/TestRow.qml

@ -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"
}
}

4
qml/main.qml

@ -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 {

Loading…
Cancel
Save