Qt World Summit: Register Today!


My Image is Cropped by QPixmap when displaying img using QLabel



  • Hi there, thanks for clicking into my post first.

    I am intending to use a simple QLable to display my image. However, my image is way too big in size. QPixmap automatically crops it for me and display part of it. I have tried QPixmap::scale(int w, int h, Qt::IgnoreAspectRatio) but it doesn't work. Am I correct to use QLabel to implement such a simple feature? Thanks

    Note: Qt 5.6, Ubuntu 16.04



  • @sylorr

    I have tried QPixmap::scale(int w, int h, Qt::IgnoreAspectRatio) but it doesn't work.

    scaled() is right, not scale(). QLabel::setScaledContents(true) may also be used.


Log in to reply