title: Qt4 application icon not appearing on Windows taskbar
body: <p>My Qt4 application, when launched, does not appear as an icon on the taskbar of Windows 7 and Windows XP. How can I make it appear?</p>
  
  <p>When I minimize my app, it turns into a small window-less title bar on the bottom left.</p>
  
  <p>And by the way, I'm doing the following in my CMakeLists.txt, to prevent a console window from tagging along with my app:</p>
  
  <pre><code>if(WIN32)
    add_executable( codequery WIN32 ${CODEQUERY_SRCS} ${CODEQUERY_MOC_SRCS} ${CODEQUERY_RC_SRCS} ${CODEQUERY_UI_HDRS} ${QM} )
  else()
    add_executable( codequery ${CODEQUERY_SRCS} ${CODEQUERY_MOC_SRCS} ${CODEQUERY_RC_SRCS} ${CODEQUERY_UI_HDRS} ${QM} )
  endif()
  </code></pre>
  
  <p>Here's my main function:</p>
  
  <pre><code>#include "mainwindow.h"
  
  int main(int argc, char *argv[])
  {
  QApplication app(argc, argv);
  QMainWindow *wndw = new QMainWindow;
  mainwindow mw(wndw, &amp;app);
  
  mw.show();
  return app.exec();
  }
  </code></pre>
  
  <p>Here's part of mainwindow's declaration:</p>
  
  <pre><code>namespace Ui {
       class MainWindow;
   }
  
  class mainwindow : public QMainWindow
  {
    Q_OBJECT
  
  public:
  Ui::MainWindow *ui;
  mainwindow(QMainWindow *parent = NULL, QApplication *app = NULL);
  virtual ~mainwindow();
  </code></pre>
  
  <p>And here's part of its constructor:</p>
  
  <pre><code>#include "mainwindow.h"
  #include "ui_mainWindow.h"
  
  mainwindow::mainwindow(QMainWindow *parent, QApplication *app)
  :QMainWindow(parent)
  ,m_app(app)
  ,ui(new Ui::MainWindow)
   {
       ui-&gt;setupUi(this);
   }
  </code></pre>
  
  <p>The GUI part was designed using Qt Designer, and it's generated as ui_mainWindow.h.</p>
  
  <p>Part of the setupUi function:</p>
  
  <pre><code>void setupUi(QMainWindow *MainWindow)
  {
      if (MainWindow-&gt;objectName().isEmpty())
          MainWindow-&gt;setObjectName(QString::fromUtf8("MainWindow"));
      MainWindow-&gt;resize(629, 600);
      QIcon icon;
      icon.addFile(QString::fromUtf8(":/mainwindow/images/logo.png"), QSize(), QIcon::Normal, QIcon::Off);
      MainWindow-&gt;setWindowIcon(icon);
  </code></pre>