Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-109424

QWebEngineView can cause window to briefly disappear and change position

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 6.4.0, 6.4.1
    • None
    • Windows

    Description

      This issue was probably introduced with Qt 6.4.0 - I could only compare 6.4.1 and 6.3.2 (where everything works as expected), but a colleague tested it with 6.4.0 and confirmed the issues are present.

      If a QWebEngineView is created dynamically and added to widget that is already visible on screen, the parent window disappears for a fraction of a second and then reappears at the window's initial/default position. That is, if the window has been moved before adding the web view, the new position is ignored and it reappears at the initial position.

      If the window was maximized and moved to a secondary screen, it will show up in the primary screen instead, using the whole screen size (not necessarily centered) but it will no longer be maximized. Note that if the window was not maximized, it will not be moved back to the primary screen. Very odd

      This issue does not occur in Qt 6.3.2 and it does not occur with other widgets like a QTextEdit.

      To reproduce it in the attached example, press the "Toggle web view" or "Toggle text edit" buttons, but make sure to move the window first, so you can see how the window position will be reset.

      The window disappearing for a moment occurs even without moving it though.

      The issue appears only the first time a web view is added dynamically. Adding more or deleting and adding a new one will not trigger the issue.

      One more oddity.. if I "statically" add a first web view to the widget (that is not after the widget is shown), the issue will not appear. If that first web view is added but hidden, it still works fine. Try enabling the "#if 0" code in the attached test to reproduce this scenario.

      I know this might be an uncommon real world scenario, like an app adding the slow and memory hungry web view only when needed - e.g. to show a map - or having the user add it to a form as you would do in Qt Designer. In fact, this issue also appears in Qt Designer when dropping a web view for the first time.

      I have encountered it while debugging another odd issue started in 6.4.1. For some reason, drag&drop will stop working at a certain point after dynamically adding a web engine view. Possibly unrelated and I'm still failing to reproduce it in a standalone test, but it also appeared since 6.4.0, so some changes in that release are triggering some odd behaviour when a web view is used.

       

      PS: Tested only on Windows 10 x64 at the moment.

      Attachments

        1. change_screen_641.gif
          292 kB
          Fabrizio Angius
        2. move632.gif
          550 kB
          Fabrizio Angius
        3. move641.gif
          819 kB
          Fabrizio Angius
        4. webengine_test.zip
          1 kB
          Fabrizio Angius

        Issue Links

          Activity

            People

              lagocs Laszlo Agocs
              hippydream Fabrizio Angius
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: