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.
QMatrix is deprecated so you can use QTransform instead
void MyWidget::rotateLabel()
{
QPixmap pixmap(*my_label->pixmap());
QTransform tr;
tr.rotate(90);
pixmap = pixmap.transformed(tr);
my_label->setPixmap(pixmap);
}