From b9dd6a363e6eb6006ff5f923b6847b8046a245c2 Mon Sep 17 00:00:00 2001 From: Samuli Piippo Date: Tue, 9 May 2017 13:28:39 +0300 Subject: Create the cluster view directly to the second display The 'screen' QML property was introduced in Qt 5.9 and enables to create component directly to the correct screen, instead of moving it afterwards. Needed to support multiple displays in Intel NUC with KMS. Other fixes included to work correctly with latest appman. Task-number: AUTOSUITE-111 Change-Id: Ib0bb0b271a8ddfd01af795e7c94053bed0e6cc52 Reviewed-by: Katja Marttila --- CenterConsole/plugins/screenManager/screenmanager.cpp | 8 ++++++-- CenterConsole/plugins/screenManager/screenmanager.h | 4 ++-- Main.qml | 4 ++-- imports/shared/utils/Style.qml | 4 ++-- kms_config.json | 1 - scripts/automotivedemo.service | 2 +- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CenterConsole/plugins/screenManager/screenmanager.cpp b/CenterConsole/plugins/screenManager/screenmanager.cpp index 06bc4dc..c663567 100644 --- a/CenterConsole/plugins/screenManager/screenmanager.cpp +++ b/CenterConsole/plugins/screenManager/screenmanager.cpp @@ -49,9 +49,13 @@ void ScreenManager::setScreen(QWindow *window, int screen) } } -QList ScreenManager::availableScreens() const +QList ScreenManager::availableScreens() const { - return QGuiApplication::screens(); + QList list; + for (QScreen *screen : QGuiApplication::screens()) + list.append(screen); + + return list; } int ScreenManager::screenCount() const diff --git a/CenterConsole/plugins/screenManager/screenmanager.h b/CenterConsole/plugins/screenManager/screenmanager.h index b12f860..9641b84 100644 --- a/CenterConsole/plugins/screenManager/screenmanager.h +++ b/CenterConsole/plugins/screenManager/screenmanager.h @@ -38,14 +38,14 @@ class ScreenManager : public QObject { Q_OBJECT - Q_PROPERTY(QList availableScreens READ availableScreens NOTIFY availableScreensChanged) + Q_PROPERTY(QList availableScreens READ availableScreens NOTIFY availableScreensChanged) public: explicit ScreenManager(QObject *parent = 0); Q_INVOKABLE int screenCount() const; Q_INVOKABLE void setScreen(QWindow * window, int screen); - QList availableScreens() const; + QList availableScreens() const; signals: void availableScreensChanged(); diff --git a/Main.qml b/Main.qml index 68e2b1d..f676117 100644 --- a/Main.qml +++ b/Main.qml @@ -40,7 +40,7 @@ import QtQuick 2.1 -import QtQuick.Window 2.1 +import QtQuick.Window 2.3 import QtApplicationManager 1.0 import com.pelagicore.ScreenManager 1.0 import utils 1.0 @@ -99,6 +99,7 @@ Rectangle { height: 720 width: 1920 visible: false + screen: Qt.application.screens[1] color: "black" @@ -106,7 +107,6 @@ Rectangle { Component.onCompleted: { WindowManager.registerCompositorView(cluster) - ScreenManager.setScreen(cluster, 1) cluster.show() } } diff --git a/imports/shared/utils/Style.qml b/imports/shared/utils/Style.qml index cc6f4ec..9ef1b39 100644 --- a/imports/shared/utils/Style.qml +++ b/imports/shared/utils/Style.qml @@ -97,8 +97,8 @@ QtObject { property url fonts: Qt.resolvedUrl('../assets/fonts/') property bool isClient: typeof ApplicationInterface !== 'undefined' - property string styleConfig: isClient ? ApplicationInterface.additionalConfiguration.styleConfig : ApplicationManager.systemProperties.styleConfig - property bool showClusterIfPossible: isClient ? ApplicationInterface.additionalConfiguration.showCluster :ApplicationManager.systemProperties.showCluster + property string styleConfig: isClient ? ApplicationInterface.systemProperties.styleConfig : ApplicationManager.systemProperties.styleConfig + property bool showClusterIfPossible: isClient ? ApplicationInterface.systemProperties.showCluster :ApplicationManager.systemProperties.showCluster property Loader styleLoader: Loader { property bool showClusterIfPossible: root.showClusterIfPossible diff --git a/kms_config.json b/kms_config.json index 232a7a2..d108380 100644 --- a/kms_config.json +++ b/kms_config.json @@ -1,5 +1,4 @@ { - "device": "drm-nvdc", "separateScreens": true, "outputs": [ { diff --git a/scripts/automotivedemo.service b/scripts/automotivedemo.service index 2e73b1d..ed665d4 100644 --- a/scripts/automotivedemo.service +++ b/scripts/automotivedemo.service @@ -1,6 +1,6 @@ [Unit] Description=AutomotiveDemo -After=systemd-user-sessions.service +After=systemd-user-sessions.service dbus-session.service [Service] ExecStart=/opt/automotivedemo/start.sh -- cgit v1.2.3