From b03846f1a2a6d3fb7fed85717996821463cec118 Mon Sep 17 00:00:00 2001 From: erinn Date: Wed, 25 Sep 2019 10:26:45 -0700 Subject: [PATCH] fixes --- main.go | 4 +++- qml/TestRow.qml | 12 ++++++------ qml/main.qml | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/main.go b/main.go index 07ba723..14a31ee 100644 --- a/main.go +++ b/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) diff --git a/qml/TestRow.qml b/qml/TestRow.qml index dae87ff..6cb2245 100644 --- a/qml/TestRow.qml +++ b/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" } } diff --git a/qml/main.qml b/qml/main.qml index 3c7ac62..6ae3713 100644 --- a/qml/main.qml +++ b/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 {