Qt: How to use AA_UseHighDpiPixmaps for two monitors
Asked Answered
H

1

8

I'm using two monitors: Retina and Normal.

I read this article http://blog.qt.io/blog/2013/04/25/retina-display-support-for-mac-os-ios-and-x11/

There are:

QIcon::pixmap() has been modified to return a larger pixmap on high-dpi systems. This is a behavior change and can break existing code, so it’s controlled by the AA_UseHighDpiPixmaps application attribute:

qApp->setAttribute(Qt::AA_UseHighDpiPixmaps);

When I set this attribute and run program with one of main monitors, all images look normal.

But if two monitors are active: images in normal monitor look terrible. Qt selects @2x images for normal monitor and resizes their.

How to solve my problem with two monitors?

Hatty answered 27/4, 2015 at 11:46 Comment(1)
For me, everything is OK. Maybe you have some problems with DPI scaling? Could you give us some code sample?Hawthorn
D
1

Try add

   QAppplication::setAttribute(Qt::AA_EnableHighDpiScaling) 

to your main

Desireah answered 14/8, 2020 at 22:54 Comment(1)
In Qt 6: main.cpp:85:36: 'AA_EnableHighDpiScaling' is deprecated: High-DPI scaling is always enabled. This attribute no longer has any effect. :449:33: note: 'AA_EnableHighDpiScaling' has been explicitly marked deprecated hereMonopolize

© 2022 - 2024 — McMap. All rights reserved.