[SystemTray] Fix item size for very narrow panel

Summary:
For very narrow panel item size is too big (item + padding exceed panel size). This adds a check to not exceed panel size.
Before:
{F8167941}
After:
{F8167942}

Test Plan:
* Make panel very narrow - icons should fit into panel
* Repeat for vertical/horizontal

Reviewers: #plasma_workspaces, #plasma, ngraham, broulik

Reviewed By: ngraham

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D27958
wilder-portage-prov
Konrad Materka 6 years ago
parent 3609f66a98
commit 85f646eb56
  1. 16
      applets/systemtray/package/contents/ui/items/PlasmoidItem.qml
  2. 4
      applets/systemtray/package/contents/ui/main.qml

@ -54,7 +54,14 @@ AbstractItem {
onHeightChanged: {
if (applet) {
applet.width = height
applet.width = Math.min(plasmoidContainer.width, plasmoidContainer.height)
applet.height = applet.width
}
}
onWidthChanged: {
if (applet) {
applet.width = Math.min(plasmoidContainer.width, plasmoidContainer.height)
applet.height = applet.width
}
}
@ -71,11 +78,10 @@ AbstractItem {
if (applet) {
applet.parent = plasmoidContainer
applet.anchors.left = plasmoidContainer.left
applet.anchors.top = plasmoidContainer.top
applet.anchors.bottom = plasmoidContainer.bottom
applet.width = plasmoidContainer.height
applet.anchors.verticalCenter = plasmoidContainer.verticalCenter
applet.width = Math.min(plasmoidContainer.width, plasmoidContainer.height)
applet.height = applet.width
applet.visible = true
plasmoidContainer.visible = true
preloadFullRepresentationItem(applet.fullRepresentationItem)
}

@ -154,8 +154,8 @@ MouseArea {
interactive: false //disable features we don't need
flow: vertical ? GridView.LeftToRight : GridView.TopToBottom
cellHeight: root.itemSize + units.smallSpacing
cellWidth: root.itemSize + units.smallSpacing
cellHeight: Math.min(root.itemSize + units.smallSpacing, root.height)
cellWidth: Math.min(root.itemSize + units.smallSpacing, root.width)
readonly property int columns: !vertical ? Math.ceil(count / rows)
: Math.max(1, Math.floor(root.width / cellWidth))

Loading…
Cancel
Save