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.
Re: Rotating a pixmap inside a widget
Open Qt Assistant and look for "Analog Clock Example" in the Index
Re: Rotating a pixmap inside a widget
Alright will do, thank you.
Im still having trouble figuring this out.
My code:
Code:
boolPainter.
drawPixmap(0,
0,
QPixmap(":/Image/CircleDark"));
boolPainter.
drawPixmap(0,
0,
QPixmap(":/Image/Pointer"));
Its the Pointer I need rotate, could I get some kind of example or something?
Re: Rotating a pixmap inside a widget
I have got it sorted with:
Code:
item->setTransform(QTransform().translate(x, y).rotate(45).translate(-x, -y));