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

QML WebEngineView - sometimes we can't change zoomFactor property the first time

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: P2: Important P2: Important
    • None
    • 5.12.5, 5.14.2
    • WebEngine
    • None
    • MSVC2017 32bit, Windows 10, QtCreator, MV C++ Compiler 14.0 (x86)
    • Windows

      In some circumstances we have incorrect behaviour regarding zoomFactor property in QML WebEngineView. We have a case where we need double setting of the value for the value accepting.

       

      Example 1:

      WebEngineView {
          id: webEngineView
      
          Timer {
              interval: 1000
              running: true
              repeat: true
              property int count: 0
              property var zoomValues: [1.0, 1.1, 1.2, 1.3, 1.4, 1.5]
              
              onTriggered: {
                  ++count;
      
                  var oldValue = webEngineView.zoomFactor;
      
                  // Try to set the value once
                  webEngineView.zoomFactor = zoomValues[count % zoomValues.length];
      
                  console.log(oldValue, webEngineView.zoomFactor, oldValue === webEngineView.zoomFactor ? "ERR" : "OK");
              }
          }
      }
      

      For this code, sometimes we can see "ERR" in the logs. It means that we tried to change zoomFactor value, but the value was not accepted. Moreover, we can detect some regularity in this behaviour: the value is not acceptable only once when we changed a direction of zoom factors: 1.5 -> 1.0 in our case.  

       

      Example 2:

      WebEngineView {
          id: webEngineView
      
          Timer {
              interval: 1000
              running: true
              repeat: true
              property int count: 0
              property var zoomValues: [1.0, 1.1, 1.2, 1.3, 1.4, 1.5]
              
              onTriggered: {
                  ++count;
      
                  var oldValue = webEngineView.zoomFactor;
      
                  // Try to set the value twice
                  webEngineView.zoomFactor = zoomValues[count % zoomValues.length];
                  webEngineView.zoomFactor = zoomValues[count % zoomValues.length];
      
                  console.log(oldValue, webEngineView.zoomFactor, oldValue === webEngineView.zoomFactor ? "ERR" : "OK");
              }
          }
      }
      

      In this case we try to set the value twice. For this code, we have "OK" in the logs for all checks.

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

            qt_webengine_team Qt WebEngine Team
            yoxfox Anatoliy Dudko
            Votes:
            3 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes