Commit 85f646eb authored by Konrad Materka's avatar Konrad Materka

[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
parent 3609f66a
......@@ -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))
......
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