Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved]WebView has Weird question on Qt 5 (size problem)
Qt 6.11 is out! See what's new in the release blog

[Solved]WebView has Weird question on Qt 5 (size problem)

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 2.5k 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.
  • H Offline
    H Offline
    hhacker
    wrote on last edited by
    #1

    My code was as simple as those:
    @ WebView {
    id: testWebViewJs
    anchors.fill: parent
    url: "http://localhost"
    onUrlChanged: {
    console.log(testWebViewJs.url);
    }
    }
    @

    My environment is Qt 5.2 with mingw on WIndows 7.
    I'm working on a qml based tool which is using QtQuick 2.2.
    Here is the problem:
    1.first of all,I can not drag a WebView to ui in the design mode ,it tells me :
    "Using Qt Quick 1 code mode instead of Qt Quick 2 (M324)"
    Even I add WebView manually in code mode,it still show me these error,I had to use "// @disable-check M324" to avoid this message.

    2.The WebView shows correct html at the beginning,then I found that it will take over other widgets's place when I scroll up/down the webpage,it seems like the WebView was squatting places outisde of the Rectangle wrapper,suddenly i realized maybe it's just the size probelm.
    Then I found preferredHeight and preferredWidth in the design mode,but it tells me "Cannot assign to non-existent property "preferredHeight".
    I checked Qt 5.2's doc,it's just a few Properties and doesn't have preferredWidth/preferredHeight
    I can't move anymore,should I use Qt Quick 1 instead(I rather not to)?is that a wrong tool for display html content?Grateful for any advice.

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hhacker
      wrote on last edited by
      #2

      it turns out it's all because of my dropshadow code like this:
      @
      DropShadow {
      id: rectShadow;
      anchors.fill: source
      cached: true;

          verticalOffset: 0;
          radius: 8.0;
          samples: 16;
          color: "#80000000";
          smooth: true;
          source: container;
      }
      

      @

      I have drawn a shadow around the container(window),webview was in within the window of course,so I still don't know why it's happened,but I can resolve it by simply comment these codes,it works fine now.
      Thanks to my rubber duck

      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