优化窗口属性设置逻辑

This commit is contained in:
hewenfei 2023-05-06 17:43:42 +08:00 committed by He Sir
parent da6611ca65
commit 07410beab5
1 changed files with 14 additions and 2 deletions

View File

@ -395,7 +395,7 @@ void MenuWindow::init()
setColor("transparent"); setColor("transparent");
// setFlags(Qt::FramelessWindowHint); // setFlags(Qt::FramelessWindowHint);
setFlag(Qt::WindowStaysOnTopHint); setFlags(Qt::Window | Qt::WindowStaysOnTopHint);
WindowHelper::setWindowAttribute(this); WindowHelper::setWindowAttribute(this);
WindowHelper::removeHeaderBar(this); WindowHelper::removeHeaderBar(this);
WindowHelper::windowBlur(this, true); WindowHelper::windowBlur(this, true);
@ -429,6 +429,12 @@ void MenuWindow::updateGeometry()
return; return;
} }
if (m_isFullScreen) {
setMaximumSize(rect.size());
} else {
setMinimumSize(rect.size());
}
WindowHelper::setWindowGeometry(this, rect); WindowHelper::setWindowGeometry(this, rect);
setMinimumSize(geometry().size()); setMinimumSize(geometry().size());
setMaximumSize(geometry().size()); setMaximumSize(geometry().size());
@ -486,7 +492,13 @@ void MenuWindow::enableWindowBlur(bool enable)
void MenuWindow::exposeEvent(QExposeEvent *event) void MenuWindow::exposeEvent(QExposeEvent *event)
{ {
if (isExposed()) { if (isExposed()) {
if (QX11Info::isPlatformX11()) {
requestActivate(); requestActivate();
} else {
WindowHelper::setWindowAttribute(this);
// WindowHelper::removeHeaderBar(this);
updateGeometry();
}
} }
QQuickView::exposeEvent(event); QQuickView::exposeEvent(event);
} }