Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Viewport size is wrong



  • Hello everybody,

    We have builded a webengine browser based on demobrowser.
    When an HTML-page contains the following line:

    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    then the page size (QWebenginePage::contentsSize() ) is 4 times bigger then it should be. Instead of (800x480) is (3200x1920).

    However in javascript, document.body.clientWidth is 800.

    The Zoom factor (QWebenginePage::zoomFactor()) is 1. The font size and all HTML elements are not zoomed. But i can scroll horizontally and vertically and the 'center positions' are relative to this size and not to the document.body.innerWidth/window.screen.width!! On the linux virtual machine works. On the linux device doesn't work.

    When the attribute 'user-scalable' is set to 'no' then the size is OK but i can not zoom any more.

    We use QT Version 5.9.

    Who does set contentsSize? Is't it possible to avoid/change it? On which QT-setting(s) is contentsSize based on?

    The signal 'contentsSizeChanged' is emitted 2 times. First time with the size (width:800, height:358) and second time with the size (width:3200, height:1432).

    Thank you in advance.

    Nicoleta Nething

    By the way: I'm a beginner in QT.


Log in to reply