Results 1 to 18 of 18

Thread: Scaling a pixmap in a label

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2015
    Posts
    8
    Qt products
    Qt5
    Platforms
    Unix/X11

    Post Scaling a pixmap in a label

    HI everyone,
    I'm new here and in programming Qt and I have a problem, so I hope you could explain it to me.
    Thank you very much.

    I have an image, represented by a pixmap, fit in a label in my mainwindow.
    I want to scale it but when I scale ithe pixmap, the label doesn't change, so I have two different situations:
    1) the label is the same but the pixmap inside it is scaled (so you can see only a part of the image)
    2) the label is the same and also the pixmap inside it

    In this code I have the second situation. Can you resolve this problem?
    Qt Code:
    1. void Interfaccia::zoomMappa()
    2. {
    3. QPixmap mappa("DefaultMap.png");
    4. ui->labelMap->setPixmap(mappa);
    5. ui->labelMap->setScaledContents(true);
    6. mappa.scaled(10,10,Qt::IgnoreAspectRatio);
    7. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by GianluC93; 19th December 2015 at 12:40.

Similar Threads

  1. Image/Pixmap after scaling parcelled into 4 pieces.
    By Douglish in forum Qt Programming
    Replies: 2
    Last Post: 19th February 2011, 09:28
  2. Pixmap scaling problem
    By tommy in forum Qt Programming
    Replies: 1
    Last Post: 14th May 2009, 17:00
  3. Replies: 8
    Last Post: 12th March 2009, 14:12
  4. finding maximum scaling of a pixmap
    By babu198649 in forum Newbie
    Replies: 1
    Last Post: 31st March 2008, 14:32
  5. Pixmap scaling
    By yellowmat in forum Newbie
    Replies: 3
    Last Post: 4th January 2007, 16:01

Tags for this Thread

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.