CEF and high DPI QT Application.

Built a cool app using CEF that you'd like to share with the community? Talk about it here.

CEF and high DPI QT Application.

Postby LivingOnTheEdge » Wed Sep 23, 2020 4:31 am

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?
LivingOnTheEdge
Newbie
 
Posts: 2
Joined: Mon Jul 27, 2020 7:15 am

Re: CEF and high DPI QT Application.

Postby magreenblatt » Wed Sep 23, 2020 10:36 am

You can use CefBrowserHost::SetZoomLevel instead of changing the device scale factor. See viewtopic.php?f=6&t=11491&p=34108 for related discussion.
magreenblatt
Site Admin
 
Posts: 10832
Joined: Fri May 29, 2009 6:57 pm

Re: CEF and high DPI QT Application.

Postby LivingOnTheEdge » Wed Oct 28, 2020 5:34 am

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?
LivingOnTheEdge
Newbie
 
Posts: 2
Joined: Mon Jul 27, 2020 7:15 am


Return to Apps Discussion

Who is online

Users browsing this forum: No registered users and 1 guest