Changeset View
Changeset View
Standalone View
Standalone View
applets/systemtray/package/contents/ui/main.qml
Show All 35 Lines | 29 | MouseArea { | |||
---|---|---|---|---|---|
36 | Layout.preferredHeight: Layout.minimumHeight | 36 | Layout.preferredHeight: Layout.minimumHeight | ||
37 | LayoutMirroring.enabled: !vertical && Qt.application.layoutDirection === Qt.RightToLeft | 37 | LayoutMirroring.enabled: !vertical && Qt.application.layoutDirection === Qt.RightToLeft | ||
38 | LayoutMirroring.childrenInherit: true | 38 | LayoutMirroring.childrenInherit: true | ||
39 | 39 | | |||
40 | property var iconSizes: ["small", "smallMedium", "medium", "large", "huge", "enormous"]; | 40 | property var iconSizes: ["small", "smallMedium", "medium", "large", "huge", "enormous"]; | ||
41 | property int iconSize: plasmoid.configuration.iconSize + (Kirigami.Settings.tabletMode ? 1 : 0) | 41 | property int iconSize: plasmoid.configuration.iconSize + (Kirigami.Settings.tabletMode ? 1 : 0) | ||
42 | 42 | | |||
43 | property bool vertical: plasmoid.formFactor === PlasmaCore.Types.Vertical | 43 | property bool vertical: plasmoid.formFactor === PlasmaCore.Types.Vertical | ||
44 | readonly property int itemSize: units.roundToIconSize(Math.min(Math.min(width, height), units.iconSizes[iconSizes[Math.min(iconSizes.length-1, iconSize)]])) | 44 | readonly property int itemSize: { | ||
45 | if (Kirigami.Settings.tabletMode) { | ||||
46 | // Set the tray items' clickable areas on the panel to be bigger than normal to allow for easier touchability | ||||
47 | return units.roundToIconSize(Math.min(Math.min(width, height), units.iconSizes[iconSizes[Math.min(iconSizes.length-1, iconSize)]])) + units.smallSpacing; | ||||
ngraham: Rather than repeating this long calculation twice, assign it to a variable called `baseSize` or… | |||||
48 | } else { | ||||
49 | return units.roundToIconSize(Math.min(Math.min(width, height), units.iconSizes[iconSizes[Math.min(iconSizes.length-1, iconSize)]])); | ||||
50 | } | ||||
51 | } | ||||
this doesn't need to be a property; just make it a variable (var baseSize = ...) inside the new inline function itself. ngraham: this doesn't need to be a property; just make it a variable (`var baseSize = ...`) inside the… | |||||
45 | property int hiddenItemSize: units.iconSizes.smallMedium | 52 | property int hiddenItemSize: units.iconSizes.smallMedium | ||
46 | property alias expanded: dialog.visible | 53 | property alias expanded: dialog.visible | ||
47 | property Item activeApplet | 54 | property Item activeApplet | ||
48 | property int status: dialog.visible ? PlasmaCore.Types.RequiresAttentionStatus : PlasmaCore.Types.PassiveStatus | 55 | property int status: dialog.visible ? PlasmaCore.Types.RequiresAttentionStatus : PlasmaCore.Types.PassiveStatus | ||
49 | 56 | | |||
50 | property alias visibleLayout: tasksRow | 57 | property alias visibleLayout: tasksRow | ||
51 | property alias hiddenLayout: expandedRepresentation.hiddenLayout | 58 | property alias hiddenLayout: expandedRepresentation.hiddenLayout | ||
52 | 59 | | |||
▲ Show 20 Lines • Show All 309 Lines • Show Last 20 Lines |
Rather than repeating this long calculation twice, assign it to a variable called baseSize or something and then vary it in the return statements:
Also keep in mind that adding units.smallSpacing once will result in half that value amount being added to all sides. If you want to add units.smallSpacing to all sides, you'll need to add units.smallSpacing * 2