diff --git a/qml/AppUI/FullScreenAppList.qml b/qml/AppUI/FullScreenAppList.qml index ab367e7..144763e 100644 --- a/qml/AppUI/FullScreenAppList.qml +++ b/qml/AppUI/FullScreenAppList.qml @@ -38,8 +38,9 @@ ListView { property int itemHeight: 40 property alias sourceModel: appGroupModel.sourceModel - // TODO: 动态计算尺寸 - property int column: 10 + property int cellWidth: 180 + property int cellHeight: 180 + property int column: Math.floor(width / cellWidth) spacing: 5 clip: true @@ -66,10 +67,11 @@ ListView { } GridView { - width: parent.width - height: childrenRect.height - cellWidth: width / root.column - cellHeight: cellWidth + anchors.horizontalCenter: parent.horizontalCenter + width: root.cellWidth * root.column + height: contentHeight + cellWidth: root.cellWidth + cellHeight: root.cellHeight interactive: false model: DelegateModel { @@ -237,7 +239,8 @@ ListView { GridView { id: favoriteView - width: parent.width + anchors.horizontalCenter: parent.horizontalCenter + width: root.cellWidth * root.column height: contentHeight property string mergeToAppId: "" property bool isMergeToFolder: false @@ -245,8 +248,8 @@ ListView { property int exchangedStartIndex: 0 property alias viewModel: visualModel - cellWidth: width / root.column - cellHeight: cellWidth + cellWidth: root.cellWidth + cellHeight: root.cellHeight interactive: false function indexAtNullItem() { diff --git a/qml/AppUI/FullScreenUI.qml b/qml/AppUI/FullScreenUI.qml index c57732c..3428954 100644 --- a/qml/AppUI/FullScreenUI.qml +++ b/qml/AppUI/FullScreenUI.qml @@ -164,11 +164,13 @@ FocusScope { anchors.centerIn: parent width: 120 height: parent.height + clip: true AppLabelPage { id: appLabelPage anchors.centerIn: parent + height: (contentHeight > parent.height) ? parent.height : contentHeight width: parent.width labelBottle: AppPageBackend.appModel.labelBottle labelColum: 1 @@ -196,7 +198,8 @@ FocusScope { return []; } - interactive: height > parent.height + boundsBehavior: Flickable.StopAtBounds + interactive: height >= parent.height highlightMoveDuration: 300 highlight: UkuiItems.StyleBackground { width: appLabelPage.cellWidth @@ -262,4 +265,3 @@ FocusScope { } } - diff --git a/src/windows/menu-main-window.cpp b/src/windows/menu-main-window.cpp index 21ae086..414ed11 100644 --- a/src/windows/menu-main-window.cpp +++ b/src/windows/menu-main-window.cpp @@ -100,21 +100,16 @@ void WindowGeometryHelper::updateGeometry() int height = MenuSetting::instance()->get(MENU_HEIGHT).toInt(); int margin = MenuSetting::instance()->get(MENU_MARGIN).toInt(); - if (width > screenRect.width()) { - width = screenRect.width(); - } - if (height > screenRect.height()) { - height = screenRect.height(); - } - //上: 1, 下: 0, 左: 2, 右: 3 switch (m_panelPos) { + default: case 0: { fullRect.setTopLeft(screenRect.topLeft()); fullRect.setSize({screenRect.width(), screenRect.height() - m_panelSize}); - normalMaskRect.setTopLeft({margin, screenRect.height() - height - margin - m_panelSize}); - normalMaskRect.setSize({width, height}); + QSize normalSize(qMin(fullRect.width() - margin*2, width), qMin(fullRect.height() - margin*2, height)); + normalMaskRect.setTopLeft({margin, fullRect.height() - normalSize.height() - margin}); + normalMaskRect.setSize(normalSize); break; } case 1: { @@ -122,8 +117,7 @@ void WindowGeometryHelper::updateGeometry() fullRect.setSize({screenRect.width(), screenRect.height() - m_panelSize}); normalMaskRect.setTopLeft({margin, margin}); - normalMaskRect.setSize({width, height}); - + normalMaskRect.setSize({qMin(fullRect.width() - margin*2, width), qMin(fullRect.height() - margin*2, height)}); break; } case 2: { @@ -131,26 +125,16 @@ void WindowGeometryHelper::updateGeometry() fullRect.setSize({screenRect.width() - m_panelSize, screenRect.height()}); normalMaskRect.setTopLeft({margin, margin}); - normalMaskRect.setSize({width, height}); - + normalMaskRect.setSize({qMin(fullRect.width() - margin*2, width), qMin(fullRect.height() - margin*2, height)}); break; } case 3: { fullRect.setTopLeft(screenRect.topLeft()); fullRect.setSize({screenRect.width() - m_panelSize, screenRect.height()}); - normalMaskRect.setTopLeft({screenRect.width() - width - margin - m_panelSize, margin}); - normalMaskRect.setSize({width, height}); - - break; - } - default: { - fullRect.setTopLeft({screenRect.x(), screenRect.y()}); - fullRect.setSize({screenRect.width(), screenRect.height()}); - - normalMaskRect.setTopLeft({margin, screenRect.height() - height - margin - m_panelSize}); - normalMaskRect.setSize({width, height}); - + QSize normalSize(qMin(fullRect.width() - margin*2, width), qMin(fullRect.height() - margin*2, height)); + normalMaskRect.setTopLeft({fullRect.width() - normalSize.width() - margin, margin}); + normalMaskRect.setSize(normalSize); break; } }