Results 1 to 3 of 3

Thread: rotate a QPixmap which is set on top of a QLabel

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2008
    Location
    My spaceship needs repairs..so, I am stuck on beautiful earth
    Posts
    98
    Thanks
    25
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Post rotate a QPixmap which is set on top of a QLabel

    Hi,
    I can't figure out how to rotate a picture which is set on top of a Label(in Qt 4.4.3)
    In Qt 3.3,I did it this way---
    Qt Code:
    1. int count=0;
    2. void pic_dis::rotate()
    3. {
    4. count++;
    5. QPixmap pm1 = QPixmap(fileName); //fileName is the complete path to the
    6. //picture
    7. //which I need to rotate
    8. QMatrix m1 ;
    9. m1.rotate( (90*count)%360 );
    10. if(count%2==1)
    11. {
    12. m1.scale((double)420/pm1.width(),
    13. (double)750/pm1.height());
    14. }
    15. else
    16. m1.scale((double)750/pm1.width(),
    17. (double)420/pm1.height());
    18. pm1 = pm1.xForm(m1);
    19. pic_display->setPixmap(pm1);
    20. }
    To copy to clipboard, switch view to plain text mode 
    xForm isn't available in Qt 4.4.3.

    Please suggest on what changes I should make in the code to make it work in Qt 4.4.3.
    Thanks for your time.
    Last edited by jpn; 23rd January 2009 at 16:16. Reason: missing [code] tags

Similar Threads

  1. Trouble with QLabel
    By dany_MB in forum Newbie
    Replies: 3
    Last Post: 14th August 2009, 08:21
  2. Replies: 3
    Last Post: 17th July 2008, 07:43
  3. Rotate QLabel
    By shader76 in forum Newbie
    Replies: 9
    Last Post: 24th December 2007, 12:31
  4. paintEvent, QString to QPixmap, QLabel
    By TheKedge in forum Qt Programming
    Replies: 1
    Last Post: 5th February 2007, 13:04
  5. QPixmap and HBITMAP
    By ToddAtWSU in forum Qt Programming
    Replies: 1
    Last Post: 21st June 2006, 16:24

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.