diff --git a/src/windows/shortcuts-window.cpp b/src/windows/shortcuts-window.cpp index b234ea3..14122aa 100644 --- a/src/windows/shortcuts-window.cpp +++ b/src/windows/shortcuts-window.cpp @@ -46,6 +46,7 @@ ShortcutsWindow::ShortcutsWindow(QWindow *parent) : SharedEngineView(parent) m_windowProxy = new UkuiQuick::WindowProxy2(this); // onPrimaryScreenChanged(QGuiApplication::primaryScreen()); m_isTabletMode = Sidebar::GlobalSettings::globalInstance()->getValue(TABLET_MODE).toBool(); + m_layoutDirection = QGuiApplication::layoutDirection(); // 加载数据 initUI(); @@ -112,6 +113,11 @@ void ShortcutsWindow::initConnections() activeShortcutsWindow(false); } }); + + //布局方向 + connect(qGuiApp, &QGuiApplication::layoutDirectionChanged, this, [this] { + m_layoutDirection = QGuiApplication::layoutDirection(); + }); } void ShortcutsWindow::resizeEvent(QResizeEvent *event) @@ -139,12 +145,20 @@ void ShortcutsWindow::updateGeometry() switch (m_panelPos) { default: case 0: - point.setX(rect.right() - width() - margin); + if (m_layoutDirection == Qt::LayoutDirection::RightToLeft) { + point.setX(rect.left() + margin); + } else { + point.setX(rect.right() - width() - margin); + } point.setY(rect.bottom() - height() - margin - m_panelSize); slideFromEdge = UkuiQuick::WindowProxy::BottomEdge; break; case 1: - point.setX(rect.right() - width() - margin); + if (m_layoutDirection == Qt::LayoutDirection::RightToLeft) { + point.setX(rect.left() + margin); + } else { + point.setX(rect.right() - width() - margin); + } point.setY(rect.top() + margin + m_panelSize); slideFromEdge = UkuiQuick::WindowProxy::TopEdge; break; diff --git a/src/windows/shortcuts-window.h b/src/windows/shortcuts-window.h index 370f504..27c640d 100644 --- a/src/windows/shortcuts-window.h +++ b/src/windows/shortcuts-window.h @@ -65,6 +65,7 @@ private: bool m_isTabletMode {false}; int m_panelPos{4}; int m_panelSize{48}; + Qt::LayoutDirection m_layoutDirection{Qt::LayoutDirection::LeftToRight}; UkuiQuick::WindowProxy2 *m_windowProxy {nullptr}; };