In my application I want to rotate image (I have set image on QLabel
). I have set one QPushButton
, on click that button I want to rotate my image in Four directions (Right->Bottom->Left->Top)
Any help?
Assuming you have a pointer to your QLabel you could do something like
void MyWidget::rotateLabel()
{
QPixmap pixmap(*my_label->pixmap());
QMatrix rm;
rm.rotate(90);
pixmap = pixmap.transformed(rm);
my_label->setPixmap(pixmap);
}
This will take you through Right, Bottom, Left, Top in four applications.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With