Results 1 to 5 of 5

Thread: image loading problem using qpixmap

  1. #1
    Join Date
    Feb 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default image loading problem using qpixmap

    i am developing an application,which needs to load the image dynamically. The images are in the memory.Each time it load may be the same image or a different one. I am using the code as follows
    QPixmap image;
    QPixmap largePixmap;

    image.load("c://Data/image.png");
    largePixmap.load("c://Data/image1.png");

    Defining in the constructor.
    For the 1st time when application start and the object created everything working fine.
    But when i came back again call the same class it showing the error image can not load.

    Can any one tell what is the problem and how to overcome from the problem

    please help!

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: image loading problem using qpixmap

    sorry, can you rephrase that and maybe show some compilable code?
    (Reading your description several times I do not understand your problem.)

  3. #3
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: image loading problem using qpixmap

    You called the same instance of the class? Or a different one? Ex:

    Qt Code:
    1. class LoadImg
    2. {
    3. private:
    4. QPixmap image;
    5. QPixmap largePixmap;
    6. image.load("c://Data/image.png");
    7. largePixmap.load("c://Data/image1.png");
    8.  
    9. public:
    10. showagain()
    11. {
    12. // show images , etc
    13. }
    14. }
    15.  
    16. LoadImg img; // image works
    17. img.showagain(); // doesnt work
    18.  
    19. // or:
    20.  
    21. LoadImg img; // image works
    22. LoadImg img2; // doesnt work
    To copy to clipboard, switch view to plain text mode 

  4. #4
    Join Date
    Feb 2010
    Posts
    2
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: image loading problem using qpixmap

    yes i called the same instance.
    Again if the i reduces the image size it will work for 2-3 times. Then problem arises.
    how do i overcome from the problem.
    If u please

  5. #5
    Join Date
    Oct 2008
    Posts
    306
    Thanks
    6
    Thanked 9 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: image loading problem using qpixmap

    With the amount of information you gave, your error is not reproducible. Please post the code you're using to load and display the images.

Similar Threads

  1. problems loading an image .jpg
    By maider in forum Qt Programming
    Replies: 3
    Last Post: 14th December 2009, 11:57
  2. Image Loading
    By kavinsiva in forum Qt Programming
    Replies: 2
    Last Post: 11th August 2009, 08:00
  3. Loading a QPixmap from raw data
    By pherthyl in forum Qt Programming
    Replies: 1
    Last Post: 27th January 2008, 10:12
  4. Loading jpeg (QPixmap with Qt Jambi)
    By Mr_Blonde in forum Qt Programming
    Replies: 4
    Last Post: 14th September 2006, 18:06
  5. Loading a custom image into a QPixmap
    By KShots in forum Qt Programming
    Replies: 12
    Last Post: 5th August 2006, 00:16

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.