forked from qt-creator/qt-creator
Automatically choose device pixel ratio
Change-Id: Ic595ee0f45b7d3ec22b4c4086c0c6785b41c21f4 Task-number: QTCREATORBUG-11179 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -45,6 +45,7 @@
|
|||||||
#include <QLibraryInfo>
|
#include <QLibraryInfo>
|
||||||
#include <QLoggingCategory>
|
#include <QLoggingCategory>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QStyle>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QThreadPool>
|
#include <QThreadPool>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
@@ -291,6 +292,8 @@ static inline QSettings *userSettings()
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
if (!qEnvironmentVariableIsSet("QT_DEVICE_PIXEL_RATIO"))
|
||||||
|
qputenv("QT_DEVICE_PIXEL_RATIO", "auto");
|
||||||
QLoggingCategory::setFilterRules(QLatin1String("qtc.*.debug=false"));
|
QLoggingCategory::setFilterRules(QLatin1String("qtc.*.debug=false"));
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
// increase the number of file that can be opened in Qt Creator.
|
// increase the number of file that can be opened in Qt Creator.
|
||||||
@@ -303,6 +306,11 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
SharedTools::QtSingleApplication app((QLatin1String(appNameC)), argc, argv);
|
SharedTools::QtSingleApplication app((QLatin1String(appNameC)), argc, argv);
|
||||||
|
|
||||||
|
if (!qFuzzyCompare(qApp->devicePixelRatio(), 1.0)
|
||||||
|
&& QApplication::style()->objectName().startsWith(
|
||||||
|
QLatin1String("windows"), Qt::CaseInsensitive)) {
|
||||||
|
QApplication::setStyle(QLatin1String("fusion"));
|
||||||
|
}
|
||||||
const int threadCount = QThreadPool::globalInstance()->maxThreadCount();
|
const int threadCount = QThreadPool::globalInstance()->maxThreadCount();
|
||||||
QThreadPool::globalInstance()->setMaxThreadCount(qMax(4, 2 * threadCount));
|
QThreadPool::globalInstance()->setMaxThreadCount(qMax(4, 2 * threadCount));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user