How to use "QWebEngineView" in "NSWindowStyleMaskFullSizeContentView" style window in Mac OS



  • When apply “NSWindowStyleMaskFullSizeContentView” style in Mac OS, the window that has a “QWebEngineView” will show abnormally. The size and layout of all widget are correct, but the content drawn in window is scaled when drag the window from one moitor to other.

    The window that not include “QWebEngineView” is all right.

    Please help me, because the problem is so strange, and if apply “NSWindowStyleMaskFullSizeContentView” in Qt demo that has a “QWebEngineView” will also encounter this problem.

    Here is my code:

    0_1513317083299_BD9C4715-07A0-4DA0-8472-663D97F655BD.png

    The window in origin monitor:
    0_1513317388021_BD4B026D4502528B6078B64B275B2190.jpg

    The window in other monitor that dragged to:
    0_1513317503287_53C8EBB195C20902C977ED9B793DB7FC.jpg



  • @TechGhost
    This problem is the bug of "WebEngineView" in mac os. When the root "NSView" of window's property "wantsLayer" is "NO", the WebEngineView will cover the corner of window, and affect the effect of the corner.

    Finally, I change the way for web view. Use objective-c native object "WebView" in mac os, and Use qt "WebEngineView" in other os platform.

    The sample code, introduce how to add NSView into QWidget, or add QWidget into NSView, in mac os:
    0_1513908890518_FFB7B64A-C51B-48C0-86FC-96077D090C77.png



  • If want to use cocoa's object by objective-c, you must import corresponding framework and header file:

    0_1513909445128_7C27E6EB-C408-4050-9503-EAF4A29D57FC.png

    0_1513909110101_D36EF9AC-5443-406F-9DAB-9845E67B34DC.png



  • (1)case 1: the root "NSView" of window's property "wantsLayer" is "YES", then The size and layout of all widget of window are correct, but the content drawn in window is scaled when drag the window from one moitor to another.
    mark: when apply “NSWindowStyleMaskFullSizeContentView” style in Mac OS, the root "NSView" of window's property "wantsLayer" will be auto set to "YES".

    (2)case 2: the root "NSView" of window's property "wantsLayer" is "NO", then if WebEngineView's content size is equal to window's content size, the WebEngineView will cover the corner of window, and affect the effect of the corner.

    so, WebEngineView will cause different problem in different window style, but there is no way to resolve them.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.