I came across an issue regarding icons and static build.
Consider the following tiny program below.

If it is compiled with a dynamic build the icon in the toolButton is shown.
If it is compiled with static built it is not.

This behavior does not change whether I comment the QT_INIT_RESOURCE or not.
Can anyone suggest a solution so that I can see the icon after a static build also?
I tried using Qt 5.2.1 and MingGW

Thank you.



******* test.pro file **********
Qt Code:
  1. QT += core gui widgets
  2.  
  3. TARGET = test
  4. TEMPLATE = app
  5.  
  6. SOURCES += main.cpp
  7. HEADERS += mainwindow.h
  8. RESOURCES += \
  9. Images.qrc
To copy to clipboard, switch view to plain text mode 

********** main.c file **********
Qt Code:
  1. #include "mainwindow.h"
  2. #include <QApplication>
  3.  
  4. int main(int argc, char *argv[])
  5. {
  6. QApplication a(argc, argv);
  7. MainWindow w;
  8. w.show();
  9. return a.exec();
  10. }
  11.  
  12.  
  13. MainWindow::MainWindow(QWidget *parent) :
  14. QMainWindow(parent)
  15. {
  16. Q_INIT_RESOURCE(Images);
  17. tBtn = new QToolButton(this);
  18. tBtn->setIcon(QIcon(":/buttons/arrowUp.ico"));
  19. move(0,0);
  20. }
  21.  
  22. MainWindow::~MainWindow()
  23. {
  24. }
To copy to clipboard, switch view to plain text mode 

********** Images.qrc file **********
Qt Code:
  1. <RCC>
  2. <qresource prefix="/buttons">
  3. <file>arrowUp.ico</file>
  4. </qresource>
  5. </RCC>
To copy to clipboard, switch view to plain text mode