mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 21:56:43 +08:00
Utility function for screen geometry
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
#include <QAction>
|
||||
#include <QCloseEvent>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QCommandLineParser>
|
||||
#include <QDesktopServices>
|
||||
#include <QDir>
|
||||
@@ -290,6 +291,20 @@ namespace BlackGui
|
||||
return CGuiUtility::isUsingHighDpiScreenSupport();
|
||||
}
|
||||
|
||||
QScreen *CGuiApplication::currentScreen()
|
||||
{
|
||||
QWidget *w = CGuiApplication::mainApplicationWidget();
|
||||
const int s = QApplication::desktop()->screenNumber(w);
|
||||
if (s < QGuiApplication::screens().size()) { return QGuiApplication::screens()[s]; }
|
||||
return QGuiApplication::primaryScreen();
|
||||
}
|
||||
|
||||
QRect CGuiApplication::currentScreenGeometry()
|
||||
{
|
||||
const QScreen *s = currentScreen();
|
||||
return s->geometry();
|
||||
}
|
||||
|
||||
bool CGuiApplication::saveWindowGeometryAndState(const QMainWindow *window) const
|
||||
{
|
||||
if (!window) { return false; }
|
||||
|
||||
Reference in New Issue
Block a user