Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. My Image is Cropped by QPixmap when displaying img using QLabel
Qt 6.11 is out! See what's new in the release blog

My Image is Cropped by QPixmap when displaying img using QLabel

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 753 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sylorr
    wrote on last edited by
    #1

    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

    D 1 Reply Last reply
    0
    • S sylorr

      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

      D Offline
      D Offline
      Devopia53
      wrote on last edited by
      #2

      @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.

      1 Reply Last reply
      2

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved