Results 1 to 5 of 5

Thread: How do I set an QImage on a QLabel?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #5
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: How do I set an QImage on a QLabel?

    Quote Originally Posted by Maluko_Da_Tola View Post
    QLabel *labelImagem=new QLabel;
    labelImagem->setPicture(image);

    but it won't compile. Any suggestions what is going wrong?
    Surprise, surprise. QImage != QPicture! use:
    Qt Code:
    1. l.setPixmap(QPixmap::fromImage(yourImage));
    To copy to clipboard, switch view to plain text mode 

  2. The following user says thank you to Lykurg for this useful post:

    Maluko_Da_Tola (4th August 2010)

Similar Threads

  1. Replies: 1
    Last Post: 29th September 2009, 20:44
  2. display QImage on QLabel
    By akasi in forum Qt Programming
    Replies: 2
    Last Post: 23rd September 2008, 23:48
  3. Replies: 1
    Last Post: 2nd August 2008, 16:46
  4. What's faster: QPixmap-to-QImage or QImage-to-QPixmap
    By forrestfsu in forum Qt Programming
    Replies: 2
    Last Post: 15th December 2006, 18:11
  5. Replies: 3
    Last Post: 15th March 2006, 12:44

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
  •  
Qt is a trademark of The Qt Company.