ui: 优化全屏界面应用列表布局,限制开始菜单尺寸在屏幕区域内

This commit is contained in:
hewenfei 2024-03-08 17:51:44 +08:00 committed by He Sir
parent d8a63029d7
commit e51dc6fa86
3 changed files with 25 additions and 36 deletions

View File

@ -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() {

View File

@ -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 {
}
}

View File

@ -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<int>(fullRect.width() - margin*2, width), qMin<int>(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<int>(fullRect.width() - margin*2, width), qMin<int>(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<int>(fullRect.width() - margin*2, width), qMin<int>(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<int>(fullRect.width() - margin*2, width), qMin<int>(fullRect.height() - margin*2, height));
normalMaskRect.setTopLeft({fullRect.width() - normalSize.width() - margin, margin});
normalMaskRect.setSize(normalSize);
break;
}
}