Page 1 of 1

CEF and high DPI QT Application.

PostPosted: Wed Sep 23, 2020 4:31 am
by LivingOnTheEdge
I have created Qt application which uses different CEF process to show some web pages.
In application dialog, CEF provided HWND is drawn.
In High DPI mode, my application is scaled 2X for (150%, 175%, 200%) and 1X for 125%.
What I am expecting is my CEF HWND also scale according to my application.

1> if I enable CefEnableHighDPISupport(), CEF HWND is scaled according to windows DPI setting.
here problem is that for 150% scaling , my application is scaled 2X and CEF HWND is scaled 1.5X. which doesn't fit in whole app window and for 125% scaling CEF HWND is clipped
2> if I pass scale value from y application to CEF process using command line argument "--force-device-scale-factor " , CEF HWND is scaled and drawn properly in application windows.
here problem is that , if I change dpi scale while application is running, CEF HWND is not scaled accordingly. it is drawn at fixed scale.

Is there any way handle this on Cef side?

Re: CEF and high DPI QT Application.

PostPosted: Wed Sep 23, 2020 10:36 am
by magreenblatt
You can use CefBrowserHost::SetZoomLevel instead of changing the device scale factor. See viewtopic.php?f=6&t=11491&p=34108 for related discussion.

Re: CEF and high DPI QT Application.

PostPosted: Wed Oct 28, 2020 5:34 am
by LivingOnTheEdge
Thanks, I can send any zoom value to cef process from my QT application. With SetZoomLevel() it works fine instead of setting dpi scale factor command-line. I can change it runtime now. What value I need to pass in SetZoomLevel function to get scale factor of 100%, 125%, 150%,200%, 300% so on. With link mention in above answer. I got the approximate vales, but not the exact, Is there any relation between zoom percentage and values sent in SetZoomLevel?