fix(src/windows): 调整快捷操作窗口在维哈柯语言下的位置
This commit is contained in:
parent
71134de84c
commit
8bc4d541e5
|
@ -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:
|
||||
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:
|
||||
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;
|
||||
|
|
|
@ -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};
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue