Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Can we read and paint svg image in qt?



  • I want to paint the svg image on the widget.



  • Yes, that is possible.
    Did you look at the Svg Viewer Example in the documentation?



  • no i haven't seen yet.I will see and let you know if any doubt.



  • can we can't use svg directly like png or jpeg files.



  • Of course you can:

    @
    QPixmap img("/path/to/image.svg");
    label->setPixmap(img);
    @

    Make sure to have installed the imageformats plugins and the QtSvg4 lib on the target machines.



  • Can you please say. How can i check that?
    I have tried painting widget using pixmap containing svg file it was working but setting stylesheet function on slider groove was not working. what may be the reason behind it?



  • Sorry, I don't understand your question.

    Can you decide yourself whether you want to ask about drawing on widgets or about styling a widget with style sheets.

    Asking "smart questions":http://www.catb.org/~esr/faqs/smart-questions.html is more likely to get you useful answers. Asking incomplete, weird and contradictory questions is likely to get you no answers at all.



  • Actually i want to ask both the things. does that can be done using svg file?



  • Then state so clearly please. You're talking about painting on widgets on the first post. Nobody else than you knows that you're switching topics and talking about style sheets now. It would help if you added something like an "additional question" to one of your answers. A bit more explanation would help avoiding such confusion.

    Now that things are sorted out: I don't have experiences with styles sheets on widgets, so no statement on that from my side, sorry.


Log in to reply