Results 1 to 11 of 11

Thread: Push Button with image?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    Nov 2010
    Location
    Budapest, Hungary
    Posts
    125
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    17
    Thanked 2 Times in 2 Posts

    Default Re: Push Button with image?

    If you want to use the resource system, is it not that there is a ":/" missing? In my application I use resiurce files like this:
    QFile qfi(":/texts/res/usageNotes.txt");
    This works:
    Qt Code:
    1. QIcon icon;
    2. QPixmap qpm;
    3.  
    4. if(qpm.load(":/img/myImage.jpg"))
    5. {
    6. icon.addPixmap(qpm);
    7. ui->pushButton->setIcon(icon);
    8. }
    9. else ui->label->setText("nincs betöltve");
    To copy to clipboard, switch view to plain text mode 

    Otherwise I have the guess that the absolute path works because the executable file is not generated in the same directory as the code, so the executable file whilst working is trying to find the image on the relative path from itself, where is actually nothing, as there might be even no directory like that.
    Last edited by szisziszilvi; 17th March 2011 at 11:44.
    Szilvi

Similar Threads

  1. [QT]Push button-no action
    By nqn in forum Newbie
    Replies: 4
    Last Post: 30th May 2010, 19:08
  2. A very small push button
    By Gnurou in forum Qt Programming
    Replies: 2
    Last Post: 15th November 2009, 03:04
  3. problem in Displaying image on push button
    By durgarao in forum Qt Tools
    Replies: 4
    Last Post: 2nd January 2009, 10:27
  4. shape of push button
    By Seema Rao in forum Qt Programming
    Replies: 23
    Last Post: 2nd April 2008, 01:05
  5. Push Button problem!!
    By Seema Rao in forum Qt Programming
    Replies: 1
    Last Post: 22nd April 2006, 16:31

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.