hi, there
I am using the qwidget to display images which could be portrait or landscape and the widget is resized for the image size, everything looks fine except when I display a portrait after a landscape or vise versa , the widget becomes square. A second image of the same shape will turn the widget to the image's shape. For example, if I am showing portrait, landscape, landscape in a sequence, the widget will be portrait, square, landscape. How can I change the square to the shape of the image? Here is my code.
/* imageLabel, imageviewerLayout, and imageViewer are QLabel, QVBoxLayout and QWidget which are defined globally*/
imageLabel
->setPixmap
(QPixmap::fromImage(image
));
imageLabel->resize(image.size());
imageviewerLayout->update();
imageViewer->resize(image.size());
imageViewer->updateGeometry();
imageViewer->show();
/* imageLabel, imageviewerLayout, and imageViewer are QLabel, QVBoxLayout and QWidget which are defined globally*/
QImage image(myFileName);
imageLabel->setPixmap(QPixmap::fromImage(image));
imageLabel->resize(image.size());
imageviewerLayout->update();
imageViewer->resize(image.size());
imageViewer->updateGeometry();
imageViewer->show();
To copy to clipboard, switch view to plain text mode
Thanks for help and have a good weekend.
zl2k
Bookmarks