Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. [qtwebkit 5.4.2 - WEC7-x86] Unable to load svg image from file (*.svg)
QtWS25 Last Chance

[qtwebkit 5.4.2 - WEC7-x86] Unable to load svg image from file (*.svg)

Scheduled Pinned Locked Moved Unsolved Qt WebKit
qtwebkitsvgqt 5.4.2msvc2008wec7
6 Posts 3 Posters 2.1k Views
  • 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.
  • V Offline
    V Offline
    VinayVerma
    wrote on last edited by VinayVerma
    #1

    I was able to successfully build qtwebkit-5.4.2 for WEC7-x86. However while trying the webkit example browser (qtwebkit-examples\examples\webkitwidgets\browser), it is not able to load svg images with file as source (*.svg). Also, when I tried to insert the same svg inline, it loads fine. I also tried the Desktop (x86) build for qtwebkit-5.4.2 and it is able to load the attached html perfectly.

    I tried searching if there is a known issue, but didn't find anything (some people have faced issues with incorrect height etc of svg).

    Could someone please suggest a solution or possible approach to debug.

    Thanks.

    Below is the html used:

    /<html>
    <head>
        <title>Welcome</title>
        <style>
            body, button {
                margin: 0 auto;
                font-size: 40px;
                font-family: Tahoma, Verdana, Arial, sans-serif;
            }
    
            .backimage_svg {
                width: 155px;
                height: 155px;
                background-image: url("polygon.svg");
                background-color: rgb(255,255,204);
            }
    
            .backimage_png {
                width: 155px;
                height: 155px;
                background-image: url("polygon.png");
                background-color: rgb(255,204,204);
            }
        </style>
    </head>
    <body>
        <!-- [OK] Inline SVG -->
        <p style="background-color: yellow" id="test">
            <svg id="logomark" x="0px" y="0px" width="155px" height="155px" viewBox="0 0 155 155" enable-background="new 0 0 155 155" onclick="xxx()">
                <polygon id="logomark-polyline" fill-rule="evenodd" clip-rule="evenodd" fill="#0CB9C7" points="128.25,26 147.19,96.69 95.44,148.44 24.75,129.5 5.81,58.81 57.56,7.06 " />
            </svg>
        </p>
        <p style="background-color: lime">
            <!-- [OK]  img element with PNG -->
            1<img src="polygon.png" border="1">
            <!-- [NG]  FancyBrowser fails to render SVG as img's source -->
            2<img src="polygon.svg" border="1">
            <!-- [OK]  PNG as background-image specified by CSS -->
            3<img class="backimage_png" border="1">
            <!-- [NG]  FancyBrowser fails to render SVG as background-image specified by CSS -->
            4<img class="backimage_svg" border="1">
        </p>
        <div class="backimage_svg">5</div>
        <div class="backimage_png">6</div>
    
        <button class="backimage_svg">7</button>
        <button>8<object class="backimage_svg"></object></button>
        <button>
            9<svg id="logomark" x="0px" y="0px" width="155px" height="155px" viewBox="0 0 155 155" enable-background="new 0 0 155 155">
                <polygon id="logomark-polyline" fill-rule="evenodd" clip-rule="evenodd" fill="#0CB9C7" points="128.25,26 147.19,96.69 95.44,148.44 24.75,129.5 5.81,58.81 57.56,7.06 " />
            </svg>
        </button>
        <button class="backimage_png">10</button>
    </body>
    </html>
    

    Below is the polygon.svg file:

    <svg width="155" height="155" xmlns ="http://www.w3.org/2000/svg">
      <polygon fill-rule="evenodd" clip-rule="evenodd" fill="#0CB9C7" points="128.25,26 147.19,96.69 95.44,148.44 24.75,129.5 5.81,58.81 57.56,7.06 "/>
    </svg>
    
    

    Below are the screenshots when rendered on Desktop Vs WEC7 (qtwebkit-5.4.2 example browser):
    Desktop:
    0_1531200059268_DesktopFancyBrowserQt5.4.2.png

    WEC7:
    0_1531200089145_Wec7FancyBrowserQt5.4.2.png

    V 1 Reply Last reply
    0
    • V VinayVerma

      I was able to successfully build qtwebkit-5.4.2 for WEC7-x86. However while trying the webkit example browser (qtwebkit-examples\examples\webkitwidgets\browser), it is not able to load svg images with file as source (*.svg). Also, when I tried to insert the same svg inline, it loads fine. I also tried the Desktop (x86) build for qtwebkit-5.4.2 and it is able to load the attached html perfectly.

      I tried searching if there is a known issue, but didn't find anything (some people have faced issues with incorrect height etc of svg).

      Could someone please suggest a solution or possible approach to debug.

      Thanks.

      Below is the html used:

      /<html>
      <head>
          <title>Welcome</title>
          <style>
              body, button {
                  margin: 0 auto;
                  font-size: 40px;
                  font-family: Tahoma, Verdana, Arial, sans-serif;
              }
      
              .backimage_svg {
                  width: 155px;
                  height: 155px;
                  background-image: url("polygon.svg");
                  background-color: rgb(255,255,204);
              }
      
              .backimage_png {
                  width: 155px;
                  height: 155px;
                  background-image: url("polygon.png");
                  background-color: rgb(255,204,204);
              }
          </style>
      </head>
      <body>
          <!-- [OK] Inline SVG -->
          <p style="background-color: yellow" id="test">
              <svg id="logomark" x="0px" y="0px" width="155px" height="155px" viewBox="0 0 155 155" enable-background="new 0 0 155 155" onclick="xxx()">
                  <polygon id="logomark-polyline" fill-rule="evenodd" clip-rule="evenodd" fill="#0CB9C7" points="128.25,26 147.19,96.69 95.44,148.44 24.75,129.5 5.81,58.81 57.56,7.06 " />
              </svg>
          </p>
          <p style="background-color: lime">
              <!-- [OK]  img element with PNG -->
              1<img src="polygon.png" border="1">
              <!-- [NG]  FancyBrowser fails to render SVG as img's source -->
              2<img src="polygon.svg" border="1">
              <!-- [OK]  PNG as background-image specified by CSS -->
              3<img class="backimage_png" border="1">
              <!-- [NG]  FancyBrowser fails to render SVG as background-image specified by CSS -->
              4<img class="backimage_svg" border="1">
          </p>
          <div class="backimage_svg">5</div>
          <div class="backimage_png">6</div>
      
          <button class="backimage_svg">7</button>
          <button>8<object class="backimage_svg"></object></button>
          <button>
              9<svg id="logomark" x="0px" y="0px" width="155px" height="155px" viewBox="0 0 155 155" enable-background="new 0 0 155 155">
                  <polygon id="logomark-polyline" fill-rule="evenodd" clip-rule="evenodd" fill="#0CB9C7" points="128.25,26 147.19,96.69 95.44,148.44 24.75,129.5 5.81,58.81 57.56,7.06 " />
              </svg>
          </button>
          <button class="backimage_png">10</button>
      </body>
      </html>
      

      Below is the polygon.svg file:

      <svg width="155" height="155" xmlns ="http://www.w3.org/2000/svg">
        <polygon fill-rule="evenodd" clip-rule="evenodd" fill="#0CB9C7" points="128.25,26 147.19,96.69 95.44,148.44 24.75,129.5 5.81,58.81 57.56,7.06 "/>
      </svg>
      
      

      Below are the screenshots when rendered on Desktop Vs WEC7 (qtwebkit-5.4.2 example browser):
      Desktop:
      0_1531200059268_DesktopFancyBrowserQt5.4.2.png

      WEC7:
      0_1531200089145_Wec7FancyBrowserQt5.4.2.png

      V Offline
      V Offline
      VinayVerma
      wrote on last edited by
      #2

      @VinayVerma UPDATE: I tried the qtsvg example (qtsvg\examples\svg\svgviewer) and it is able to load svg image from file source. It would be really helpful if someone could point me precisely to the code which is handling this part. I'll then try a comparison between WEC7 and Desktop code. Thanks.

      K 1 Reply Last reply
      0
      • V VinayVerma

        @VinayVerma UPDATE: I tried the qtsvg example (qtsvg\examples\svg\svgviewer) and it is able to load svg image from file source. It would be really helpful if someone could point me precisely to the code which is handling this part. I'll then try a comparison between WEC7 and Desktop code. Thanks.

        K Offline
        K Offline
        Konstantin Tokarev
        wrote on last edited by
        #3

        I guess SVG support is just disabled in your WEC build for the sole purpose of reducing binary size

        V 1 Reply Last reply
        1
        • V Offline
          V Offline
          VinayVerma
          wrote on last edited by
          #4
          This post is deleted!
          1 Reply Last reply
          0
          • K Konstantin Tokarev

            I guess SVG support is just disabled in your WEC build for the sole purpose of reducing binary size

            V Offline
            V Offline
            VinayVerma
            wrote on last edited by
            #5

            @Konstantin-Tokarev Hi Konstantin,

            Thanks for your quick reply. In case the SVG support is disabled, would it still be possible to display inline SVG images (the first polygon image above)?

            Also, could you please suggest how to check if SVG support is enabled/disabled, and how to enable in case it is disabled.

            Thanks.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              Ashna
              wrote on last edited by
              #6

              @VinayVerma Were you able to find a solution to the above problem? I am facing the exact same issue.

              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