Results 1 to 4 of 4

Thread: QLabel setPixmap doesnt work

  1. #1
    Join Date
    Apr 2008
    Posts
    35
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default QLabel setPixmap doesnt work

    Qt Code:
    1. void theGui::setImageLabel(QLabel* _label, IplImage* image){
    2. _label->setPixmap(QPixmap::fromImage(Ipl2QImage(image)).scaled(_label->size(),Qt::KeepAspectRatio));
    3. }
    To copy to clipboard, switch view to plain text mode 
    This one works fine..

    Qt Code:
    1. void theGui::setImageLabel(QLabel* _label, QString image){
    2. _label->setPixmap(QPixmap(image).scaled(_label->size(),Qt::KeepAspectRatio));
    3. }
    To copy to clipboard, switch view to plain text mode 
    This one doesnt work.. no image displayed


    Can you please tell me why above one doesnt work, I tried various things like QPixmap::fromImage(QImage(image)) , but still doesnt work...

    Thank you very much

    Arpit

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

    Default Re: QLabel setPixmap doesnt work

    Are you really sure "image" is a valid path to an image? And what format is the image? Do you have the right image plugins for that?...

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

    arpspatel (1st March 2010)

  4. #3
    Join Date
    Apr 2008
    Posts
    35
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QLabel setPixmap doesnt work

    "image" is a valid path, also i can load it as IplImage (OpenCV) but cant seem to use it with setPixmap, its JPG file,

    Do i need plugins as this is just basic image viewing.. how do i use the plugins, do i just copy qjpeg4.dll to the app dir...

    Thanks
    Arps

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

    Default Re: QLabel setPixmap doesnt work

    Hi,

    first make sure it is really because of the plugin. If so, see http://doc.trolltech.com/4.6/deploym...tml#qt-plugins for the location of the plugins.


    Lykurg

Similar Threads

  1. QLabel setPixmap only works twice?
    By December in forum Qt Programming
    Replies: 0
    Last Post: 28th February 2010, 10:59
  2. qlabel can't use setPixmap() function
    By emailhy in forum Qt Programming
    Replies: 1
    Last Post: 24th December 2009, 23:30
  3. How come this doesnt work?
    By ShaChris23 in forum Newbie
    Replies: 8
    Last Post: 16th June 2007, 04:43
  4. Replies: 2
    Last Post: 14th June 2007, 14:31
  5. QLabel not resize in setPixmap()
    By xgoan in forum Newbie
    Replies: 3
    Last Post: 23rd October 2006, 12:21

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.