반응형
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.
반응형
'HJH IT Logs' 카테고리의 다른 글
notes.app 실행이 안될 때 (0) | 2024.11.12 |
---|---|
A log of life. (0) | 2024.11.12 |
산만한 개발자 모임 안건. (0) | 2024.11.12 |
AI 모델 성능 비교 (0) | 2024.11.12 |
Population Model(인구 모델) (0) | 2024.11.12 |
최근댓글