Results 1 to 11 of 11

Thread: Problem when load JPG

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 268 Times in 268 Posts
    Wiki edits
    20

    Default Re: Problem when load JPG

    Check if the qt/2010.05/bin/imageFormats folder contains qjpeg4.dll

  2. #2
    Join Date
    Mar 2010
    Location
    Brazil
    Posts
    39
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: Problem when load JPG

    Yes, its there.

  3. #3
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 268 Times in 268 Posts
    Wiki edits
    20

    Default Re: Problem when load JPG

    Change your code to use a value instead of a pointer for the image.
    Example:

    Qt Code:
    1. class YourWidgetClass
    2. {
    3. private:
    4. QImage img;
    5. };
    To copy to clipboard, switch view to plain text mode 

    In the constructor:
    Qt Code:
    1. img.load(fileName);
    2. imgLbl1->setPixmap(QPixmap::fromImage(img));
    To copy to clipboard, switch view to plain text mode 

    If that doesn't solve your problem, the filename is wrong.

  4. #4
    Join Date
    Mar 2010
    Location
    Brazil
    Posts
    39
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: Problem when load JPG

    I did what you told me. But doesnt works.
    Only the bmp, png and gif works....

    The path is correct otherwise how can the others formats works?

  5. #5
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanked 268 Times in 268 Posts
    Wiki edits
    20

    Default Re: Problem when load JPG

    Very simple:
    1. The code you posted is not the real code of your program? But I guess it is.
    2. Back to my first reply, you do not have a jpg decoder on your computer that is able to work with Qt.

    I don't understand your problem. I installed the Qt SDK and showing jpg's works for me, so it is not a Qt SDK problem, it is either a problem with your code or with your system.

  6. #6
    Join Date
    Mar 2010
    Location
    Brazil
    Posts
    39
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    2
    Thanked 1 Time in 1 Post

    Default Re: Problem when load JPG

    I think that problem is with system.
    I compiled/ran the same code just now but in linux, and its works!

    tbscope, thanks for your attention!

    Just a last question: Why did you say to me change the *img pointers to img? Is there any problem with pointers use? How can I know when use pointer or not?

    Thanks again.

Similar Threads

  1. Replies: 3
    Last Post: 8th September 2010, 03:01
  2. problem about load resource file dynamically
    By Raul in forum Qt Programming
    Replies: 1
    Last Post: 27th August 2010, 06:56
  3. SQL driver load problem
    By vieraci in forum Qt Programming
    Replies: 1
    Last Post: 12th December 2009, 15:59
  4. QWebView::Load problem
    By yogeshgokul in forum Qt Programming
    Replies: 2
    Last Post: 3rd December 2008, 11:28
  5. QStandardItemModel save/load Problem
    By sun in forum Newbie
    Replies: 9
    Last Post: 1st October 2008, 19:20

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