High-DPI: Remove usage of Qt::AA_EnableHighDpiScaling
This attribute is now on by default. Change-Id: I7c9d2e3445d204d3450758673048d514bc9c850c Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
891fc4b42b
commit
dce106c77c
@ -55,7 +55,6 @@
|
|||||||
//! [0]
|
//! [0]
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
MandelbrotWidget widget;
|
MandelbrotWidget widget;
|
||||||
widget.show();
|
widget.show();
|
||||||
|
@ -61,11 +61,8 @@ int main(int argc, char *argv[])
|
|||||||
useHighDpiScaling = false;
|
useHighDpiScaling = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (useHighDpiScaling) {
|
if (!useHighDpiScaling)
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
} else {
|
|
||||||
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
|
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
|
||||||
}
|
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
WidgetGallery gallery;
|
WidgetGallery gallery;
|
||||||
|
@ -58,9 +58,6 @@ static constexpr int MouseCount = 7;
|
|||||||
//! [0]
|
//! [0]
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_ANDROID
|
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
#endif
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
//! [0]
|
//! [0]
|
||||||
|
|
||||||
|
@ -55,9 +55,6 @@
|
|||||||
int main(int argv, char *args[])
|
int main(int argv, char *args[])
|
||||||
{
|
{
|
||||||
Q_INIT_RESOURCE(diagramscene);
|
Q_INIT_RESOURCE(diagramscene);
|
||||||
#ifdef Q_OS_ANDROID
|
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QApplication app(argv, args);
|
QApplication app(argv, args);
|
||||||
MainWindow mainWindow;
|
MainWindow mainWindow;
|
||||||
|
@ -55,9 +55,6 @@
|
|||||||
//! [0]
|
//! [0]
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_ANDROID
|
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
#endif
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
MainWindow mw;
|
MainWindow mw;
|
||||||
mw.show();
|
mw.show();
|
||||||
|
@ -56,9 +56,6 @@
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
Q_INIT_RESOURCE(spreadsheet);
|
Q_INIT_RESOURCE(spreadsheet);
|
||||||
#ifdef Q_OS_ANDROID
|
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
SpreadSheet sheet(10, 6);
|
SpreadSheet sheet(10, 6);
|
||||||
|
@ -58,9 +58,6 @@
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
Q_INIT_RESOURCE(application);
|
Q_INIT_RESOURCE(application);
|
||||||
#ifdef Q_OS_ANDROID
|
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
QCoreApplication::setOrganizationName("QtProject");
|
QCoreApplication::setOrganizationName("QtProject");
|
||||||
|
@ -54,9 +54,6 @@
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_ANDROID
|
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
#endif
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
Q_INIT_RESOURCE(dockwidgets);
|
Q_INIT_RESOURCE(dockwidgets);
|
||||||
MainWindow mainWin;
|
MainWindow mainWin;
|
||||||
|
@ -175,7 +175,6 @@ static ParseCommandLineArgumentsResult
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
MainWindow::CustomSizeHintMap customSizeHints;
|
MainWindow::CustomSizeHintMap customSizeHints;
|
||||||
switch (parseCustomSizeHints(QCoreApplication::arguments(), &customSizeHints)) {
|
switch (parseCustomSizeHints(QCoreApplication::arguments(), &customSizeHints)) {
|
||||||
|
@ -54,9 +54,6 @@
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_ANDROID
|
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
#endif
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
Window window;
|
Window window;
|
||||||
window.show();
|
window.show();
|
||||||
|
@ -54,9 +54,6 @@
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_ANDROID
|
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
#endif
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
MainWindow window;
|
MainWindow window;
|
||||||
window.show();
|
window.show();
|
||||||
|
@ -54,9 +54,6 @@
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
Q_INIT_RESOURCE(undo);
|
Q_INIT_RESOURCE(undo);
|
||||||
#ifdef Q_OS_ANDROID
|
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
@ -54,9 +54,6 @@
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_ANDROID
|
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
#endif
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
Calculator calc;
|
Calculator calc;
|
||||||
calc.show();
|
calc.show();
|
||||||
|
@ -55,9 +55,6 @@
|
|||||||
//! [0]
|
//! [0]
|
||||||
int main( int argc, char *argv[] )
|
int main( int argc, char *argv[] )
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_ANDROID
|
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
#endif
|
|
||||||
QApplication application( argc, argv );
|
QApplication application( argc, argv );
|
||||||
TestWidget w;
|
TestWidget w;
|
||||||
w.showFullScreen();
|
w.showFullScreen();
|
||||||
|
@ -54,9 +54,6 @@
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_ANDROID
|
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
#endif
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
MainWindow window;
|
MainWindow window;
|
||||||
window.show();
|
window.show();
|
||||||
|
@ -54,9 +54,6 @@
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_ANDROID
|
|
||||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
#endif
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
Window window;
|
Window window;
|
||||||
window.show();
|
window.show();
|
||||||
|
@ -487,7 +487,9 @@ namespace Qt {
|
|||||||
AA_UseSoftwareOpenGL = 17,
|
AA_UseSoftwareOpenGL = 17,
|
||||||
AA_ShareOpenGLContexts = 18,
|
AA_ShareOpenGLContexts = 18,
|
||||||
AA_SetPalette = 19,
|
AA_SetPalette = 19,
|
||||||
AA_EnableHighDpiScaling = 20,
|
#if QT_DEPRECATED_SINCE(6, 0)
|
||||||
|
AA_EnableHighDpiScaling Q_DECL_ENUMERATOR_DEPRECATED = 20,
|
||||||
|
#endif
|
||||||
AA_DisableHighDpiScaling = 21,
|
AA_DisableHighDpiScaling = 21,
|
||||||
AA_UseStyleSheetPropagationInWidgetStyles = 22,
|
AA_UseStyleSheetPropagationInWidgetStyles = 22,
|
||||||
AA_DontUseNativeDialogs = 23,
|
AA_DontUseNativeDialogs = 23,
|
||||||
|
@ -215,15 +215,6 @@
|
|||||||
\value AA_SetPalette Indicates whether a palette was explicitly set on the
|
\value AA_SetPalette Indicates whether a palette was explicitly set on the
|
||||||
QGuiApplication. This value was added in Qt 5.5.
|
QGuiApplication. This value was added in Qt 5.5.
|
||||||
|
|
||||||
\value AA_EnableHighDpiScaling Enables high-DPI scaling in Qt on supported
|
|
||||||
platforms (see also \l{High DPI Displays}). Supported platforms are
|
|
||||||
X11, Windows and Android. Enabling makes Qt scale the main (device
|
|
||||||
independent) coordinate system according to display scale factors
|
|
||||||
provided by the operating system. This corresponds to setting the
|
|
||||||
QT_AUTO_SCREEN\unicode{0x200b}_SCALE_FACTOR environment variable to
|
|
||||||
1. This attribute must be set before QGuiApplication is constructed.
|
|
||||||
This value was added in Qt 5.6.
|
|
||||||
|
|
||||||
\value AA_DisableHighDpiScaling Disables high-DPI scaling in Qt, exposing window
|
\value AA_DisableHighDpiScaling Disables high-DPI scaling in Qt, exposing window
|
||||||
system coordinates. Note that the window system may do its own scaling,
|
system coordinates. Note that the window system may do its own scaling,
|
||||||
so this does not guarantee that QPaintDevice::devicePixelRatio() will
|
so this does not guarantee that QPaintDevice::devicePixelRatio() will
|
||||||
@ -305,6 +296,7 @@
|
|||||||
This value was added in 5.15
|
This value was added in 5.15
|
||||||
|
|
||||||
\omitvalue AA_AttributeCount
|
\omitvalue AA_AttributeCount
|
||||||
|
\omitvalue AA_EnableHighDpiScaling
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -3270,7 +3262,6 @@
|
|||||||
environment variable.
|
environment variable.
|
||||||
|
|
||||||
\sa QGuiApplication::setHighDpiScaleFactorRoundingPolicy()
|
\sa QGuiApplication::setHighDpiScaleFactorRoundingPolicy()
|
||||||
\sa AA_EnableHighDpiScaling.
|
|
||||||
|
|
||||||
\omitvalue Unset
|
\omitvalue Unset
|
||||||
\value Round Round up for .5 and above.
|
\value Round Round up for .5 and above.
|
||||||
|
@ -952,7 +952,6 @@ void QCoreApplication::setAttribute(Qt::ApplicationAttribute attribute, bool on)
|
|||||||
if (Q_UNLIKELY(QCoreApplicationPrivate::is_app_running)) {
|
if (Q_UNLIKELY(QCoreApplicationPrivate::is_app_running)) {
|
||||||
#endif
|
#endif
|
||||||
switch (attribute) {
|
switch (attribute) {
|
||||||
case Qt::AA_EnableHighDpiScaling:
|
|
||||||
case Qt::AA_DisableHighDpiScaling:
|
case Qt::AA_DisableHighDpiScaling:
|
||||||
case Qt::AA_PluginApplication:
|
case Qt::AA_PluginApplication:
|
||||||
case Qt::AA_UseDesktopOpenGL:
|
case Qt::AA_UseDesktopOpenGL:
|
||||||
|
@ -3699,7 +3699,7 @@ Qt::ApplicationState QGuiApplication::applicationState()
|
|||||||
|
|
||||||
Sets the high-DPI scale factor rounding policy for the application. The
|
Sets the high-DPI scale factor rounding policy for the application. The
|
||||||
\a policy decides how non-integer scale factors (such as Windows 150%) are
|
\a policy decides how non-integer scale factors (such as Windows 150%) are
|
||||||
handled, for applications that have AA_EnableHighDpiScaling enabled.
|
handled.
|
||||||
|
|
||||||
The two principal options are whether fractional scale factors should
|
The two principal options are whether fractional scale factors should
|
||||||
be rounded to an integer or not. Keeping the scale factor as-is will
|
be rounded to an integer or not. Keeping the scale factor as-is will
|
||||||
|
@ -1586,8 +1586,8 @@ bool QDockWidget::event(QEvent *event)
|
|||||||
|
|
||||||
// Usually the window won't get resized while it's being moved, but it can happen,
|
// Usually the window won't get resized while it's being moved, but it can happen,
|
||||||
// for example on Windows when moving to a screen with bigger scale factor
|
// for example on Windows when moving to a screen with bigger scale factor
|
||||||
// (and Qt::AA_EnableHighDpiScaling is enabled). If that happens we should
|
// If that happens we should update state->pressPos, otherwise it will be outside
|
||||||
// update state->pressPos, otherwise it will be outside the window when the window shrinks.
|
// the window when the window shrinks.
|
||||||
if (d->state && d->state->dragging)
|
if (d->state && d->state->dragging)
|
||||||
d->recalculatePressPos(static_cast<QResizeEvent*>(event));
|
d->recalculatePressPos(static_cast<QResizeEvent*>(event));
|
||||||
break;
|
break;
|
||||||
|
@ -496,10 +496,6 @@ private:
|
|||||||
|
|
||||||
void tst_QGraphicsItem::initMain()
|
void tst_QGraphicsItem::initMain()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
// Ensure minimum size constraints of framed windows on High DPI screens
|
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tst_QGraphicsItem::cleanup()
|
void tst_QGraphicsItem::cleanup()
|
||||||
|
@ -267,10 +267,6 @@ protected:
|
|||||||
|
|
||||||
void tst_QHeaderView::initMain()
|
void tst_QHeaderView::initMain()
|
||||||
{
|
{
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
// Ensure minimum size constraints of framed windows on High DPI screens
|
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class QtTestModel: public QAbstractTableModel
|
class QtTestModel: public QAbstractTableModel
|
||||||
|
@ -1458,7 +1458,6 @@ void MetricsTest::logScreenChangeSignal(const QObject *o, const char *name, cons
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
#define NOSCALINGOPTION "noscaling"
|
#define NOSCALINGOPTION "noscaling"
|
||||||
#define SCALINGOPTION "scaling"
|
|
||||||
|
|
||||||
qInfo("High DPI tester %s", QT_VERSION_STR);
|
qInfo("High DPI tester %s", QT_VERSION_STR);
|
||||||
|
|
||||||
@ -1468,10 +1467,6 @@ int main(int argc, char **argv)
|
|||||||
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
|
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
|
||||||
preAppOptionCount++;
|
preAppOptionCount++;
|
||||||
qInfo("AA_DisableHighDpiScaling");
|
qInfo("AA_DisableHighDpiScaling");
|
||||||
} else if (qstrcmp(argv[a], "--" SCALINGOPTION) == 0) {
|
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
preAppOptionCount++;
|
|
||||||
qInfo("AA_EnableHighDpiScaling");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1489,7 +1484,6 @@ int main(int argc, char **argv)
|
|||||||
QCommandLineOption controllerOption("interactive", "Show configuration window.");
|
QCommandLineOption controllerOption("interactive", "Show configuration window.");
|
||||||
parser.addOption(controllerOption);
|
parser.addOption(controllerOption);
|
||||||
parser.addOption(QCommandLineOption(NOSCALINGOPTION, "Set AA_DisableHighDpiScaling"));
|
parser.addOption(QCommandLineOption(NOSCALINGOPTION, "Set AA_DisableHighDpiScaling"));
|
||||||
parser.addOption(QCommandLineOption(SCALINGOPTION, "Set AA_EnableHighDpiScaling"));
|
|
||||||
|
|
||||||
DemoContainerList demoList;
|
DemoContainerList demoList;
|
||||||
demoList << new DemoContainer<PixmapPainter>("pixmap", "Test pixmap painter");
|
demoList << new DemoContainer<PixmapPainter>("pixmap", "Test pixmap painter");
|
||||||
|
@ -339,9 +339,7 @@ int main(int argc, char *argv[])
|
|||||||
std::copy(argv + 1, argv + argc, std::back_inserter(arguments));
|
std::copy(argv + 1, argv + argc, std::back_inserter(arguments));
|
||||||
|
|
||||||
#if QT_VERSION > 0x050000
|
#if QT_VERSION > 0x050000
|
||||||
if (arguments.contains("-s"))
|
if (arguments.contains("-n"))
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
else if (arguments.contains("-n"))
|
|
||||||
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
|
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
|
||||||
#endif // Qt 5
|
#endif // Qt 5
|
||||||
|
|
||||||
|
@ -77,7 +77,6 @@ QString graphicsApiName(QRhi::Implementation graphicsApi)
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
|
||||||
QRhi::Implementation graphicsApi;
|
QRhi::Implementation graphicsApi;
|
||||||
|
@ -525,7 +525,6 @@ void closeWindow()
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
|
@ -725,7 +725,6 @@ void closeWindow()
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
|
@ -125,7 +125,6 @@ QString graphicsApiName()
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
|
@ -440,7 +440,6 @@ void Window::render()
|
|||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
|
|
||||||
QLoggingCategory::setFilterRules(QLatin1String("qt.rhi.*=true"));
|
QLoggingCategory::setFilterRules(QLatin1String("qt.rhi.*=true"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user