mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
refs #608, generic menus are now available via CGuiApplication and don`t have to be redefined over and over again
This commit is contained in:
committed by
Mathew Sutcliffe
parent
bf9ea12a2b
commit
bcb00b1b91
@@ -32,7 +32,7 @@ namespace BlackGui
|
||||
{
|
||||
CEnableForFramelessWindow *CGuiUtility::mainFramelessEnabledApplicationWindow()
|
||||
{
|
||||
QWidgetList tlw = topLevelApplicationWidgetsWithName();
|
||||
const QWidgetList tlw = topLevelApplicationWidgetsWithName();
|
||||
for (QWidget *w : tlw)
|
||||
{
|
||||
// best choice is to check on frameless window
|
||||
@@ -51,13 +51,12 @@ namespace BlackGui
|
||||
}
|
||||
|
||||
// second choice, try via QMainWindow
|
||||
QWidgetList tlw = topLevelApplicationWidgetsWithName();
|
||||
const QWidgetList tlw = topLevelApplicationWidgetsWithName();
|
||||
for (QWidget *w : tlw)
|
||||
{
|
||||
QMainWindow *qmw = qobject_cast<QMainWindow *>(w);
|
||||
if (!qmw) { continue; }
|
||||
if (!qmw->parentWidget()) { return qmw; }
|
||||
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@@ -241,4 +240,30 @@ namespace BlackGui
|
||||
// then finally
|
||||
delete layout;
|
||||
}
|
||||
|
||||
bool CGuiUtility::staysOnTop(QWidget *widget)
|
||||
{
|
||||
if (!widget) { return false; }
|
||||
const Qt::WindowFlags flags = widget->windowFlags();
|
||||
return Qt::WindowStaysOnTopHint & flags;
|
||||
}
|
||||
|
||||
bool CGuiUtility::toggleStayOnTop(QWidget *widget)
|
||||
{
|
||||
if (!widget) { return false; }
|
||||
Qt::WindowFlags flags = widget->windowFlags();
|
||||
if (Qt::WindowStaysOnTopHint & flags)
|
||||
{
|
||||
flags ^= Qt::WindowStaysOnTopHint;
|
||||
flags |= Qt::WindowStaysOnBottomHint;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags ^= Qt::WindowStaysOnBottomHint;
|
||||
flags |= Qt::WindowStaysOnTopHint;
|
||||
}
|
||||
widget->setWindowFlags(flags);
|
||||
widget->show();
|
||||
return Qt::WindowStaysOnTopHint & flags;
|
||||
}
|
||||
} // ns
|
||||
|
||||
Reference in New Issue
Block a user