diff options
author | Robert Griebl <robert.griebl@qt.io> | 2023-06-07 21:06:37 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-06-12 10:12:08 +0000 |
commit | 553e1562886d2a65d85e60a26108da62e310d23e (patch) | |
tree | d388a9b82604f9269703b5827fb5ab09d77b657b | |
parent | 968451354be4712553d621bda8e6625137f80b87 (diff) |
Make sure that no example throws qmllint warningsv6.6.0-beta1
Change-Id: I8915fce95eaa0f2c80290f403088c842b02c9657
Reviewed-by: Bernd Weimer <bernd.weimer@qt.io>
(cherry picked from commit 3b4c3443f0a254f1dd63cc124433dd7c736654a7)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
15 files changed, 206 insertions, 113 deletions
diff --git a/examples/applicationmanager/animated-windows/system-ui/main.qml b/examples/applicationmanager/animated-windows/system-ui/main.qml index c616ed47..806c582d 100644 --- a/examples/applicationmanager/animated-windows/system-ui/main.qml +++ b/examples/applicationmanager/animated-windows/system-ui/main.qml @@ -3,6 +3,8 @@ // Copyright (C) 2018 Pelagicore AG // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +pragma ComponentBehavior: Bound + import QtQuick 2.4 import QtQuick.Layouts 1.11 import QtApplicationManager.SystemUI 2.0 @@ -22,30 +24,35 @@ Rectangle { Repeater { model: ApplicationManager ColumnLayout { + id: delegate + required property bool isRunning + required property var icon + required property var application + required property string name Layout.alignment: Qt.AlignHCenter Rectangle { Layout.alignment: Qt.AlignHCenter - width: 100; height: 100; radius: width/4 - color: model.isRunning ? "darkgrey" : "lightgrey" + implicitWidth: 100; implicitHeight: 100; radius: width/4 + color: delegate.isRunning ? "darkgrey" : "lightgrey" Image { anchors.fill: parent - source: icon + source: delegate.icon sourceSize.width: 100 sourceSize.height: 100 } MouseArea { anchors.fill: parent onClicked: { - if (model.isRunning) - application.stop(); + if (delegate.isRunning) + delegate.application.stop(); else - application.start(); + delegate.application.start(); } } } Text { Layout.alignment: Qt.AlignHCenter - text: model.name + " application" + text: delegate.name + " application" horizontalAlignment: Text.AlignHCenter } } @@ -59,22 +66,24 @@ Rectangle { delegate: Rectangle { id: winChrome + required property WindowObject window + required property int index width: 400; height: 320 - z: model.index + z: index color: "tan" // Title bar text Text { anchors.horizontalCenter: parent.horizontalCenter - text: model.window.application.names["en"] + " application window" + text: winChrome.window.application.names["en"] + " application window" } // Raises the window when the title bar is clicked and moves it around when dragged. MouseArea { anchors.fill: parent drag.target: parent - onPressed: windowsModel.move(model.index, windowsModel.count-1, 1); + onPressed: windowsModel.move(winChrome.index, windowsModel.count-1, 1); } // Close button @@ -90,7 +99,7 @@ Rectangle { MouseArea { anchors.fill: parent - onClicked: model.window.close() + onClicked: winChrome.window.close() } } @@ -100,12 +109,12 @@ Rectangle { anchors.fill: parent anchors.margins: 3 anchors.topMargin: 25 - window: model.window + window: winChrome.window } Component.onCompleted: { - winChrome.x = 300 + model.index * 50; - winChrome.y = 10 + model.index * 30; + winChrome.x = 300 + winChrome.index * 50; + winChrome.y = 10 + winChrome.index * 30; } // Its default state represents a closed window. It's the starting point for @@ -118,12 +127,13 @@ Rectangle { states: [ State { name: "open" - when: model.window && model.window.contentState === WindowObject.SurfaceWithContent + when: winChrome.window && winChrome.window.contentState === WindowObject.SurfaceWithContent PropertyChanges { - target: winChrome - opacity: 1 - scale: 1 - visible: true + winChrome { + opacity: 1 + scale: 1 + visible: true + } } } ] @@ -152,8 +162,8 @@ Rectangle { } ] - readonly property bool safeToRemove: fullyDisappeared && model.window && model.window.contentState === WindowObject.NoSurface - onSafeToRemoveChanged: if (safeToRemove) windowsModel.remove(model.index, 1) + readonly property bool safeToRemove: fullyDisappeared && winChrome.window && winChrome.window.contentState === WindowObject.NoSurface + onSafeToRemoveChanged: if (safeToRemove) windowsModel.remove(winChrome.index, 1) } } diff --git a/examples/applicationmanager/application-features/apps/compositor/compositor.qml b/examples/applicationmanager/application-features/apps/compositor/compositor.qml index cb62f125..d97d50bf 100644 --- a/examples/applicationmanager/application-features/apps/compositor/compositor.qml +++ b/examples/applicationmanager/application-features/apps/compositor/compositor.qml @@ -2,6 +2,8 @@ // Copyright (C) 2019 Luxoft Sweden AB // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +pragma ComponentBehavior: Bound + import QtQuick 2.11 import QtApplicationManager.Application 2.0 import QtWayland.Compositor 1.3 @@ -35,19 +37,21 @@ ApplicationManagerWindow { } WlShell { - onWlShellSurfaceCreated: (shellSurface) => shellSurfaces.append({shellSurface: shellSurface}); + onWlShellSurfaceCreated: (shellSurface) => root.shellSurfaces.append({shellSurface: shellSurface}); } XdgShell { - onToplevelCreated: (toplevel, xdgSurface) => shellSurfaces.append({shellSurface: xdgSurface}); + onToplevelCreated: (toplevel, xdgSurface) => root.shellSurfaces.append({shellSurface: xdgSurface}); } } Repeater { - model: shellSurfaces + model: root.shellSurfaces ShellSurfaceItem { + required property var modelData + required property int index shellSurface: modelData - onSurfaceDestroyed: shellSurfaces.remove(index) + onSurfaceDestroyed: root.shellSurfaces.remove(index) } } diff --git a/examples/applicationmanager/application-features/apps/crash/crashapp.qml b/examples/applicationmanager/application-features/apps/crash/crashapp.qml index b997fce0..4b90735b 100644 --- a/examples/applicationmanager/application-features/apps/crash/crashapp.qml +++ b/examples/applicationmanager/application-features/apps/crash/crashapp.qml @@ -2,8 +2,10 @@ // Copyright (C) 2019 Luxoft Sweden AB // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause -import QtQuick 2.11 -import QtApplicationManager.Application 2.0 +pragma ComponentBehavior: Bound + +import QtQuick +import QtApplicationManager.Application import Terminator 2.0 ApplicationManagerWindow { @@ -27,8 +29,9 @@ ApplicationManagerWindow { Grid { columns: 2 Repeater { - model: Object.keys(methods) + model: Object.keys(root.methods) Rectangle { + required property var modelData width: root.width / 2 height: root.height / 4 border.width: 1 @@ -40,14 +43,14 @@ ApplicationManagerWindow { verticalAlignment: Text.AlignVCenter wrapMode: Text.Wrap font.pointSize: 14 - text: methods[modelData] + text: root.methods[parent.modelData] } MouseArea { anchors.fill: parent onClicked: { - switch (modelData) { - case "illegalMemory": accessIllegalMemory(); break; + switch (parent.modelData) { + case "illegalMemory": root.accessIllegalMemory(); break; case "illegalMemoryInThread": Terminator.accessIllegalMemoryInThread(); break; case "stackOverflow": Terminator.forceStackOverflow(); break; case "divideByZero": Terminator.divideByZero(); break; diff --git a/examples/applicationmanager/application-features/system-ui/main.qml b/examples/applicationmanager/application-features/system-ui/main.qml index a5b5b07d..0ed06c1d 100644 --- a/examples/applicationmanager/application-features/system-ui/main.qml +++ b/examples/applicationmanager/application-features/system-ui/main.qml @@ -2,6 +2,8 @@ // Copyright (C) 2019 Luxoft Sweden AB // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +pragma ComponentBehavior: Bound + import QtQuick 2.11 import QtQuick.Window 2.11 import QtApplicationManager.SystemUI 2.0 @@ -23,6 +25,10 @@ Window { model: ApplicationManager Image { + id: delegate + required property var application + required property bool isRunning + required property var icon source: icon opacity: isRunning ? 0.3 : 1.0 @@ -34,7 +40,7 @@ Window { Text { id: appid - text: application.names["en"] + text: delegate.application.names["en"] } } @@ -42,7 +48,8 @@ Window { id: imouse anchors.fill: parent hoverEnabled: true - onClicked: isRunning ? application.stop() : application.start(); + onClicked: delegate.isRunning ? delegate.application.stop() + : delegate.application.start(); } } } @@ -53,11 +60,13 @@ Window { delegate: Rectangle { id: chrome + required property WindowObject window + required property int index width: draggrab.x + 10; height: draggrab.y + 10 color: "transparent" border.width: 3 border.color: "grey" - z: model.index + z: index Image { id: draggrab @@ -82,14 +91,14 @@ Window { Text { anchors.horizontalCenter: parent.horizontalCenter - text: model.window.application ? model.window.application.names["en"] - : 'External Application' + text: chrome.window.application ? chrome.window.application.names["en"] + : 'External Application' } MouseArea { anchors.fill: parent drag.target: chrome - onPressed: topLevelWindowsModel.move(model.index, topLevelWindowsModel.count - 1, 1); + onPressed: topLevelWindowsModel.move(chrome.index, topLevelWindowsModel.count - 1, 1); } Rectangle { @@ -98,7 +107,7 @@ Window { MouseArea { anchors.fill: parent - onClicked: model.window.close(); + onClicked: chrome.window.close(); } } } @@ -107,20 +116,20 @@ Window { anchors.fill: parent anchors.margins: 3 anchors.topMargin: 25 - window: model.window + window: chrome.window Connections { - target: window + target: chrome.window function onContentStateChanged() { - if (window.contentState === WindowObject.NoSurface) - topLevelWindowsModel.remove(model.index, 1); + if (chrome.window.contentState === WindowObject.NoSurface) + topLevelWindowsModel.remove(chrome.index, 1); } } } Component.onCompleted: { - x = 200 + model.index * 50; - y = 20 + model.index * 30; + x = 200 + chrome.index * 50; + y = 20 + chrome.index * 30; } } } @@ -128,14 +137,16 @@ Window { Repeater { model: ListModel { id: popupsModel } delegate: WindowItem { + id: win + required property var model z: 9999 + model.index anchors.centerIn: parent window: model.window Connections { - target: model.window + target: win.model.window function onContentStateChanged() { - if (model.window.contentState === WindowObject.NoSurface) - popupsModel.remove(model.index, 1); + if (win.model.window.contentState === WindowObject.NoSurface) + popupsModel.remove(win.model.index, 1); } } } diff --git a/examples/applicationmanager/frame-timer/system-ui/main.qml b/examples/applicationmanager/frame-timer/system-ui/main.qml index e57a448f..42dcfd3d 100644 --- a/examples/applicationmanager/frame-timer/system-ui/main.qml +++ b/examples/applicationmanager/frame-timer/system-ui/main.qml @@ -3,6 +3,8 @@ // Copyright (C) 2018 Pelagicore AG // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +pragma ComponentBehavior: Bound + import QtQuick 2.11 import QtQuick.Layouts 1.11 import QtQuick.Window 2.11 @@ -69,6 +71,7 @@ Window { } delegate: Rectangle { + required property var model width: (fpsGraph.width / monitorModel.count) * 0.8 height: (model.averageFps / 100) * fpsGraph.height y: fpsGraph.height - height @@ -106,30 +109,35 @@ Window { Repeater { model: ApplicationManager ColumnLayout { + id: delegate + required property bool isRunning + required property var icon + required property var application + required property string name Layout.alignment: Qt.AlignHCenter Rectangle { Layout.alignment: Qt.AlignHCenter - width: 100; height: 100; radius: width/4 - color: model.isRunning ? "darkgrey" : "lightgrey" + implicitWidth: 100; implicitHeight: 100; radius: width/4 + color: delegate.isRunning ? "darkgrey" : "lightgrey" Image { anchors.fill: parent - source: icon + source: delegate.icon sourceSize.width: 100 sourceSize.height: 100 } MouseArea { anchors.fill: parent onClicked: { - if (model.isRunning) - application.stop(); + if (delegate.isRunning) + delegate.application.stop(); else - application.start(); + delegate.application.start(); } } } Text { Layout.alignment: Qt.AlignHCenter - text: model.name + " application" + text: delegate.name + " application" horizontalAlignment: Text.AlignHCenter } } @@ -143,22 +151,24 @@ Window { delegate: Rectangle { id: winChrome + required property int index + required property WindowObject window width: 400; height: 320 - z: model.index + z: index color: "tan" // Title bar text Text { anchors.horizontalCenter: parent.horizontalCenter - text: model.window.application.names["en"] + " application window" + text: winChrome.window.application.names["en"] + " application window" } // Raises the window when the title bar is clicked and moves it around when dragged. MouseArea { anchors.fill: parent drag.target: parent - onPressed: windowsModel.move(model.index, windowsModel.count-1, 1); + onPressed: windowsModel.move(winChrome.index, windowsModel.count-1, 1); } // Close button @@ -174,7 +184,7 @@ Window { MouseArea { anchors.fill: parent - onClicked: model.window.close() + onClicked: winChrome.window.close() } } @@ -184,7 +194,7 @@ Window { anchors.fill: parent anchors.margins: 3 anchors.topMargin: 25 - window: model.window + window: winChrome.window Rectangle { anchors.fill: fpsOverlay @@ -221,17 +231,17 @@ Window { FrameTimer { id: frameTimer // no sense in trying to update the FrameTimer while the window has no surface (or has just an empty one) - running: window && window.contentState === WindowObject.SurfaceWithContent - window: model.window + running: winChrome.window && winChrome.window.contentState === WindowObject.SurfaceWithContent + window: winChrome.window } Component.onCompleted: { - winChrome.x = 300 + model.index * 50; - winChrome.y = 10 + model.index * 30; + winChrome.x = 300 + winChrome.index * 50; + winChrome.y = 10 + winChrome.index * 30; } - readonly property bool shouldBeRemoved: model.window && model.window.contentState === WindowObject.NoSurface - onShouldBeRemovedChanged: if (shouldBeRemoved) windowsModel.remove(model.index, 1) + readonly property bool shouldBeRemoved: winChrome.window && winChrome.window.contentState === WindowObject.NoSurface + onShouldBeRemovedChanged: if (shouldBeRemoved) windowsModel.remove(winChrome.index, 1) } } diff --git a/examples/applicationmanager/hello-world/system-ui.qml b/examples/applicationmanager/hello-world/system-ui.qml index 2d46f039..f9037065 100644 --- a/examples/applicationmanager/hello-world/system-ui.qml +++ b/examples/applicationmanager/hello-world/system-ui.qml @@ -16,16 +16,22 @@ Item { Repeater { model: ApplicationManager Column { + id: delegate + required property bool isRunning + required property var icon + required property var application + required property string name Image { - source: model.icon + source: delegate.icon MouseArea { anchors.fill: parent - onClicked: model.isRunning ? application.stop() : application.start() + onClicked: delegate.isRunning ? delegate.application.stop() + : delegate.application.start() } } Text { font.pixelSize: 20 - text: model.name + text: delegate.name } } } @@ -37,6 +43,7 @@ Item { Repeater { model: WindowManager WindowItem { + required property var model width: 600 height: 200 window: model.window diff --git a/examples/applicationmanager/intents/shared/IntentsApplicationWindow.qml b/examples/applicationmanager/intents/shared/IntentsApplicationWindow.qml index 6f42eb7f..9269a2b8 100644 --- a/examples/applicationmanager/intents/shared/IntentsApplicationWindow.qml +++ b/examples/applicationmanager/intents/shared/IntentsApplicationWindow.qml @@ -65,7 +65,7 @@ ApplicationManagerWindow { //! [Intent Handler] IntentHandler { - intentIds: "rotate-window" + intentIds: [ "rotate-window" ] onRequestReceived: (request) => { rotationAnimation.start() request.sendReply({ "done": true }) @@ -74,7 +74,7 @@ ApplicationManagerWindow { //! [Intent Handler] IntentHandler { - intentIds: "scale-window" + intentIds: [ "scale-window" ] onRequestReceived: (request) => { scaleAnimation.start() request.sendReply({ "done": true }) @@ -82,7 +82,7 @@ ApplicationManagerWindow { } IntentHandler { - intentIds: "blue-window-private" + intentIds: [ "blue-window-private" ] onRequestReceived: (request) => { blueAnimation.start() request.sendReply({ "done": true }) @@ -90,7 +90,7 @@ ApplicationManagerWindow { } IntentHandler { - intentIds: "broadcast/blink-window" + intentIds: [ "broadcast/blink-window" ] onRequestReceived: (request) => { blinkAnimation.start() } diff --git a/examples/applicationmanager/intents/system-ui.qml b/examples/applicationmanager/intents/system-ui.qml index b4708532..de254823 100644 --- a/examples/applicationmanager/intents/system-ui.qml +++ b/examples/applicationmanager/intents/system-ui.qml @@ -3,6 +3,8 @@ // Copyright (C) 2018 Pelagicore AG // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +pragma ComponentBehavior: Bound + import QtQuick import QtQuick.Controls import QtQuick.Layouts @@ -23,17 +25,23 @@ Item { Repeater { model: ApplicationManager Column { + id: delegate + required property bool isRunning + required property var icon + required property var application + required property string name Image { - source: model.icon + source: delegate.icon MouseArea { anchors.fill: parent - onClicked: model.isRunning ? application.stop() : application.start() + onClicked: delegate.isRunning ? delegate.application.stop() + : delegate.application.start() } } Text { width: parent.width font.pixelSize: 10 - text: model.name + text: delegate.name horizontalAlignment: Text.AlignHCenter } } @@ -74,7 +82,7 @@ Item { } //! [IntentServerHandler] IntentServerHandler { - intentIds: "rotate-window" + intentIds: [ "rotate-window" ] names: { "en": "Rotate System UI" } visibility: IntentObject.Public @@ -89,6 +97,7 @@ Item { Repeater { model: WindowManager WindowItem { + required property var model width: sysui_page.width height: sysui_page.height window: model.window @@ -177,6 +186,8 @@ Item { Layout.fillHeight: true delegate: ItemDelegate { + required property int index + required property var modelData property ApplicationObject application: ApplicationManager.application(modelData.applicationId) width: parent.width text: modelData.name + " (" + modelData.applicationId + ")" diff --git a/examples/applicationmanager/launch-intents/system-ui.qml b/examples/applicationmanager/launch-intents/system-ui.qml index bedf2f03..e3fc40d4 100644 --- a/examples/applicationmanager/launch-intents/system-ui.qml +++ b/examples/applicationmanager/launch-intents/system-ui.qml @@ -21,23 +21,29 @@ Item { Repeater { model: intentModel Column { + id: delegate + required property url icon + required property string applicationId + required property string intentId + required property string name Image { - source: model.icon + source: delegate.icon MouseArea { anchors.fill: parent onPressAndHold: { - var app = ApplicationManager.application(model.applicationId) + var app = ApplicationManager.application(delegate.applicationId) if (app.runState === Am.Running) app.stop() } onClicked: { - IntentClient.sendIntentRequest(model.intentId, model.applicationId, {}) + IntentClient.sendIntentRequest(delegate.intentId, + delegate.applicationId, {}) } } } Text { font.pixelSize: 20 - text: model.name + text: delegate.name } } } @@ -49,6 +55,7 @@ Item { Repeater { model: WindowManager WindowItem { + required property var model width: 600 height: 200 window: model.window diff --git a/examples/applicationmanager/minidesk/apps/tld.minidesk.app2/app2.qml b/examples/applicationmanager/minidesk/apps/tld.minidesk.app2/app2.qml index 4b050533..c076d3ea 100644 --- a/examples/applicationmanager/minidesk/apps/tld.minidesk.app2/app2.qml +++ b/examples/applicationmanager/minidesk/apps/tld.minidesk.app2/app2.qml @@ -33,7 +33,7 @@ ApplicationManagerWindow { console.log("App2: onOpenDocument - " + documentUrl); } function onQuit() { - target.acknowledgeQuit(); + ApplicationInterface.acknowledgeQuit(); } } } diff --git a/examples/applicationmanager/minidesk/system-ui/main.qml b/examples/applicationmanager/minidesk/system-ui/main.qml index 5eb73f47..f9279649 100644 --- a/examples/applicationmanager/minidesk/system-ui/main.qml +++ b/examples/applicationmanager/minidesk/system-ui/main.qml @@ -3,6 +3,8 @@ // Copyright (C) 2018 Pelagicore AG // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +pragma ComponentBehavior: Bound + import QtQuick 2.11 import QtQuick.Window 2.11 import QtApplicationManager.SystemUI 2.0 @@ -26,12 +28,17 @@ Window { model: ApplicationManager Image { + id: delegate + required property bool isRunning + required property var icon + required property var application source: icon opacity: isRunning ? 0.3 : 1.0 MouseArea { anchors.fill: parent - onClicked: isRunning ? application.stop() : application.start("documentUrl"); + onClicked: delegate.isRunning ? delegate.application.stop() + : delegate.application.start("documentUrl"); } } } @@ -42,19 +49,22 @@ Window { model: ListModel { id: topLevelWindowsModel } delegate: Image { + id: winChrome + required property WindowObject window + required property int index source: "chrome-bg.png" - z: model.index + z: index Text { anchors.horizontalCenter: parent.horizontalCenter - text: "Decoration: " + (model.window.application ? model.window.application.names["en"] - : 'External Application') + text: "Decoration: " + (winChrome.window.application ? winChrome.window.application.names["en"] + : 'External Application') } MouseArea { anchors.fill: parent drag.target: parent - onPressed: topLevelWindowsModel.move(model.index, topLevelWindowsModel.count - 1, 1); + onPressed: topLevelWindowsModel.move(winChrome.index, topLevelWindowsModel.count - 1, 1); } Rectangle { @@ -63,7 +73,7 @@ Window { MouseArea { anchors.fill: parent - onClicked: model.window.close(); + onClicked: winChrome.window.close(); } } @@ -71,20 +81,20 @@ Window { anchors.fill: parent anchors.margins: 3 anchors.topMargin: 25 - window: model.window + window: winChrome.window Connections { - target: window + target: winChrome.window function onContentStateChanged() { - if (window.contentState === WindowObject.NoSurface) - topLevelWindowsModel.remove(model.index, 1); + if (winChrome.window.contentState === WindowObject.NoSurface) + topLevelWindowsModel.remove(winChrome.index, 1); } } } Component.onCompleted: { - x = 300 + model.index * 50; - y = 10 + model.index * 30; + x = 300 + winChrome.index * 50; + y = 10 + winChrome.index * 30; } } } diff --git a/examples/applicationmanager/multi-views/system-ui/main.qml b/examples/applicationmanager/multi-views/system-ui/main.qml index dc73d460..506bd1d4 100644 --- a/examples/applicationmanager/multi-views/system-ui/main.qml +++ b/examples/applicationmanager/multi-views/system-ui/main.qml @@ -3,6 +3,8 @@ // Copyright (C) 2018 Pelagicore AG // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +pragma ComponentBehavior: Bound + import QtQuick 2.4 import QtApplicationManager.SystemUI 2.0 @@ -26,6 +28,10 @@ Rectangle { model: ApplicationManager Image { + id: delegate + required property bool isRunning + required property var icon + required property var application source: icon Text { @@ -33,16 +39,16 @@ Rectangle { fontSizeMode: Text.Fit; minimumPixelSize: 10; font.pixelSize: height horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - text: model.isRunning ? "Stop" : "Start" + text: delegate.isRunning ? "Stop" : "Start" } MouseArea { anchors.fill: parent onClicked: { - if (model.isRunning) - application.stop(); + if (delegate.isRunning) + delegate.application.stop() else - application.start(); + delegate.application.start() } } } @@ -55,22 +61,24 @@ Rectangle { delegate: Rectangle { id: winChrome + required property WindowObject window + required property int index width: 400; height: 320 - z: model.index + z: index color: "tan" property bool manuallyClosed: false Text { anchors.horizontalCenter: parent.horizontalCenter - text: (windowItem.primary ? "Primary: " : "Secondary: ") + model.window.application.names["en"] + text: (windowItem.primary ? "Primary: " : "Secondary: ") + winChrome.window.application.names["en"] } MouseArea { anchors.fill: parent drag.target: parent - onPressed: topLevelWindowsModel.move(model.index, topLevelWindowsModel.count-1, 1); + onPressed: topLevelWindowsModel.move(winChrome.index, topLevelWindowsModel.count-1, 1) } Rectangle { @@ -86,7 +94,7 @@ Rectangle { MouseArea { anchors.fill: parent onClicked: { - winChrome.manuallyClosed = true; + winChrome.manuallyClosed = true } } } @@ -115,7 +123,7 @@ Rectangle { MouseArea { anchors.fill: parent onClicked: { - topLevelWindowsModel.append({"window":model.window}); + topLevelWindowsModel.append({"window": winChrome.window}) } } } @@ -125,23 +133,26 @@ Rectangle { anchors.fill: parent anchors.margins: 3 anchors.topMargin: 25 - window: model.window + window: winChrome.window } Component.onCompleted: { - winChrome.x = 300 + model.index * 50; - winChrome.y = 10 + model.index * 30; + winChrome.x = 300 + winChrome.index * 50 + winChrome.y = 10 + winChrome.index * 30 } states: [ State { name: "open" - when: model.window && model.window.contentState === WindowObject.SurfaceWithContent && !manuallyClosed + when: winChrome.window + && winChrome.window.contentState === WindowObject.SurfaceWithContent + && !winChrome.manuallyClosed PropertyChanges { - target: winChrome - opacity: 1 - scale: 1 - visible: true + winChrome { + opacity: 1 + scale: 1 + visible: true + } } } ] @@ -161,8 +172,9 @@ Rectangle { PropertyAction { target: winChrome; property: "visible"; value: true } // we wanna see the window during the closing animation NumberAnimation { target: winChrome; properties: "opacity,scale"; duration: 500; easing.type: Easing.InQuad} ScriptAction { script: { - if (model.window.contentState === WindowObject.NoSurface || winChrome.manuallyClosed) - topLevelWindowsModel.remove(model.index, 1); + if (winChrome.window.contentState === WindowObject.NoSurface + || winChrome.manuallyClosed) + topLevelWindowsModel.remove(winChrome.index, 1) } } } } @@ -174,7 +186,7 @@ Rectangle { Connections { target: WindowManager function onWindowAdded(window) { - topLevelWindowsModel.append({"window":window}); + topLevelWindowsModel.append({"window":window}) } } } diff --git a/examples/applicationmanager/process-status/system-ui/CpuGraph.qml b/examples/applicationmanager/process-status/system-ui/CpuGraph.qml index 0b4f3901..a137812f 100644 --- a/examples/applicationmanager/process-status/system-ui/CpuGraph.qml +++ b/examples/applicationmanager/process-status/system-ui/CpuGraph.qml @@ -3,6 +3,8 @@ // Copyright (C) 2018 Pelagicore AG // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +pragma ComponentBehavior: Bound + import QtQuick 2.11 import QtQuick.Controls 2.4 import QtApplicationManager 2.0 @@ -33,6 +35,7 @@ Pane { } delegate: Rectangle { + required property var model width: (root.width / monitorModel.count) * 0.8 height: model.cpuLoad * root.height y: root.height - height diff --git a/examples/applicationmanager/process-status/system-ui/Stats.qml b/examples/applicationmanager/process-status/system-ui/Stats.qml index b9d66487..550d0585 100644 --- a/examples/applicationmanager/process-status/system-ui/Stats.qml +++ b/examples/applicationmanager/process-status/system-ui/Stats.qml @@ -12,6 +12,7 @@ import QtApplicationManager.SystemUI 2.0 when all that is needed is the latest information on a given application process. */ Grid { + id: root spacing: 10 columns: 2 rows: 5 diff --git a/examples/applicationmanager/process-status/system-ui/main.qml b/examples/applicationmanager/process-status/system-ui/main.qml index d21e0fbe..9f839d02 100644 --- a/examples/applicationmanager/process-status/system-ui/main.qml +++ b/examples/applicationmanager/process-status/system-ui/main.qml @@ -3,6 +3,8 @@ // Copyright (C) 2018 Pelagicore AG // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause +pragma ComponentBehavior: Bound + import QtQuick 2.4 import QtQuick.Controls 2.4 import QtApplicationManager.SystemUI 2.0 @@ -45,6 +47,7 @@ Pane { Repeater { model: ApplicationManager ApplicationDisplay { + required property var model name: model.name application: model.application } @@ -60,6 +63,7 @@ Pane { Repeater { model: WindowManager WindowItem { + required property var model width: windowsColumn.width height: 200 window: model.window |