Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QtWebEngine
  4. QT6.8 c++ QWebEngine ... Web pages start with main windows flickering
Forum Updated to NodeBB v4.3 + New Features

QT6.8 c++ QWebEngine ... Web pages start with main windows flickering

Scheduled Pinned Locked Moved Unsolved QtWebEngine
8 Posts 3 Posters 100 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • gfxxG Offline
    gfxxG Offline
    gfxx
    wrote last edited by
    #1

    I created an application that displays web pages from several devices. Each individual device is displayed on a web page in a main Windows widget tab. It works fine, but when I first open the web page, the application "flickers," appears to close, and then opens. It's essentially a kind of rendering overload. I'm on Ubuntu 24. I've posted my code below.

    void MainWindow::onTabChanged(int index)
    {
        const int cameraTabIndex = 5;
        const int cobotTabIndex = 4;
        const int cobotTabIndex = 3;
        const int cobotTabIndex = 2;
    
        if (index == cameraTabIndex) {
            if (!cameraWebView) {
                QApplication::setOverrideCursor(Qt::WaitCursor);
                QApplication::processEvents();
                cameraWebView = new QWebEngineView(this);
                ui->cameraShow->layout()->addWidget(cameraWebView);
                cameraWebView->load(QUrl(cameraUrl));
                connect(cameraWebView, &QWebEngineView::loadFinished, this, [=](bool ok){
                    QApplication::restoreOverrideCursor();
                });
            }
        } else {
            if (cameraWebView) {
                cameraWebView->deleteLater();
                cameraWebView = nullptr;
            }
        }
    
    ....... /* other devices other tab .... */
    
    
    

    I can't find a way to "hide" this unwanted effect....

    bkt

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote last edited by
      #2

      Hi,

      Which version of Qt are you using ?
      How did you install it ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      gfxxG 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Which version of Qt are you using ?
        How did you install it ?

        gfxxG Offline
        gfxxG Offline
        gfxx
        wrote last edited by
        #3

        @SGaist Qtcreator 14 and QT6.7.3 .... ubuntu 24 ....

        thanks for your interest ...

        bkt

        JonBJ 1 Reply Last reply
        0
        • gfxxG gfxx

          @SGaist Qtcreator 14 and QT6.7.3 .... ubuntu 24 ....

          thanks for your interest ...

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote last edited by
          #4

          @gfxx
          @SGaist knows much more than I, this may not be relevant and you might wait for further input from him. But since the behaviour relates only to the first time you open the web page, could the QApplication::restoreOverrideCursor() have anything to do with it? If you comment out that connect() line does it make any difference?

          gfxxG 1 Reply Last reply
          0
          • JonBJ JonB

            @gfxx
            @SGaist knows much more than I, this may not be relevant and you might wait for further input from him. But since the behaviour relates only to the first time you open the web page, could the QApplication::restoreOverrideCursor() have anything to do with it? If you comment out that connect() line does it make any difference?

            gfxxG Offline
            gfxxG Offline
            gfxx
            wrote last edited by
            #5

            @JonB nothing change .... actually think a way to open qwebengine from separate qthread but I've not idea if possible or if can solve these "freezy" like graphical result on startup of first QWebEngine opening .... is very resource hungry QWebEngine ....

            bkt

            JonBJ 1 Reply Last reply
            0
            • gfxxG gfxx

              @JonB nothing change .... actually think a way to open qwebengine from separate qthread but I've not idea if possible or if can solve these "freezy" like graphical result on startup of first QWebEngine opening .... is very resource hungry QWebEngine ....

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote last edited by
              #6

              @gfxx
              At least you tried. I do not think you can/must not try opening or otherwise manipulating a QWebEngine thing from a second thread: Qt does not allow/support any UI operations anywhere other than the main thread, and I think QWebEngine will be in that category.

              Yes, QWebEngine is quite "heavyweight" on resources/speed. Not really to do with Qt, it uses the third-party Chromium engine to do its work and that is a big beast.

              gfxxG 1 Reply Last reply
              1
              • JonBJ JonB

                @gfxx
                At least you tried. I do not think you can/must not try opening or otherwise manipulating a QWebEngine thing from a second thread: Qt does not allow/support any UI operations anywhere other than the main thread, and I think QWebEngine will be in that category.

                Yes, QWebEngine is quite "heavyweight" on resources/speed. Not really to do with Qt, it uses the third-party Chromium engine to do its work and that is a big beast.

                gfxxG Offline
                gfxxG Offline
                gfxx
                wrote last edited by
                #7

                @JonB said in QT6.8 c++ QWebEngine ... Web pages start with main windows flickering:

                At least you tried. I do not think you can/must not try opening or otherwise manipulating a QWebEngine thing from a second thread: Qt does not allow/support any UI operations anywhere other than the main thread, and I think QWebEngine will be in that category.

                Yes, QWebEngine is quite "heavyweight" on resources/speed. Not really to do with Qt, it uses the third-party Chromium engine to do its work and that is a big beast.

                You are in right .... think I use the old method of show a overlay mask with spinner during first loading .... I think the user might find it unusual but at least he won't see that flash where the application seems to be crashing and then reopening immediately... it's destabilizing.... In any case, I hope that some kind soul can suggest a trick to lighten the interface... during normal work it consumes less than 3% of the CPU resources, if I open a web page the consumption rises to 60%.... that's a big leap.... it's one thing to do it when opening the entire application.... it's another thing to do it with the application already open....

                bkt

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote last edited by
                  #8

                  6.7.3 is a bit old. You might want to try with the latest of the 6.9 series to see if things improve with regard to webengine.

                  One thing, are you in debug or release mode ? That can have some impact on performances.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved