statusbar: Fix polish loop

This commit is contained in:
Devin Lin 2023-09-28 20:41:18 -07:00
parent 66c09cb708
commit 58faa0362c

View file

@ -85,9 +85,9 @@ Item {
// drop shadow for icons // drop shadow for icons
MultiEffect { MultiEffect {
anchors.fill: icons anchors.fill: control
visible: showDropShadow visible: showDropShadow
source: icons source: control
blurMax: 16 blurMax: 16
shadowEnabled: true shadowEnabled: true
shadowVerticalOffset: 1 shadowVerticalOffset: 1
@ -95,128 +95,128 @@ Item {
} }
// screen top panel // screen top panel
Item { Controls.Control {
id: icons id: control
z: 1 z: 1
topPadding: Kirigami.Units.smallSpacing
bottomPadding: Kirigami.Units.smallSpacing
rightPadding: Kirigami.Units.smallSpacing * 3
leftPadding: Kirigami.Units.smallSpacing * 3
anchors.fill: parent anchors.fill: parent
background: Rectangle {
id: panelBackground
color: backgroundColor
}
Controls.Control { contentItem: ColumnLayout {
id: control spacing: Kirigami.Units.smallSpacing / 2
topPadding: Kirigami.Units.smallSpacing
bottomPadding: Kirigami.Units.smallSpacing
rightPadding: Kirigami.Units.smallSpacing * 3
leftPadding: Kirigami.Units.smallSpacing * 3
anchors.fill: parent RowLayout {
background: Rectangle { id: mainRow
id: panelBackground readonly property real rowHeight: Components.Constants.topPanelHeight - Kirigami.Units.smallSpacing * 2
color: backgroundColor
}
contentItem: ColumnLayout { Layout.fillWidth: true
spacing: Kirigami.Units.smallSpacing / 2 Layout.preferredHeight: rowHeight
RowLayout { spacing: 0
id: row
// clock
ClockText {
visible: root.showTime
Layout.fillHeight: true
font.pixelSize: textPixelSize
source: timeSource
}
Indicators.SignalStrengthIndicator {
Layout.fillHeight: true
showLabel: true
visible: !root.showTime
textPixelSize: root.textPixelSize
}
// spacing in the middle
Item {
Layout.fillWidth: true Layout.fillWidth: true
Layout.maximumHeight: Components.Constants.topPanelHeight - control.topPadding - control.bottomPadding }
spacing: 0
// clock // system tray
ClockText { Repeater {
visible: root.showTime id: statusNotifierRepeater
Layout.fillHeight: true model: KItemModels.KSortFilterProxyModel {
font.pixelSize: textPixelSize id: filteredStatusNotifiers
source: timeSource filterRoleName: "Title"
} sourceModel: P5Support.DataModel {
dataSource: statusNotifierSource ? statusNotifierSource : null
Indicators.SignalStrengthIndicator {
Layout.fillHeight: true
showLabel: true
visible: !root.showTime
textPixelSize: root.textPixelSize
}
// spacing in the middle
Item {
Layout.fillWidth: true
}
// system tray
Repeater {
id: statusNotifierRepeater
model: KItemModels.KSortFilterProxyModel {
id: filteredStatusNotifiers
filterRoleName: "Title"
sourceModel: P5Support.DataModel {
dataSource: statusNotifierSource ? statusNotifierSource : null
}
}
delegate: TaskWidget {
Layout.leftMargin: root.elementSpacing
} }
} }
// system indicators delegate: TaskWidget {
RowLayout { Layout.leftMargin: root.elementSpacing
id: indicators
Layout.leftMargin: Kirigami.Units.smallSpacing // applets have different spacing needs
Layout.fillHeight: true
spacing: root.elementSpacing
Indicators.SignalStrengthIndicator {
showLabel: false
visible: root.showTime
internetIndicator: internetIndicatorItem
Layout.fillHeight: true
Layout.preferredWidth: height
}
Indicators.BluetoothIndicator {
Layout.fillHeight: true
Layout.preferredWidth: height
}
Indicators.InternetIndicator {
id: internetIndicatorItem
Layout.fillHeight: true
Layout.preferredWidth: height
}
Indicators.VolumeIndicator {
Layout.fillHeight: true
Layout.preferredWidth: height
}
Indicators.BatteryIndicator {
spacing: root.elementSpacing
textPixelSize: root.textPixelSize
Layout.fillHeight: true
Layout.preferredWidth: height
}
} }
} }
// extra row with date and mobile provider (for quicksettings panel) // system indicators
// using Layout.fillHeight here seems to cause polish loops, instead just define the height of the row
RowLayout { RowLayout {
spacing: 0 id: indicators
visible: root.showSecondRow Layout.leftMargin: Kirigami.Units.smallSpacing // applets have different spacing needs
Layout.fillWidth: true Layout.maximumHeight: mainRow.rowHeight
PlasmaComponents.Label { spacing: root.elementSpacing
text: Qt.formatDate(timeSource.data.Local.DateTime, "ddd. MMMM d")
color: Kirigami.Theme.disabledTextColor
font.pixelSize: root.smallerTextPixelSize
}
Item { Layout.fillWidth: true }
PlasmaComponents.Label {
property var signalStrengthInfo: DataProviders.SignalStrengthInfo {}
Indicators.SignalStrengthIndicator {
showLabel: false
visible: root.showTime visible: root.showTime
text: signalStrengthInfo.label internetIndicator: internetIndicatorItem
color: Kirigami.Theme.disabledTextColor implicitHeight: mainRow.rowHeight
font.pixelSize: root.smallerTextPixelSize Layout.preferredWidth: height
horizontalAlignment: Qt.AlignRight
} }
Indicators.BluetoothIndicator {
implicitHeight: mainRow.rowHeight
Layout.preferredWidth: height
}
Indicators.InternetIndicator {
id: internetIndicatorItem
implicitHeight: mainRow.rowHeight
Layout.preferredWidth: height
}
Indicators.VolumeIndicator {
implicitHeight: mainRow.rowHeight
Layout.preferredWidth: height
}
Indicators.BatteryIndicator {
spacing: root.elementSpacing
textPixelSize: root.textPixelSize
implicitHeight: mainRow.rowHeight
Layout.preferredWidth: height
}
}
}
// extra row with date and mobile provider (for quicksettings panel)
RowLayout {
spacing: 0
visible: root.showSecondRow
Layout.fillWidth: true
PlasmaComponents.Label {
text: Qt.formatDate(timeSource.data.Local.DateTime, "ddd. MMMM d")
color: Kirigami.Theme.disabledTextColor
font.pixelSize: root.smallerTextPixelSize
}
Item { Layout.fillWidth: true }
PlasmaComponents.Label {
property var signalStrengthInfo: DataProviders.SignalStrengthInfo {}
visible: root.showTime
text: signalStrengthInfo.label
color: Kirigami.Theme.disabledTextColor
font.pixelSize: root.smallerTextPixelSize
horizontalAlignment: Qt.AlignRight
} }
} }
} }