Results 1 to 4 of 4

Thread: Rotating a pixmap inside a widget

  1. #1
    Join Date
    Apr 2011
    Posts
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Rotating a pixmap inside a widget

    Hello, I need help with rotating a pixmap inside a widget. What I have is a Circle and a Pointer, they are both 2 seperated images. (Think about a Tachometer) I have already the pointer in the middle of the circle as I want. What I am failing with is to rotate the pointer as I want.

    I can rotate it but its not rotating from the point where I need it to rotate. Right now it is rotating from somewhere I dont know where, I need the pointer to stay where it is and rotate from there.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Rotating a pixmap inside a widget

    Open Qt Assistant and look for "Analog Clock Example" in the Index

  3. #3
    Join Date
    Apr 2011
    Posts
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Rotating a pixmap inside a widget

    Alright will do, thank you.





    Im still having trouble figuring this out.

    My code:
    Qt Code:
    1. boolPainter.drawPixmap(0, 0, QPixmap(":/Image/CircleDark"));
    2. boolPainter.drawPixmap(0,0, QPixmap(":/Image/Pointer"));
    To copy to clipboard, switch view to plain text mode 

    Its the Pointer I need rotate, could I get some kind of example or something?
    Last edited by Eneswar; 3rd May 2011 at 09:55.

  4. #4
    Join Date
    Apr 2011
    Posts
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Rotating a pixmap inside a widget

    I have got it sorted with:

    Qt Code:
    1. item->setTransform(QTransform().translate(x, y).rotate(45).translate(-x, -y));
    To copy to clipboard, switch view to plain text mode 

  5. The following user says thank you to Eneswar for this useful post:

    maxvanceffer (28th June 2011)

Similar Threads

  1. Rotating pixmap
    By jano_alex_es in forum Newbie
    Replies: 4
    Last Post: 19th December 2010, 04:00
  2. QMainWindow inside another widget
    By DanFessler in forum Newbie
    Replies: 4
    Last Post: 23rd August 2010, 21:58
  3. rotating a widget
    By oguzy in forum Qt Programming
    Replies: 2
    Last Post: 23rd November 2008, 00:08
  4. Shell inside QT WIdget
    By pshah.mumbai in forum Qt Programming
    Replies: 4
    Last Post: 17th September 2008, 17:57
  5. Save content of widget to pixmap
    By vql in forum Qt Programming
    Replies: 2
    Last Post: 4th April 2008, 22:26

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.