mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-29 15:03:09 +00:00
Fix launcher icon alignment
This commit is contained in:
parent
f1de836216
commit
32bcff515e
2 changed files with 45 additions and 32 deletions
|
|
@ -1,50 +1,63 @@
|
||||||
import QtQuick 2.5
|
import QtQuick 2.5
|
||||||
|
import QtQuick.Layouts 1.2
|
||||||
import org.kde.plasma.core 2.0 as PlasmaCore
|
import org.kde.plasma.core 2.0 as PlasmaCore
|
||||||
import org.kde.kio 1.0 as Kio
|
import org.kde.kio 1.0 as Kio
|
||||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
|
|
||||||
Column {
|
Item {
|
||||||
id: delegateRoot
|
id: delegateRoot
|
||||||
width: applicationsView.cellWidth
|
|
||||||
height: applicationsView.cellHeight
|
|
||||||
|
|
||||||
property int iconSize
|
property int iconSize
|
||||||
property var modelData: model
|
property var modelData: model
|
||||||
property bool isDropTarget: delegateRoot != dragDelegate && root.reorderingApps && applicationsView.dragData && applicationsView.dragData.ApplicationStorageIdRole == modelData.ApplicationStorageIdRole
|
property bool isDropTarget: delegateRoot != dragDelegate && root.reorderingApps && applicationsView.dragData && applicationsView.dragData.ApplicationStorageIdRole == modelData.ApplicationStorageIdRole
|
||||||
property alias maximumLineCount: label.maximumLineCount
|
property alias maximumLineCount: label.maximumLineCount
|
||||||
|
|
||||||
opacity: isDropTarget ? 0.3 : 1
|
width: applicationsView.cellWidth
|
||||||
|
height: applicationsView.cellHeight
|
||||||
|
|
||||||
PlasmaCore.IconItem {
|
ColumnLayout {
|
||||||
id: icon
|
anchors {
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
left: parent.left
|
||||||
width: delegateRoot.iconSize
|
right: parent.right
|
||||||
height: delegateRoot.iconSize
|
horizontalCenter: parent.horizonalCenter
|
||||||
usesPlasmaTheme: false
|
verticalCenter: parent.verticalCenter
|
||||||
source: modelData.ApplicationIconRole
|
}
|
||||||
scale: root.reorderingApps && applicationsView.dragData && applicationsView.dragData.ApplicationStorageIdRole != modelData.ApplicationStorageIdRole ? 0.6 : 1
|
opacity: isDropTarget ? 0.3 : 1
|
||||||
Behavior on scale {
|
|
||||||
NumberAnimation {
|
PlasmaCore.IconItem {
|
||||||
duration: units.longDuration
|
id: icon
|
||||||
easing.type: Easing.InOutQuad
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
Layout.preferredWidth: delegateRoot.iconSize
|
||||||
|
Layout.preferredHeight: delegateRoot.iconSize
|
||||||
|
usesPlasmaTheme: false
|
||||||
|
source: modelData.ApplicationIconRole
|
||||||
|
scale: root.reorderingApps && applicationsView.dragData && applicationsView.dragData.ApplicationStorageIdRole != modelData.ApplicationStorageIdRole ? 0.6 : 1
|
||||||
|
Behavior on scale {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: units.longDuration
|
||||||
|
easing.type: Easing.InOutQuad
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
PlasmaComponents.Label {
|
PlasmaComponents.Label {
|
||||||
id: label
|
id: label
|
||||||
visible: text.length > 0
|
visible: text.length > 0
|
||||||
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
Layout.alignment: Qt.AlignHCenter
|
||||||
width: icon.width
|
Layout.fillWidth: true
|
||||||
|
Layout.leftMargin: units.gridUnit
|
||||||
|
Layout.rightMargin: units.gridUnit
|
||||||
|
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
horizontalAlignment: Qt.AlignHCenter
|
horizontalAlignment: Qt.AlignHCenter
|
||||||
verticalAlignment: Qt.AlignVCenter
|
verticalAlignment: Qt.AlignVCenter
|
||||||
maximumLineCount: 2
|
maximumLineCount: 1
|
||||||
|
elide: Text.ElideRight
|
||||||
|
|
||||||
text: modelData.ApplicationNameRole
|
text: modelData.ApplicationNameRole
|
||||||
font.pixelSize: theme.defaultFont.pixelSize
|
font.pixelSize: theme.defaultFont.pixelSize
|
||||||
color: PlasmaCore.ColorScope.textColor
|
color: PlasmaCore.ColorScope.textColor
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,13 @@ PlasmaCore.ColorScope {
|
||||||
enabledBorders: PlasmaCore.FrameSvgItem.TopBorder | PlasmaCore.FrameSvgItem.BottomBorder
|
enabledBorders: PlasmaCore.FrameSvgItem.TopBorder | PlasmaCore.FrameSvgItem.BottomBorder
|
||||||
anchors {
|
anchors {
|
||||||
fill: parent
|
fill: parent
|
||||||
topMargin: -margins.top
|
topMargin: -margins.top / 2
|
||||||
bottomMargin: -margins.bottom
|
bottomMargin: -margins.bottom / 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//cut away one line from the favorites bar
|
//cut away one line from the favorites bar
|
||||||
height: applicationsView.cellHeight - units.gridUnit/2
|
height: applicationsView.cellHeight
|
||||||
width: parent.width
|
width: parent.width
|
||||||
y: parent.height / 2 - height / 2
|
y: parent.height / 2 - height / 2
|
||||||
x: 0
|
x: 0
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue