Commit a0dee59d authored by Xuetian Weng's avatar Xuetian Weng

Implement the new panel icon size ceiling also for Input Method Panel.

Summary:
It was done for various other applets but not this.

BUG:378443

Reviewers: #plasma, mart, broulik, hein

Reviewed By: #plasma, hein

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D5962
parent 32055b0b
......@@ -27,50 +27,53 @@ Item {
id: kimpanel
property int visibleButtons: 0
Layout.minimumWidth: vertical ? 0 : height * visibleButtons
Layout.minimumHeight: vertical ? width * visibleButtons : 0
Layout.preferredWidth: Layout.minimumWidth
Layout.preferredHeight: Layout.minimumHeight
property bool vertical: plasmoid.formFactor == PlasmaCore.Types.Vertical
LayoutMirroring.enabled: !vertical && Qt.application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true
Layout.minimumWidth: vertical ? units.iconSizes.small : items.implicitWidth
Layout.minimumHeight: !vertical ? units.iconSizes.small : items.implicitHeight
Layout.preferredHeight: Layout.minimumHeight
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
InputPanel { }
GridView {
Flow {
id: items
property int itemWidth: !kimpanel.vertical ? Math.floor(parent.width/visibleButtons) : parent.width
property int itemHeight: kimpanel.vertical ? Math.floor(parent.height/visibleButtons) : parent.height
property int iconSize: Math.min(itemWidth, itemHeight)
anchors.fill: parent
cellWidth: itemWidth
cellHeight: itemHeight
interactive: false
model: ListModel {
id: list
dynamicRoles: true
}
width: parent.width
height: parent.height
x: (parent.width - childrenRect.width) / 2
y: (parent.height - childrenRect.height) / 2
flow: kimpanel.vertical ? Flow.LeftToRight : Flow.TopToBottom
property int iconSize: Math.min(units.iconSizeHints.panel, units.roundToIconSize(Math.min(width, height)))
Repeater {
model: ListModel {
id: list
dynamicRoles: true
}
delegate: Item {
id: iconDelegate
width: items.itemWidth
height: items.itemHeight
StatusIcon {
id: statusIcon
anchors.centerIn: parent
delegate: Item {
id: iconDelegate
width: items.iconSize
height: items.iconSize
label: model.label
tip: model.tip
icon: model.icon
hint: model.hint
onTriggered : {
if (button == Qt.LeftButton) {
clickHandler(model.key)
} else {
contextMenu.open(statusIcon, {key: model.key, label: model.label});
StatusIcon {
id: statusIcon
anchors.centerIn: parent
width: items.iconSize
height: items.iconSize
label: model.label
tip: model.tip
icon: model.icon
hint: model.hint
onTriggered : {
if (button == Qt.LeftButton) {
clickHandler(model.key)
} else {
contextMenu.open(statusIcon, {key: model.key, label: model.label});
}
}
}
}
......
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