Results 1 to 3 of 3

Thread: Set the size of a QPixmap object

  1. #1
    Join Date
    Feb 2010
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Set the size of a QPixmap object

    Hey all, I want to use QPixmap class to show a photo on a label object.
    So I code:
    QPixmap pixmap;
    pixmap.load(fileName);
    update();
    ui->iconLabel->setPixmap(pixmap);
    But the picture size is not the same as iconLabel. I want to scale the size of that picture by keeping aspect ratio(Make it the same size as iconLabel)
    How to realize that?Thx~

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Set the size of a QPixmap object


  3. #3
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Set the size of a QPixmap object

    take a look at the picture viewer example that comes with Qt

Similar Threads

  1. QPixmap - object disappears after fetched from http
    By djuvsland in forum Qt Programming
    Replies: 6
    Last Post: 26th January 2010, 12:20
  2. Replies: 1
    Last Post: 21st August 2008, 07:44
  3. QPixmap in QPushButton size problem
    By MarkoSan in forum Qt Programming
    Replies: 3
    Last Post: 22nd January 2008, 12:50
  4. Saving a QPixmap Object problem
    By StrikerX in forum General Programming
    Replies: 4
    Last Post: 15th November 2007, 02:19
  5. Replies: 5
    Last Post: 9th April 2007, 14:26

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.