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. Svg file apears noisy in QML
Forum Updated to NodeBB v4.3 + New Features

Svg file apears noisy in QML

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 547 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.
  • T Offline
    T Offline
    tahuislam
    wrote on last edited by tahuislam
    #1

    I am a QtQuick 5 beginner. I am trying to display a svg icon with Image type in my app. But my svgs apears very noisy and sometimes a ellipsis would apears as a almost distorted square. How can I solve this.

                         Rectangle{
                                width:20
                                height:width
                                Button{
                                    width:parent.width
                                    height:parent.height
                                    antialiasing: true
                                    background:Image{
                                        source:"./../../GUI/Icons/ionicons.designerpack/ellipsis-horizontal-sharp.svg"
                                        anchors.fill:parent
                                        width:parent.width
                                        height:parent.height
                                        antialiasing: true
                                    }
                                }
                            }
    

    Screenshot (28).png

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tahuislam
      wrote on last edited by tahuislam
      #2

      Problem Solved:
      I added sourceSize measurement instead of basic width and height
      And added fillMode: Image.PreserveAspectFit

      background:Image{   
                source:"./../../GUI/Icons/ionicons.designerpack/heart- 
                outline.svg"
                anchors.fill:parent
                sourceSize.width:parent.width
                sourceSize.height:parent.height
                fillMode: Image.PreserveAspectFit
      }
      JoeCFDJ 1 Reply Last reply
      2
      • T tahuislam

        Problem Solved:
        I added sourceSize measurement instead of basic width and height
        And added fillMode: Image.PreserveAspectFit

        background:Image{   
                  source:"./../../GUI/Icons/ionicons.designerpack/heart- 
                  outline.svg"
                  anchors.fill:parent
                  sourceSize.width:parent.width
                  sourceSize.height:parent.height
                  fillMode: Image.PreserveAspectFit
        }
        JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #3

        @tahuislam said in Svg file apears noisy in QML:

              sourceSize.width:parent.width
              sourceSize.height:parent.height
        

        these are not needed, right?
        sourceSize.width:parent.width
        sourceSize.height:parent.height

        the following works as well

        background:Image{   
                  source:"./../../GUI/Icons/ionicons.designerpack/heart- 
                  outline.svg"
                  anchors.fill:parent
                  fillMode: Image.PreserveAspectFit
        }
        
        1 Reply Last reply
        1

        • Login

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