Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. SVG Gradients in Qt5
Forum Updated to NodeBB v4.3 + New Features

SVG Gradients in Qt5

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 529 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.
  • Oak77O Offline
    Oak77O Offline
    Oak77
    wrote on last edited by
    #1

    Hi community,

    I'm confused, are gradients in SVG actually supported, or not?
    I found some posts that indicate that gradients are supported and working, but other confused me.

    I'm using Qt5, QtSvg.QSvgWidget. I've loaded an image created in InkScape and no gradients are shown (the areas get transparent).

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by Christian Ehrlicher
      #2

      According to the Qt docs TinySVG 1.2 static is supported. And according to the TinySVG 1.2 spec there's linearGradient in TinySVG 1.2.
      You can also simply look into the Qt source code and you'll see that gradients are supported.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      Oak77O 1 Reply Last reply
      1
      • Christian EhrlicherC Christian Ehrlicher

        According to the Qt docs TinySVG 1.2 static is supported. And according to the TinySVG 1.2 spec there's linearGradient in TinySVG 1.2.
        You can also simply look into the Qt source code and you'll see that gradients are supported.

        Oak77O Offline
        Oak77O Offline
        Oak77
        wrote on last edited by
        #3

        @Christian-Ehrlicher Thank you. I noticed that TinySVG is supported and noticed there references to gradients. But wasn't sure if/how it translates to the real-world support.

        So I'll go back to minimal usable code and trivial SVG and do some tests again. I get a hunch, that the problem is that InkScape does not produced TinySVG compatible files.

        1 Reply Last reply
        0
        • Oak77O Offline
          Oak77O Offline
          Oak77
          wrote on last edited by
          #4

          Wow, that was so easy, once I got the right clues.

          Inkscape: Save As: Optimized SVG (in the combobox at the bottom of the dialog) --> Keep more or less default settings in the next pop-up dialog.

          Then it works in Qt5!

          1 Reply Last reply
          2

          • Login

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