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

First rendering of a web page in a QWebEngineView repaints and possibly moves the application window

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.7.2
    • WebEngine
    • None
    • Distribution: Manjaro
      Desktop environments: Xfce, KDE Plasma (both X11 and Wayland)
      Graphics driver: amdgpu
    • Linux/Wayland, Linux/X11

    Description

      When a web page is first shown in a QWebEngineView, the application window briefly disappears, then reappears in a possibly different location (e.g. top-left corner of the same or another screen or the center of the same screen). Debugging my application pinpointed the time of the window disappearance to the first QWebEnginePage::setHtml() call.

      STEPS TO REPRODUCE:
      1. Apply the following patch (3 diff hunks) to the Qt example recipebrowser :

      diff --git a/mainwindow.cpp b/mainwindow.cpp
      index 7eedab4..3c8c356 100644
      --- a/mainwindow.cpp
      +++ b/mainwindow.cpp
      @@ -21,6 +21,7 @@ MainWindow::MainWindow(QWidget *parent)
           ui->textEdit->setFont(QFontDatabase::systemFont(QFontDatabase::FixedFont));
           ui->textEdit->hide();
           ui->webEngineView->setContextMenuPolicy(Qt::NoContextMenu);
      +    ui->webEngineView->hide();
       
           connect(ui->stylesheetsButton, &QPushButton::clicked, this, &MainWindow::showStyleSheetsDialog);
           connect(ui->editViewButton, &QPushButton::clicked, this, &MainWindow::toggleEditView);
      @@ -36,6 +37,7 @@ MainWindow::MainWindow(QWidget *parent)
                   [this](QListWidgetItem *current, QListWidgetItem * /* previous */) {
                       const QString page = current->text().toLower();
                       const QString url = QStringLiteral("qrc:/pages/") + page + QStringLiteral(".html");
      +                ui->webEngineView->show();
                       ui->webEngineView->setUrl(QUrl(url));
                       m_content.setCurrentPage(page);
                   });
      @@ -63,8 +65,6 @@ MainWindow::MainWindow(QWidget *parent)
               }
           }
           settings.endGroup();
      -
      -    ui->recipes->setCurrentItem(ui->recipes->item(0));
       }
       
       MainWindow::~MainWindow()
      

      2. Run the example.
      3. (optional) Move the application window somewhere and/or resize it.
      4. Select any recipe in the list.

      ACTUAL RESULTS:

      • the window briefly disappears and reappears in the same place or in a different place in case the 3rd optional step is not omitted;
      • subsequent recipe selection does not repaint or move the application window until application restart.

      EXPECTED RESULTS:

      • the first recipe selection behaves the same as subsequent selections and does not repaint or move the application window.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            mnegyokru Martin Negyokru
            vedg Igor Kushnir
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes