Results 1 to 5 of 5

Thread: showing icons - setPixmap problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2010
    Location
    Poland
    Posts
    184
    Thanks
    70
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default showing icons - setPixmap problem

    Hello!

    I've got problem with showing icons. I've read code from program where icons were used (on buttons or just somewhere on window). I've wrote code (based on that program):

    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::MainWindow)
    4. {
    5. ui->setupUi(this);
    6.  
    7. logoLabel = new QLabel(this);
    8. logoLabel->setPixmap(QPixmap(":/images/icon1.png"));
    9. ui->layout->addWidget(logoLabel);
    10.  
    11. button = new QPushButton;
    12. button->setIcon(QIcon(":/images/icon2.png"));
    13. button->setIconSize(QSize(48, 48));
    14. button->setFixedSize(150, 60);
    15. ui->layout->addWidget(button);
    16. }
    To copy to clipboard, switch view to plain text mode 

    but nothing shows. No icons (button is 'empty'). Images are in directory images/ where my source code is. What I'm doing wrong?

    thanks in advance
    best regards
    Tomasz
    Last edited by Tomasz; 21st July 2010 at 12:07.

Similar Threads

  1. Action Icons not showing when running app
    By jimmydean101 in forum Newbie
    Replies: 4
    Last Post: 14th February 2011, 15:35
  2. Problem showing QTableView
    By weaver4 in forum Qt Programming
    Replies: 6
    Last Post: 23rd November 2009, 13:42
  3. What's the problem with setPixmap?
    By yagabey in forum Qt Programming
    Replies: 4
    Last Post: 21st November 2008, 16:34
  4. Problem showing raw images
    By wkit23 in forum Qt Programming
    Replies: 5
    Last Post: 8th September 2006, 13:33
  5. svg icons not showing up
    By ePharaoh in forum Qt Programming
    Replies: 6
    Last Post: 6th April 2006, 15:56

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.