mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 20:15:35 +08:00
Allows to use a scale factor on high DPI screens
This commit is contained in:
@@ -50,10 +50,10 @@
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="BlackGui::CLoginModeButtons" name="frp_LoginMode"/>
|
||||
</item>
|
||||
<item>
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QTabWidget" name="tw_Network">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -254,7 +254,7 @@
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="BlackGui::Editors::CPilotForm" name="editor_Pilot">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
@@ -267,7 +267,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QGroupBox" name="gb_OwnAircraft">
|
||||
<property name="title">
|
||||
<string>Own aircraft</string>
|
||||
@@ -507,7 +507,7 @@
|
||||
<property name="bottomMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<item>
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QGroupBox" name="gb_CurrentLogin">
|
||||
<property name="title">
|
||||
<string>Current server and aircraft</string>
|
||||
|
||||
@@ -247,9 +247,19 @@ namespace BlackGui
|
||||
CApplication::exit(retcode);
|
||||
}
|
||||
|
||||
void CGuiApplication::highDpiScreenSupport()
|
||||
void CGuiApplication::highDpiScreenSupport(qreal scaleFactor)
|
||||
{
|
||||
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1");
|
||||
if (scaleFactor < 0)
|
||||
{
|
||||
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1");
|
||||
}
|
||||
else
|
||||
{
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); //HiDPI pixmaps
|
||||
const QString sf = QString::number(scaleFactor, 'f', 2);
|
||||
qputenv("QT_SCALE_FACTOR", sf.toLatin1());
|
||||
}
|
||||
}
|
||||
|
||||
bool CGuiApplication::isUsingHighDpiScreenSupport()
|
||||
|
||||
@@ -228,7 +228,7 @@ namespace BlackGui
|
||||
|
||||
//! Support for high DPI screens
|
||||
//! \note Needs to be at the beginning of main
|
||||
static void highDpiScreenSupport();
|
||||
static void highDpiScreenSupport(qreal scaleFactor = -1);
|
||||
|
||||
//! Uses the high DPI support?
|
||||
static bool isUsingHighDpiScreenSupport();
|
||||
|
||||
Reference in New Issue
Block a user