Commit 13f2a105 authored by Devin Lin's avatar Devin Lin 🎨
Browse files

homescreens/default: Use external margins on grid view and adjust spacing

parent d0291cb2
......@@ -21,9 +21,11 @@ MouseArea {
id: delegate
width: GridView.view.cellWidth
height: GridView.view.cellHeight
property int reservedSpaceForLabel
property alias iconItem: icon
readonly property real margins: Math.floor(width * 0.2)
signal launch(int x, int y, var source, string title, string storageId)
signal dragStarted(string imageSource, int x, int y, string mimeData)
......@@ -97,10 +99,10 @@ MouseArea {
ColumnLayout {
anchors {
fill: parent
leftMargin: PlasmaCore.Units.smallSpacing * 2
topMargin: PlasmaCore.Units.smallSpacing * 2
rightMargin: PlasmaCore.Units.smallSpacing * 2
bottomMargin: PlasmaCore.Units.smallSpacing * 2
leftMargin: margins
topMargin: margins
rightMargin: margins
bottomMargin: margins
}
spacing: 0
......@@ -109,7 +111,7 @@ MouseArea {
Layout.alignment: Qt.AlignHCenter | Qt.AlignTop
Layout.fillWidth: true
Layout.minimumHeight: parent.height - delegate.reservedSpaceForLabel
Layout.minimumHeight: Math.floor(parent.height - delegate.reservedSpaceForLabel)
Layout.preferredHeight: Layout.minimumHeight
usesPlasmaTheme: false
......@@ -143,8 +145,8 @@ MouseArea {
Layout.fillWidth: true
Layout.preferredHeight: delegate.reservedSpaceForLabel
Layout.topMargin: PlasmaCore.Units.smallSpacing
Layout.leftMargin: -parent.anchors.leftMargin + PlasmaCore.Units.smallSpacing * 2
Layout.rightMargin: -parent.anchors.rightMargin + PlasmaCore.Units.smallSpacing * 2
Layout.leftMargin: -parent.anchors.leftMargin + PlasmaCore.Units.smallSpacing
Layout.rightMargin: -parent.anchors.rightMargin + PlasmaCore.Units.smallSpacing
wrapMode: Text.WordWrap
maximumLineCount: 2
......@@ -152,7 +154,7 @@ MouseArea {
verticalAlignment: Text.AlignTop
elide: Text.ElideRight
text: model.applicationName
text: model.applicationName
font.pointSize: theme.defaultFont.pointSize * 0.8
font.weight: Font.Bold
......
......@@ -34,11 +34,16 @@ AbstractAppDrawer {
*/
interactive: contentHeight <= height ? true : root.homeScreenState.appDrawerInteractive
cellWidth: root.contentWidth / Math.floor(root.contentWidth / ((root.availableCellHeight - root.reservedSpaceForLabel) + PlasmaCore.Units.smallSpacing*4))
cellHeight: root.availableCellHeight
readonly property real effectiveContentWidth: root.contentWidth - 2 * horizontalMargin
readonly property real horizontalMargin: root.width * 0.1 / 2
leftMargin: horizontalMargin
rightMargin: horizontalMargin
cellWidth: effectiveContentWidth / Math.min(Math.floor(effectiveContentWidth / (PlasmaCore.Units.iconSizes.huge + Kirigami.Units.largeSpacing * 2)), 8)
cellHeight: cellWidth + root.reservedSpaceForLabel
property int columns: Math.floor(root.contentWidth / cellWidth)
property int rows: Math.ceil(gridView.count / columns)
readonly property int columns: Math.floor(effectiveContentWidth / cellWidth)
readonly property int rows: Math.ceil(gridView.count / columns)
cacheBuffer: Math.max(0, rows * cellHeight)
......
Supports Markdown
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