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