systemtray items respect Fitt's Law when in panel

--systemtray items are now using a rectangular form
in order to specify their hit area. So they take into
account the panel thickness in order to calculate
properly their cell length and thickness to
respect Fitt's Law. Items that are nearer to the
screen edge can now trigger all their events when
the user uses its mouse at the farest of the screen edge.
wilder-portage-prov
Michail Vourlakos 6 years ago committed by Nate Graham
parent 72cebd84c9
commit fd78da890b
  1. 4
      applets/systemtray/package/contents/ui/items/AbstractItem.qml
  2. 15
      applets/systemtray/package/contents/ui/main.qml

@ -136,8 +136,8 @@ PlasmaCore.ToolTipArea {
readonly property int size: abstractItem.inVisibleLayout ? root.itemSize : units.iconSizes.medium
Layout.alignment: Qt.AlignHCenter
implicitWidth: size
implicitHeight: size
implicitWidth: root.vertical && abstractItem.inVisibleLayout ? abstractItem.width : size
implicitHeight: !root.vertical && abstractItem.inVisibleLayout ? abstractItem.height : size
Layout.topMargin: abstractItem.inHiddenLayout ? units.smallSpacing : 0
}
PlasmaComponents.Label {

@ -156,13 +156,14 @@ 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
readonly property int columns: !vertical ? Math.ceil(count / rows)
: Math.max(1, Math.floor(root.width / cellWidth))
readonly property int rows: vertical ? Math.ceil(count / columns)
: Math.max(1, Math.floor(root.height / cellHeight))
cellHeight: vertical ? cellLength : root.height / rows
cellWidth: vertical ? root.width / columns : cellLength
readonly property int cellLength: root.itemSize + units.smallSpacing
readonly property int columns: !vertical ? Math.ceil(count / rows) :
Math.max(1, Math.floor(root.width / cellLength))
readonly property int rows: vertical ? Math.ceil(count / columns) :
Math.max(1, Math.floor(root.height / cellLength))
implicitHeight: rows * cellHeight
implicitWidth: columns * cellWidth

Loading…
Cancel
Save