Adjust size

pull/4/head
cutefishd 5 years ago
parent 13932e9ca9
commit 2609450d98

@ -5,7 +5,8 @@ import Cutefish.Launcher 1.0
PageView {
id: gridView
property int iconSize: gridView.width * 0.1 + Meui.Units.largeSpacing * 2
property int iconSize: Math.max(64 + root.horizontalSpacing,
gridView.width * 0.1 + root.horizontalSpacing)
property int cellWidth: {
var extraWidth = calcExtraSpacing(iconSize, gridView.width)
@ -29,18 +30,13 @@ PageView {
LauncherGridDelegate {
id: delegate
anchors.fill: parent
anchors.margins: Meui.Units.smallSpacing
anchors.leftMargin: root.horizontalSpacing
anchors.rightMargin: root.horizontalSpacing
anchors.topMargin: root.verticalSpacing
anchors.bottomMargin: root.verticalSpacing
}
}
onWidthChanged: {
// gridView.adaptGrid()
}
onHeightChanged: {
// gridView.adaptGrid()
}
function calcExtraSpacing(cellSize, containerSize) {
var availableColumns = Math.floor(containerSize / cellSize);
var extraSpacing = 0;
@ -51,14 +47,4 @@ PageView {
}
return Math.floor(extraSpacing);
}
function adaptGrid() {
var fullWidth = gridView.width
var fullHeight = gridView.height
var cellSize = Math.max(144, gridView.height * 0.18)
gridView.cellWidth = cellSize + calcExtraSpacing(cellSize, fullWidth)
gridView.cellHeight = cellSize + calcExtraSpacing(cellSize, fullHeight)
}
}

@ -10,6 +10,9 @@ import MeuiKit 1.0 as Meui
Item {
id: root
property real horizontalSpacing: root.width * 0.01
property real verticalSpacing: root.height * 0.01
Wallpaper {
id: backend
}
@ -55,16 +58,16 @@ Item {
id: mainLayout
anchors.fill: parent
anchors.leftMargin: launcher.screenAvailableRect ? launcher.screenAvailableRect.x : 0
anchors.topMargin: launcher.screenAvailableRect ? launcher.screenAvailableRect.y + Meui.Units.largeSpacing * 4: 0
anchors.topMargin: launcher.screenAvailableRect ? launcher.screenAvailableRect.y + root.verticalSpacing * 3: 0
anchors.rightMargin: launcher.screenRect.width - (launcher.screenAvailableRect.x + launcher.screenAvailableRect.width)
anchors.bottomMargin: launcher.screenRect.height - (launcher.screenAvailableRect.y + launcher.screenAvailableRect.height - Meui.Units.largeSpacing * 2)
anchors.bottomMargin: launcher.screenRect.height - (launcher.screenAvailableRect.y + launcher.screenAvailableRect.height - root.verticalSpacing)
spacing: Meui.Units.largeSpacing * 2
spacing: root.verticalSpacing * 2
Item {
id: searchItem
Layout.fillWidth: true
height: fontMetrics.height + Meui.Units.largeSpacing * 2
height: fontMetrics.height + Meui.Units.largeSpacing
TextMetrics {
id: fontMetrics
@ -163,7 +166,7 @@ Item {
currentIndex: grid.currentPage
onCurrentIndexChanged: grid.currentPage = currentIndex
interactive: true
spacing: Meui.Units.largeSpacing
spacing: root.horizontalSpacing / 2
Layout.alignment: Qt.AlignHCenter
delegate: Rectangle {

Loading…
Cancel
Save