Commit 1f3b6908 authored by Konrad Materka's avatar Konrad Materka
Browse files

[applets/systemtray] Fixes for vertical and huge panel

Few fixes for icon sizing, especially less common. like vertical panel and huge sizes.

BUG: 428158
BUG: 428127
BUG: 428198
FIXED-IN: 5.20.2
parent 7e6dd145
...@@ -27,6 +27,7 @@ Item { ...@@ -27,6 +27,7 @@ Item {
Layout.minimumWidth: internalSystray ? internalSystray.Layout.minimumWidth : 0 Layout.minimumWidth: internalSystray ? internalSystray.Layout.minimumWidth : 0
Layout.minimumHeight: internalSystray ? internalSystray.Layout.minimumHeight : 0 Layout.minimumHeight: internalSystray ? internalSystray.Layout.minimumHeight : 0
Layout.preferredWidth: Layout.minimumWidth
Layout.preferredHeight: Layout.minimumHeight Layout.preferredHeight: Layout.minimumHeight
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
......
...@@ -30,9 +30,9 @@ import "items" ...@@ -30,9 +30,9 @@ import "items"
MouseArea { MouseArea {
id: root id: root
Layout.minimumWidth: vertical ? units.iconSizes.small : tasksGrid.implicitWidth + (expander.visible ? expander.implicitWidth : 0) + units.smallSpacing Layout.minimumWidth: vertical ? units.iconSizes.small : mainLayout.implicitWidth + units.smallSpacing
Layout.minimumHeight: vertical ? tasksGrid.implicitHeight + (expander.visible ? expander.implicitHeight : 0) + units.smallSpacing : units.smallSpacing Layout.minimumHeight: vertical ? mainLayout.implicitHeight + units.smallSpacing : units.smallSpacing
Layout.preferredHeight: Layout.minimumHeight Layout.preferredHeight: Layout.minimumHeight
LayoutMirroring.enabled: !vertical && Qt.application.layoutDirection === Qt.RightToLeft LayoutMirroring.enabled: !vertical && Qt.application.layoutDirection === Qt.RightToLeft
...@@ -43,13 +43,13 @@ MouseArea { ...@@ -43,13 +43,13 @@ MouseArea {
// Used only by AbstractItem, but it's easiest to keep it here since it // Used only by AbstractItem, but it's easiest to keep it here since it
// uses dimensions from this item to calculate the final value // uses dimensions from this item to calculate the final value
readonly property int itemSize: autoSize ? units.roundToIconSize(Math.min(Math.min(width / rowsOrColumns, height / rowsOrColumns), units.iconSizes.enormous)) : smallIconSize readonly property int itemSize: autoSize ? units.roundToIconSize(Math.min(Math.min(tasksGrid.implicitWidth / rowsOrColumns, tasksGrid.implicitHeight / rowsOrColumns), units.iconSizes.enormous)) : smallIconSize
// The rest are derived properties; do not modify // The rest are derived properties; do not modify
readonly property bool vertical: plasmoid.formFactor === PlasmaCore.Types.Vertical readonly property bool vertical: plasmoid.formFactor === PlasmaCore.Types.Vertical
readonly property bool autoSize: plasmoid.configuration.scaleIconsToFit readonly property bool autoSize: plasmoid.configuration.scaleIconsToFit
readonly property int cellThickness: root.vertical ? root.width : root.height readonly property int cellThickness: root.vertical ? root.width : root.height
readonly property int rowsOrColumns: autoSize ? 1 : Math.max(1, Math.floor(cellThickness / (smallIconSize + PlasmaCore.Units.smallSpacing))) readonly property int rowsOrColumns: autoSize ? 1 : Math.max(1, Math.min(tasksGrid.count, Math.floor(cellThickness / (smallIconSize + PlasmaCore.Units.smallSpacing))))
property alias expanded: dialog.visible property alias expanded: dialog.visible
property Item activeApplet property Item activeApplet
property alias visibleLayout: tasksGrid property alias visibleLayout: tasksGrid
...@@ -149,9 +149,8 @@ MouseArea { ...@@ -149,9 +149,8 @@ MouseArea {
id: tasksGrid id: tasksGrid
readonly property int smallSizeCellLength: root.cellThickness >= root.smallIconSize ? root.smallIconSize + units.smallSpacing * 2 readonly property int smallSizeCellLength: root.cellThickness >= root.smallIconSize ? root.smallIconSize + units.smallSpacing * 2
: root.smallIconSize : root.smallIconSize
readonly property int autoSizeCellLength: root.cellThickness / root.rowsOrColumns readonly property int totalLength: root.vertical ? cellHeight * Math.ceil(count / root.rowsOrColumns)
readonly property int totalLength: root.vertical ? cellHeight * Math.round(count / root.rowsOrColumns) : cellWidth * Math.ceil(count / root.rowsOrColumns)
: cellWidth * Math.round(count / root.rowsOrColumns)
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
...@@ -161,8 +160,20 @@ MouseArea { ...@@ -161,8 +160,20 @@ MouseArea {
implicitHeight: root.vertical ? totalLength : root.height implicitHeight: root.vertical ? totalLength : root.height
implicitWidth: !root.vertical ? totalLength : root.width implicitWidth: !root.vertical ? totalLength : root.width
cellHeight: root.vertical && !root.autoSize ? smallSizeCellLength : autoSizeCellLength cellHeight: {
cellWidth: !root.vertical && !root.autoSize ? smallSizeCellLength : autoSizeCellLength if (root.vertical) {
return root.autoSize ? root.width : smallSizeCellLength
} else {
return root.autoSize ? root.height : Math.floor(root.height / root.rowsOrColumns)
}
}
cellWidth: {
if (root.vertical) {
return root.autoSize ? root.width : Math.floor(root.width / root.rowsOrColumns)
} else {
return root.autoSize ? root.height : smallSizeCellLength
}
}
model: PlasmaCore.SortFilterModel { model: PlasmaCore.SortFilterModel {
sourceModel: plasmoid.nativeInterface.systemTrayModel sourceModel: plasmoid.nativeInterface.systemTrayModel
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment