The problem is pretty simple. I have a QLabel
object which gets a picture via setting a resource to the pixmap
attribute. Because the Qt Designer is the best GUI Designer of the world (ever) it shows the picture rotated 90° left:
How can I rotate the QLabel?
I also would be happy if somebody could tell me why the Qt Creator does rotate the image itself. Windows (the best OS ever) says it has a width of 88 px and a height of 923 px:
Here Breite == Width
and Höhe == Height
(Höhe, Breite is German (Best language ever)):
I appreciate your help!
If I were you I would rotate the image and then set the label pixmap. Possibly not the best solution, but it works.
To rotate the image you could do something like this:
QPixmap original;
// load original from your source or take it from somewhere
QImage srcImg = original.toImage();
QPoint center = srcImg.rect().center();
QMatrix matrix;
matrix.translate(center.x(), center.y());
matrix.rotate(90);
QImage dstImg = srcImage.transformed(matrix);
QPixmap dstPix = QPixmap::fromImage(dstImg); //New pixmap rotated
Now you have the new QPixmap
rotated ready to be set as the QLabel
pixmap.
If you have the original image on your computer an even dumber and easier solution would be to rotate the original image with any image software and directly load it.
QPixmap verticalPixmap('/path/to/image/rotatedImage.jpg');