I think a post from Goz is a good match for your question. But if you want to avoid using the native Windows API (which is actually preferable, since the installation of the application icon is platform dependent), I would choose this seemingly less elegant approach:
1) in your .pro file: win32:RC_FILE=your_rcfile_with_icon.rc RESOURCES += qt_Resource_file.qrc 2) Add the same icon as in your .rc file to the qt .qrc file (ie embedd it twice) 3) in your main file: setWindowIcon(QIcon(":/the_icon.ico"));
This avoids API calls, and your code remains portable. The SEttign app icon, unfortunately, is different for each platform. Thus, you really should avoid native calls if you want to port code.
source share