mirror of
https://github.com/Serial-Studio/Serial-Studio.git
synced 2025-01-31 17:42:55 +08:00
Load dashboard widgets with loaders
This commit is contained in:
parent
563811da7d
commit
cda43278e5
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user