diff --git a/assets/qml/Dashboard/WidgetDelegate.qml b/assets/qml/Dashboard/WidgetDelegate.qml index 59c76369..c5834068 100644 --- a/assets/qml/Dashboard/WidgetDelegate.qml +++ b/assets/qml/Dashboard/WidgetDelegate.qml @@ -30,20 +30,21 @@ import "../Widgets" as Widgets Item { id: root - enabled: visible - visible: loader.widgetVisible + + property int widgetIndex: -1 Widgets.Window { + z: 1 id: window anchors.fill: parent title: loader.widgetTitle icon.source: loader.widgetIcon - onHeaderDoubleClicked: externalWindow.visible = true borderColor: Cpp_ThemeManager.datasetWindowBorder + onHeaderDoubleClicked: externalWindow.visible = true WidgetLoader { id: loader - widgetIndex: index + widgetIndex: root.widgetIndex anchors { fill: parent leftMargin: window.borderWidth @@ -54,6 +55,7 @@ Item { } Widgets.Shadow { + z: 0 source: window anchors.fill: window } @@ -69,9 +71,9 @@ Item { WidgetLoader { id: externalLoader - widgetIndex: index anchors.fill: parent isExternalWindow: true + widgetIndex: root.widgetIndex widgetVisible: externalWindow.visible } } diff --git a/assets/qml/Dashboard/WidgetGrid.qml b/assets/qml/Dashboard/WidgetGrid.qml index 12243a3c..949b94bc 100644 --- a/assets/qml/Dashboard/WidgetGrid.qml +++ b/assets/qml/Dashboard/WidgetGrid.qml @@ -42,7 +42,7 @@ Widgets.Window { readonly property int cellHeight: cellWidth * (2/3) readonly property int columns: Math.floor((grid.width - 2 * scroll.width) / cWidth) readonly property int cellWidth: cWidth + ((grid.width - 2 * scroll.width) - (cWidth) * columns) / columns - readonly property int cWidth: Math.min(Math.max(356, (grid.width - 2 * scroll.width) / Math.min(3, model.count)), 480) + readonly property int cWidth: Math.min(Math.max(356, (grid.width - 2 * scroll.width) / model.count), 480) // // Put everything into a flickable to enable scrolling diff --git a/assets/qml/Dashboard/WidgetModel.qml b/assets/qml/Dashboard/WidgetModel.qml index 9d893594..70d30660 100644 --- a/assets/qml/Dashboard/WidgetModel.qml +++ b/assets/qml/Dashboard/WidgetModel.qml @@ -29,9 +29,26 @@ Repeater { property real cellWidth: 0 property real cellHeight: 0 - delegate: WidgetDelegate { - id: delegate + delegate: Loader { + id: loader + opacity: 0 + asynchronous: true width: root.cellWidth height: root.cellHeight + Behavior on opacity {NumberAnimation{}} + + sourceComponent: WidgetDelegate { + widgetIndex: index + anchors.fill: parent + Component.onCompleted: loader.opacity = 1 + } + + Connections { + target: Cpp_UI_Dashboard + + function onWidgetVisibilityChanged() { + loader.visible = Cpp_UI_Dashboard.widgetVisible(index) + } + } } } diff --git a/assets/qml/Windows/MainWindow.qml b/assets/qml/Windows/MainWindow.qml index 7b3ef285..270f17f2 100644 --- a/assets/qml/Windows/MainWindow.qml +++ b/assets/qml/Windows/MainWindow.qml @@ -353,8 +353,8 @@ ApplicationWindow { Console { id: terminal - anchors.margins: 0 - anchors.fill: parent + width: parent.width + height: parent.height enabled: opacity > 0 visible: opacity > 0 } @@ -362,8 +362,8 @@ ApplicationWindow { Dashboard { opacity: 0 id: dashboard - anchors.margins: 0 - anchors.fill: parent + width: parent.width + height: parent.height enabled: opacity > 0 visible: opacity > 0 }