Results 1 to 6 of 6

Thread: label - pixmap - problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2009
    Posts
    3
    Platforms
    Windows

    Default Re: label - pixmap - problem

    hi,
    i tried the approach using the qt resource system u mentioned and it worked instantly. oh yeah, i also gave the isnull fn a try... also very useful...
    so thx a million 4 ur help

    oh well yeah.. if someone else is ever going to have the same problem.... this way u can display the pic...

    Qt Code:
    1. #include <QApplication>
    2. #include <QLabel>
    3. #include <QPixmap>
    4.  
    5. int main(int argc, char *argv[])
    6. {
    7. QApplication app(argc, argv);
    8.  
    9. QLabel *label = new QLabel();
    10. QPixmap image(":/bild.bmp");
    11. label->setPixmap(image);
    12. if(image.isNull()){
    13. label->setText("null pic");
    14. }
    15. label->show();
    16. return app.exec();
    17.  
    18. }
    To copy to clipboard, switch view to plain text mode 

    but u need to create a resource file and mention there ur picture.... in my case... bild.bmp... oh yeah.... and also u need to mention ur resource file in your project file... sounds really more depressing than it is.... if u use qt creator.... things are even done for u... just create a new res file... and select there the stuff u want to have.... then u can just use it the :/ way shown in the code... the rest ll be done for u...
    enjoy

  2. #2
    Join Date
    Sep 2010
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: label - pixmap - problem

    Not to stay passive, I've decided to link my executable with debug versions of Qt libs.
    I hope discovering why image loading is unsuccessful.

    I keep informed the forum.

    Thank you all for your suggestions. It permits at least to eliminate tracks and to discriminate the causes.

Similar Threads

  1. Replies: 19
    Last Post: 3rd April 2009, 23:17
  2. QWizard::Background Pixmap
    By divya balachandran in forum Installation and Deployment
    Replies: 9
    Last Post: 10th January 2009, 14:40
  3. tool buttons on top of label
    By McKee in forum Qt Programming
    Replies: 5
    Last Post: 2nd November 2008, 16:07
  4. Rotation problem trying to draw a compass widget
    By yellowmat in forum Qt Programming
    Replies: 2
    Last Post: 18th February 2007, 19:03
  5. Replies: 10
    Last Post: 1st February 2006, 10:08

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.