summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Simon Moeller <jsmoeller@linuxfoundation.org>2018-08-02 14:42:12 +0000
committerGerrit Code Review <gerrit@automotivelinux.org>2018-08-02 14:42:12 +0000
commite1877c0c7c2add1dba21e64394ba06365c796edd (patch)
tree6d44196a395dc635fc97a555d688afcc13d7115a
parent69d5406160655c6b74ef2bd25a5d2ef31bea5c1f (diff)
parent83c4034d6374eb8b6d5a72c053c7e774cd6c3ffc (diff)
Merge "Improve output of multiple screen resolution"
-rw-r--r--launcher/qml/Launcher.qml42
-rw-r--r--launcher/src/main.cpp9
2 files changed, 28 insertions, 23 deletions
diff --git a/launcher/qml/Launcher.qml b/launcher/qml/Launcher.qml
index ccca186..6caad1e 100644
--- a/launcher/qml/Launcher.qml
+++ b/launcher/qml/Launcher.qml
@@ -16,33 +16,38 @@
* limitations under the License.
*/
import QtQuick 2.6
+import QtQuick.Window 2.1
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.0
import AppModel 1.0
-ApplicationWindow {
- id: root
- // Layout.fillWidth: true
- // Layout.fillHeight: true
- // width: 1080
- // Layout.preferredHeight: 1487
+Window {
+ visible: true
+ flags: Qt.FramelessWindowHint
+ width: container.width * container.scale
+ height: container.height * container.scale
property int pid: -1
- Image {
- y: 218
+
+ Item {
+ id: container
anchors.centerIn: parent
- source: './images/AGL_HMI_Blue_Background_Car-01.png'
- }
+ width: 1080
+ height: 1487
+ scale: screenInfo.scale_factor()
+ Image {
+ anchors.centerIn: parent
+ source: './images/AGL_HMI_Blue_Background_Car-01.png'
+ }
GridView {
id: grid
- x: 60
- y: 100
- width: 960
- height: 1280
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
+ anchors {
+ topMargin: 60; bottomMargin: 0
+ leftMargin: 60; rightMargin: 60
+ fill: parent
+ }
contentHeight: 320
flickableDirection: Flickable.AutoFlickDirection
snapMode: GridView.SnapOneRow
@@ -65,10 +70,6 @@ ApplicationWindow {
property int index: grid.indexAt(loc.mouseX, loc.mouseY)
x: 62
y: 264
- anchors.rightMargin: 0
- anchors.bottomMargin: 0
- anchors.leftMargin: 0
- anchors.topMargin: 0
onPressAndHold: currentId = applicationModel.id(newIndex = index)
onReleased: {
if (currentId === '') {
@@ -92,3 +93,4 @@ ApplicationWindow {
}
}
}
+}
diff --git a/launcher/src/main.cpp b/launcher/src/main.cpp
index ea3ed74..91a1d80 100644
--- a/launcher/src/main.cpp
+++ b/launcher/src/main.cpp
@@ -100,6 +100,8 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
+ AGLScreenInfo screenInfo(layoutHandler->get_scale_factor());
+
if (layoutHandler->requestSurface(myname) != 0) {
exit(EXIT_FAILURE);
}
@@ -156,9 +158,10 @@ int main(int argc, char *argv[])
// mail.qml loading
QQmlApplicationEngine engine;
- engine.rootContext()->setContextProperty("layoutHandler", layoutHandler);
- engine.rootContext()->setContextProperty("homescreenHandler", homescreenHandler);
- engine.rootContext()->setContextProperty("launcher", launcher);
+ engine.rootContext()->setContextProperty(QStringLiteral("layoutHandler"), layoutHandler);
+ engine.rootContext()->setContextProperty(QStringLiteral("homescreenHandler"), homescreenHandler);
+ engine.rootContext()->setContextProperty(QStringLiteral("launcher"), launcher);
+ engine.rootContext()->setContextProperty(QStringLiteral("screenInfo"), &screenInfo);
engine.load(QUrl(QStringLiteral("qrc:/Launcher.qml")));
QObject *root = engine.rootObjects().first();