diff --git a/qml/AppUI/AppListHeader.qml b/qml/AppUI/AppListHeader.qml index 54bacac..c80e004 100644 --- a/qml/AppUI/AppListHeader.qml +++ b/qml/AppUI/AppListHeader.qml @@ -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 } diff --git a/src/windows/menu-main-window.cpp b/src/windows/menu-main-window.cpp index c616703..0c6eb36 100644 --- a/src/windows/menu-main-window.cpp +++ b/src/windows/menu-main-window.cpp @@ -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(fullRect.width() - margin*2, width), qMin(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); slideFromEdge = UkuiQuick::WindowProxy::BottomEdge; break; @@ -439,8 +445,13 @@ void MenuWindow::updateCurrentScreenGeometry() case 1: { fullRect.adjust(0, m_panelSize, 0, 0); - normalMaskRect.setTopLeft({margin, margin}); - normalMaskRect.setSize({qMin(fullRect.width() - margin*2, width), qMin(fullRect.height() - margin*2, height)}); + QSize normalSize(qMin(fullRect.width() - margin*2, width), qMin(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; 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(); } }