Results 1 to 6 of 6

Thread: QImage scaled twice to same instance and QPainter paint abnormally

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Jun 2010
    Location
    Hangzhou, China
    Posts
    10
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QImage scaled twice to same instance and QPainter paint abnormally

    Quote Originally Posted by wysota View Post
    The painter works on an object you point it to. It has no influence on other objects (be it images or anything else).
    I think so too. Just the comprehension make me confused with the code I pasted.

    Let me describe it in detail.
    line 10 is commented, compile ->run it will create 1st image of my uploaded files.
    line 10 is NOT commented, compile->run, it will create 2nd image.

    balloon.jpg in line 10 is the 3rd image.

    I only scaled an image and then return itself.


    Added after 8 minutes:

    Another phenomenon:
    if the line 8 ~ line 10 such as below.
    "
    QImage tmpdi;
    tmpdi = image.scaled(resultSize,Qt::KeepAspectRatio);
    tmpdi = image.scaled(QSize(resultSize.width()*1.5, resultSize.height()*2.0),Qt::KeepAspectRatio);
    "
    run it, will get 2nd image of my uploaded image files.
    if it changed as
    "
    QImage tmpdi;
    QImage tmpditmp = image.scaled(resultSize,Qt::KeepAspectRatio);
    tmpdi = image.scaled(QSize(resultSize.width()*1.5, resultSize.height()*2.0),Qt::KeepAspectRatio);
    "
    it will create 1st image.

    I do not know why it gets different result? I only do create a new instance.
    I Can NOT do scale operation on same object, can I?
    If I do, what happen on Painter?

    or the code has some defects?
    Last edited by oliverliu.hz; 12th February 2011 at 08:24.

Similar Threads

  1. QPainter::begin: Cannot paint on a null pixmap
    By sabeesh in forum Qt Programming
    Replies: 5
    Last Post: 27th July 2010, 18:03
  2. How to paint (QPainter) on a label ?
    By d@nyal in forum Newbie
    Replies: 1
    Last Post: 29th May 2010, 18:39
  3. QPainter(&QPrinter) & QPainter(&QImage) communication
    By gufeatza in forum Qt Programming
    Replies: 2
    Last Post: 2nd February 2010, 07:25
  4. QImage::scaled takes long time
    By nrabara in forum Qt Programming
    Replies: 0
    Last Post: 15th December 2009, 12:19
  5. QImage::scaled() error in Qt4/e
    By Neo in forum Qt Programming
    Replies: 2
    Last Post: 7th April 2006, 06:15

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.