Resize image to show in Qt
Hello, I want to show some pictures in Qt, but their size will not match the size that I intend to present in the Qt widget, so how can I show an image resizing its original size to fit the widget's size?
hi and welcome
Pixmap class has scaled function which returns a scaled copy.
QPixmap p; // load pixmap
// get label dimensions
int w = label->width();
int h = label->height();
// set a scaled pixmap to a w x h window keeping its aspect ratio