반응형
1. Setting the Icon for Windows
- Create an .ico file (this can contain multiple resolutions in one file).
- Place the .ico file in your project directory.
- In your .pro file, add the following line to reference the icon file:
-
proCopy codeRC_ICONS = path/to/icon.ico
- This line tells Qt to include the .ico file in the build, so it will appear as the application icon on Windows.
2. Setting the Icon for macOS
- Create an .icns file (specific to macOS).
- Place the .icns file in your project directory.
- In the .pro file, add:
-
proCopy codeICON = path/to/icon.icns
- This will set the application icon for macOS applications.
3. Setting the Icon for Linux
- For Linux, you generally set the icon for the application window, rather than the app file itself.
- In your main code, use the setWindowIcon() method on the main window:
-
cppCopy codeQIcon icon("path/to/icon.png"); mainWindow.setWindowIcon(icon);
- Note that Linux desktop environments often require .desktop files to specify application icons system-wide. This file typically goes in /usr/share/applications and references your icon.
By adding these settings to your project, Qt will package the icon for the respective platforms.
반응형
'C++ > [LOG] QT Project' 카테고리의 다른 글
프로젝트 정리 (0) | 2021.03.02 |
---|---|
build succeeded (0) | 2020.08.25 |
chromium in Xcode (3) | 2020.08.25 |
chromium build 프로젝트 시작 (3) | 2020.08.25 |
네이버 웨일 브라우저 오픈소스 정보 (0) | 2019.02.11 |
최근댓글