Ref T747, combine "on top" with window to front

This commit is contained in:
Klaus Basan
2019-11-03 21:22:55 +01:00
committed by Mat Sutcliffe
parent 336ad1c160
commit 109827b5c4
2 changed files with 19 additions and 5 deletions

View File

@@ -1177,20 +1177,33 @@ namespace BlackGui
if (this->isShuttingDown()) { return; }
QMainWindow *w = sGui->mainApplicationWindow();
if (!w) { return; }
m_frontBack = true;
w->showNormal(); // bring window to top on OSX
w->raise(); // bring window from minimized state on OSX
w->activateWindow(); // bring window to front/unminimize on windows
// In order to show also on top if another window is (permanent) on top
if (!CGuiUtility::staysOnTop(w))
{
CGuiUtility::stayOnTop(true, w);
emit this->alwaysOnTop(true);
}
// w->activateWindow(); // bring window to front/unminimize on windows
}
void CGuiApplication::windowToBack()
{
if (this->isShuttingDown()) { return; }
m_frontBack = false;
QMainWindow *w = this->mainApplicationWindow();
if (!w) { return; }
if (CGuiUtility::staysOnTop(w)) { CGuiUtility::stayOnTop(false, w); }
m_frontBack = false;
if (CGuiUtility::staysOnTop(w))
{
CGuiUtility::stayOnTop(false, w);
emit this->alwaysOnTop(false);
}
w->lower();
}

View File

@@ -512,7 +512,7 @@ namespace BlackGui
flags |= Qt::WindowStaysOnTopHint;
}
widget->setWindowFlags(flags);
widget->show();
widget->show(); // without that the window sometimes just disappears
return Qt::WindowStaysOnTopHint & flags;
}
@@ -531,6 +531,7 @@ namespace BlackGui
// flags |= Qt::WindowStaysOnBottomHint;
}
widget->setWindowFlags(flags);
widget->show(); // without that the window sometimes just disappears
return onTop;
}
@@ -552,7 +553,7 @@ namespace BlackGui
Q_ASSERT_X(ok, Q_FUNC_INFO, "malformed number");
const int b = parts.at(3).toInt(&ok);
Q_ASSERT_X(ok, Q_FUNC_INFO, "malformed number");
Q_UNUSED(ok);
Q_UNUSED(ok)
return QMargins(l, t, r, b);
}