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. Problem for displaying SVG image
Forum Updated to NodeBB v4.3 + New Features

Problem for displaying SVG image

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 4 Posters 1.1k Views 2 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.
  • C Offline
    C Offline
    Chanchan
    wrote on last edited by Chanchan
    #1

    hey ! I would like to display an SVG image on my HMI (I use a Gridlayout for now)

    Here is what I do :

    #include <QSvgWidget>
    #include <QtSvg>
    ...
    QSvgWidget *svg_pic = new QSvgWidget("image's adress");
    layout->addWidget(*svg_pic,19,5,2,2);
    
    

    Also I put QT += svg in my .pro

    On my HMI I only obtain a black square on the position of the image.. I dont know why

    Thans for help :)

    jsulmJ 1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Qt only supports SVG tiny specification. Not all SVG images will work. I suggest checking it out in a simple desktop (Qt) app, to verify whether your image is OK.

      (Z(:^

      C 1 Reply Last reply
      3
      • C Chanchan

        hey ! I would like to display an SVG image on my HMI (I use a Gridlayout for now)

        Here is what I do :

        #include <QSvgWidget>
        #include <QtSvg>
        ...
        QSvgWidget *svg_pic = new QSvgWidget("image's adress");
        layout->addWidget(*svg_pic,19,5,2,2);
        
        

        Also I put QT += svg in my .pro

        On my HMI I only obtain a black square on the position of the image.. I dont know why

        Thans for help :)

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by jsulm
        #3

        @Chanchan said in Problem for displaying SVG image:

        QSvgWidget("image's adress")

        What is "image's adress" here and are you sure it is valid (can be found)?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        3
        • sierdzioS sierdzio

          Qt only supports SVG tiny specification. Not all SVG images will work. I suggest checking it out in a simple desktop (Qt) app, to verify whether your image is OK.

          C Offline
          C Offline
          Chanchan
          wrote on last edited by
          #4

          @sierdzio Oh I see, then I check it with an example from the documentation I guess ?

          @jsulm Yeah I am sure , I mean , this image is on my desk, I simply copy/past the way of the folder.img_name. Also, I tried to modify it just to see if the program will return me an error and that the case. So I guess it's okey on this side

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi
            you could also post a link to the SVG here so we could check it out.

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Chanchan
              wrote on last edited by
              #6

              okey :

              home/clement/Bureau/Icon_partner

              mrjjM 1 Reply Last reply
              0
              • C Chanchan

                okey :

                home/clement/Bureau/Icon_partner

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by mrjj
                #7

                @Chanchan said in Problem for displaying SVG image:

                Icon_partner

                hi
                that wont work :)
                something like
                https://postimages.org/

                and just post link here

                1 Reply Last reply
                1
                • C Offline
                  C Offline
                  Chanchan
                  wrote on last edited by
                  #8

                  Hey, I think I wasn't clear enough so that's my bad ^^
                  The picture I want to display is not from the web, this is a picture that I did myself with a svg extension. So It is stocked on my own computer (on my desktop)

                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    Chanchan
                    wrote on last edited by
                    #9

                    But I can send you the image if you want to test it :)

                    sierdzioS 1 Reply Last reply
                    0
                    • C Chanchan

                      But I can send you the image if you want to test it :)

                      sierdzioS Offline
                      sierdzioS Offline
                      sierdzio
                      Moderators
                      wrote on last edited by
                      #10

                      @Chanchan said in Problem for displaying SVG image:

                      But I can send you the image if you want to test it :)

                      Yes, that's what @mrjj is trying to get from you.

                      (Z(:^

                      1 Reply Last reply
                      2
                      • mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        Hi
                        on https://postimages.org/
                        you can just press upload and point to the image on your harddrive
                        and you get a link you can post here.

                        1 Reply Last reply
                        0
                        • C Offline
                          C Offline
                          Chanchan
                          wrote on last edited by
                          #12

                          Oh okey... sorry It is the morning x) I have some dofficulties to wake up

                          The extension was not recognize by your site @mrjj , I use wetransfer, here is the link to download ;)
                          https://we.tl/t-vtIuH5rzjn

                          Again thank you very much for helping me

                          mrjjM 1 Reply Last reply
                          0
                          • C Chanchan

                            Oh okey... sorry It is the morning x) I have some dofficulties to wake up

                            The extension was not recognize by your site @mrjj , I use wetransfer, here is the link to download ;)
                            https://we.tl/t-vtIuH5rzjn

                            Again thank you very much for helping me

                            mrjjM Offline
                            mrjjM Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on last edited by mrjj
                            #13

                            @Chanchan
                            Hi
                            hehe np. i know that feeling.
                            I also got black rect. Something Qt didnt like.
                            However after fiddling a bit in inkscape and saved it again. it would show.

                            alt text

                            here is modified svg. please try that.
                            https://www.dropbox.com/s/kk7j4t9p9h06ce6/Icones_Partner_v7.3_Administration.svg?dl=0

                            1 Reply Last reply
                            3

                            • Login

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