Results 1 to 5 of 5

Thread: Qt3-QPainter rotate exception

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPainter rotate exception

    Because the second time the label's pixmap is null since you set a QPicture instead.
    You shouldn't use setPicture, but setPixmap and instead of a QPicture use a QPixmap.

    So:
    Qt Code:
    1. QPainter paint;
    2. QPixmap *pix=pxldest->pixmap();
    3.  
    4. if(pix)
    5. {
    6. QPixmap rotated(pix->size().width(), pix->size().height());
    7. paint.rotate(27);
    8. paint.drawPixmap(0,0,*pix);
    9. paint.end();
    10. pxldest->setPixmap(rotated);
    11. QMessageBox::information(this,"Rotated","Image rotated");
    12. }
    To copy to clipboard, switch view to plain text mode 

    Regards

  2. The following user says thank you to marcel for this useful post:

    Raccoon29 (4th September 2007)

Similar Threads

  1. Replies: 7
    Last Post: 20th March 2006, 20:03
  2. QPainter rotate function
    By ir210 in forum Newbie
    Replies: 3
    Last Post: 17th January 2006, 04:31
  3. Exceptions and qApp->processEvents()
    By mcostalba in forum Qt Programming
    Replies: 3
    Last Post: 8th January 2006, 17:06

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.