Although I could rotate the inner image with the code below, the sad point is that, the background image always fit inside the inner QLabel. But, what I need is to rotate both the QLabel and the image simultaneously. or it will be better not to use QLabel at all this way. can I only load an extra image inside the outer frame background image and try to rotate it? I need help please.
orig_pixmap->load("path-to-png");
degrees++;
if(degrees == 90) degrees = 0;
QTransform rotate_disc;
rotate_disc.translate((orig_pixmap->width()-ui->label->width())/2 , (orig_pixmap->width()-ui->label->height())/2);
rotate_disc.rotate(degrees,Qt::ZAxis);
//pixmap = orig_disc->scaled(89,89,Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
pixmap = orig_pixmap->transformed(rotate_disc,Qt::SmoothTransformation);
ui->label->setPixmap(pixmap);
QPixmap *orig_pixmap = new QPixmap();
orig_pixmap->load("path-to-png");
degrees++;
if(degrees == 90) degrees = 0;
QTransform rotate_disc;
rotate_disc.translate((orig_pixmap->width()-ui->label->width())/2 , (orig_pixmap->width()-ui->label->height())/2);
rotate_disc.rotate(degrees,Qt::ZAxis);
QPixmap pixmap;
//pixmap = orig_disc->scaled(89,89,Qt::IgnoreAspectRatio,Qt::SmoothTransformation);
pixmap = orig_pixmap->transformed(rotate_disc,Qt::SmoothTransformation);
ui->label->setPixmap(pixmap);
To copy to clipboard, switch view to plain text mode
Bookmarks