[Interest] Confused about High-DPI icons...

Sérgio Martins sergio.martins at kdab.com
Wed Mar 13 23:41:16 CET 2019


On 2019-03-13 22:30, Matthew Woehlke wrote:
> I'm trying to add High-DPI icons to my application.
> 
> Currently, I have a bunch of icons as resources, e.g.:
> 
>   :/icons/16x16/open
>   :/icons/16x16/quit
>   ...
> 
> From reading the documentation, it *sounds* like all I should have to 
> do
> is add higher resolution icons with "magic" names:
> 
>   :/icons/16x16/open at 2x
>   :/icons/16x16/quit at 2x
>   ...
> 
> ...but this doesn't work; I still get the actually-16x16 icons scaled 
> up
> 2x. (Note: I am testing with 
> QT_SCALE_FACTOR=2/QT_SCREEN_SCALE_FACTORS=2
> as I don't have a "real" High-DPI display.)
> 
> Has anyone gotten this to work? Am I doing something wrong? Am I
> misreading the documentation?

Do you have:

QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);


Regards,
-- 
Sérgio Martins | sergio.martins at kdab.com | Senior Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel: Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - The Qt, C++ and OpenGL Experts


More information about the Interest mailing list