fix(src/windows): 修改维哈柯语言下开始菜单的窗口位置
This commit is contained in:
parent
1f835391a7
commit
a572701984
|
@ -41,6 +41,7 @@ Item {
|
|||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
elide: Text.ElideRight
|
||||
text: root.title === "" ? header.title : root.title
|
||||
}
|
||||
|
|
|
@ -233,6 +233,7 @@ void MenuWindow::init()
|
|||
});
|
||||
setScreen(QGuiApplication::primaryScreen());
|
||||
connect(screen(), &QScreen::geometryChanged, this, &MenuWindow::updateGeometry);
|
||||
connect(qGuiApp, &QGuiApplication::layoutDirectionChanged, this, &MenuWindow::updateGeometry);
|
||||
|
||||
setTitle(QCoreApplication::applicationName());
|
||||
setResizeMode(SizeRootObjectToView);
|
||||
|
@ -423,6 +424,7 @@ void MenuWindow::updateCurrentScreenGeometry()
|
|||
int height = MenuSetting::instance()->get(MENU_HEIGHT).toInt();
|
||||
int margin = MenuSetting::instance()->get(MENU_MARGIN).toInt();
|
||||
UkuiQuick::WindowProxy::SlideFromEdge slideFromEdge;
|
||||
bool isMirrored = qGuiApp->layoutDirection() == Qt::LayoutDirection::RightToLeft;
|
||||
|
||||
//上: 1, 下: 0, 左: 2, 右: 3
|
||||
switch (m_panelPos) {
|
||||
|
@ -431,7 +433,11 @@ void MenuWindow::updateCurrentScreenGeometry()
|
|||
fullRect.adjust(0, 0, 0, -m_panelSize);
|
||||
|
||||
QSize normalSize(qMin<int>(fullRect.width() - margin*2, width), qMin<int>(fullRect.height() - margin*2, height));
|
||||
if (isMirrored) {
|
||||
normalMaskRect.setTopLeft({fullRect.width() - margin - width, fullRect.height() - normalSize.height() - margin});
|
||||
} else {
|
||||
normalMaskRect.setTopLeft({margin, fullRect.height() - normalSize.height() - margin});
|
||||
}
|
||||
normalMaskRect.setSize(normalSize);
|
||||
slideFromEdge = UkuiQuick::WindowProxy::BottomEdge;
|
||||
break;
|
||||
|
@ -439,8 +445,13 @@ void MenuWindow::updateCurrentScreenGeometry()
|
|||
case 1: {
|
||||
fullRect.adjust(0, m_panelSize, 0, 0);
|
||||
|
||||
QSize normalSize(qMin<int>(fullRect.width() - margin*2, width), qMin<int>(fullRect.height() - margin*2, height));
|
||||
if (isMirrored) {
|
||||
normalMaskRect.setTopLeft({fullRect.width() - margin - width, margin});
|
||||
} else {
|
||||
normalMaskRect.setTopLeft({margin, margin});
|
||||
normalMaskRect.setSize({qMin<int>(fullRect.width() - margin*2, width), qMin<int>(fullRect.height() - margin*2, height)});
|
||||
}
|
||||
normalMaskRect.setSize(normalSize);
|
||||
slideFromEdge = UkuiQuick::WindowProxy::TopEdge;
|
||||
break;
|
||||
}
|
||||
|
@ -490,6 +501,7 @@ void MenuWindow::activeMenuWindow(bool active)
|
|||
}
|
||||
this->setScreen(UkuiQuick::WindowProxy::currentScreen());
|
||||
connect(screen(), &QScreen::geometryChanged, this, &MenuWindow::updateGeometry);
|
||||
connect(qGuiApp, &QGuiApplication::layoutDirectionChanged, this, &MenuWindow::updateGeometry);
|
||||
updateGeometry();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue