简体   繁体   中英

QLabel image rotate on another image

I try to make clock on QLabel and control needle rotate

And I put needle.png on clock.png.

I want to control angle let QLabel work like needle rotate on clock.

I don't know how to rotate needle.png.

How to achieve this rotate needle.png on clock.png.

use a transformation

QPixmap orig (":/n/apple-touch-icon.png");
QTransform t;
t.rotate(45+i);
ui->label->setPixmap(orig.transformed(t).scaledToWidth(32));
i+=10;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM