From: Tadao Tanikawa Date: Thu, 2 Aug 2018 13:11:33 +0000 (+0000) Subject: Improve output of multiple screen resolution X-Git-Tag: 5.99.3~1 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fheads%2Fsandbox%2Fruke47%2Fflounder_RPi3;p=apps%2Fmixer.git Improve output of multiple screen resolution To improve output on various monitor with various resolution, use scale_factor from WM to fit various screen resolution. Change-Id: I5ef4d54712e405744a9c9d2a369fbb2d0d31716d Signed-off-by: Tadao Tanikawa --- diff --git a/app/Mixer.qml b/app/Mixer.qml index 0588b77..73587a5 100644 --- a/app/Mixer.qml +++ b/app/Mixer.qml @@ -28,6 +28,8 @@ ApplicationWindow { // ----- Setup id: root + width: container.width * container.scale + height: container.height * container.scale // ----- Childs Mixer { @@ -93,19 +95,27 @@ ApplicationWindow { } } - Label { - id: title - font.pixelSize: 48 - text: "Mixer" - anchors.horizontalCenter: parent.horizontalCenter - } + Item { + id: container + anchors.centerIn: parent + width: 1080 + height: 1487 + scale: screenInfo.scale_factor() + + Label { + id: title + font.pixelSize: 48 + text: "Mixer" + anchors.horizontalCenter: parent.horizontalCenter + } - ColumnLayout { - id: sliders - anchors.margins: 80 - anchors.top: title.bottom - anchors.left: parent.left - anchors.right: parent.right + ColumnLayout { + id: sliders + anchors.margins: 80 + anchors.top: title.bottom + anchors.left: parent.left + anchors.right: parent.right + } } } diff --git a/app/main.cpp b/app/main.cpp index 52a0ff9..b8ef25a 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -81,6 +81,8 @@ int main(int argc, char *argv[]) if(qwm->init(port,secret) != 0){ exit(EXIT_FAILURE); } + AGLScreenInfo screenInfo(qwm->get_scale_factor()); + engine.rootContext()->setContextProperty(QStringLiteral("screenInfo"), &screenInfo); // Request a surface as described in layers.json windowmanager’s file if (qwm->requestSurface(myname) != 0) { exit(EXIT_FAILURE);