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. QSvgRenderer antialiasing seems not working
Forum Updated to NodeBB v4.3 + New Features

QSvgRenderer antialiasing seems not working

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.0k 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.
  • D Offline
    D Offline
    dolevo
    wrote on last edited by
    #1

    Hi all,

    I have an svg image and I need to scale it using QPainter & QImage. The final image is redered using QSvgRenderer. However, there is no change at the output image even though I apply anti aliasing. Could you please guide me to find the mistake?
    @
    void DrawImage(QImage &image)
    {
    QPainter *myQPainter = new QPainter(&image);
    QSvgRenderer *mySvgImg = new QSvgRenderer("svgimage");

    //Some scaling stuff

    myQPainter->setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform | QPainter::HighQualityAntialiasing);
    
    QRect myrectangle(500, 500, 600, 600);
    mySvgImg ->render(myQPainter,myrectangle);
    
    myQPainter ->end();
    

    }@

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You're setting the antialiasing flags on myQPainter and then use pnt to render. Are these the same thing?

      As a side note - the end() method is called by the QPainter's destructor (and I don't see a delete there so you have a memory leak btw.), so you usually don't need to call it explicitly. It is more common to crate the local painter on the stack to let it automatically release any resources and be gone at the end of the scope.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dolevo
        wrote on last edited by
        #3

        [quote author="Krzysztof Kawa" date="1364552220"]You're setting the antialiasing flags on myQPainter and then use pnt to render. Are these the same thing?

        As a side note - the end() method is called by the QPainter's destructor (and I don't see a delete there so you have a memory leak btw.), so you usually don't need to call it explicitly. It is more common to crate the local painter on the stack to let it automatically release any resources and be gone at the end of the scope.[/quote]

        That's my bad. I replaced some of the variable names to make it more readable when posting but forgot the pnt. I have already corrected my first post.
        Yes I use end(); also but didn't post here as well.

        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